✨ Introducing new features. close #3607 系统日志、定时任务日志 批量删除

This commit is contained in:
qraddx committed 2022-02-10 14:18:29 +08:00
1 parent bbe1917e01
commit 11badf807a
6 files changed
+28 -4

No files matched your search

@@ -51,6 +51,10 @@ public class MybatisPlusMetaObjectHandler implements MetaObjectHandler {
* @param isCover 是否覆盖原有值,避免更新操作手动入参
*/
private static void fillValIfNullByName(String fieldName, Object fieldVal, MetaObject metaObject, boolean isCover) {
// 0. 如果填充值为空
if (fieldVal == null) {
return;
}
// 1. 没有 get 方法
if (!metaObject.hasSetter(fieldName)) {
return;
@@ -85,6 +85,7 @@ public class SysFile extends Model<SysFile> {
/**
* 上传时间
*/
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;
@@ -108,6 +109,6 @@ public class SysFile extends Model<SysFile> {
@TableLogic
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "删除标记,1:已删除,0:正常")
private Integer delFlag;
private String delFlag;
}
@@ -72,6 +72,7 @@ public class SysLog implements Serializable {
* 创建者
*/
@ExcelProperty("创建人")
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建人")
private String createBy;
@@ -19,6 +19,7 @@
package com.pig4cloud.pigx.admin.controller;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pigx.admin.api.dto.SysLogDTO;
@@ -74,6 +75,17 @@ public class SysLogController {
return R.ok(sysLogService.removeById(id));
}
/**
* 批量删除日志
* @param ids ID
* @return success/false
*/
@DeleteMapping
@PreAuthorize("@pms.hasPermission('sys_log_del')")
public R removeByIds(@RequestBody Long[] ids) {
return R.ok(sysLogService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 插入日志
* @param sysLog 日志实体
@@ -125,6 +125,7 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> impl
sysFile.setType(FileUtil.extName(file.getOriginalFilename()));
sysFile.setBucketName(ossProperties.getBucketName());
sysFile.setCreateUser(SecurityUtils.getUser().getUsername());
sysFile.setUpdateUser(SecurityUtils.getUser().getUsername());
this.save(sysFile);
}
@@ -17,6 +17,7 @@
package com.pig4cloud.pigx.daemon.quartz.controller;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pigx.common.core.util.R;
@@ -25,9 +26,7 @@ import com.pig4cloud.pigx.daemon.quartz.service.SysJobLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* @author frwcloud
@@ -54,4 +53,10 @@ public class SysJobLogController {
return R.ok(sysJobLogService.page(page, Wrappers.query(sysJobLog)));
}
@DeleteMapping
@ApiOperation(value = "批量删除日志")
public R deleteLogs(@RequestBody Long[] logIds) {
return R.ok(sysJobLogService.removeBatchByIds(CollUtil.newArrayList(logIds)));
}
}