|
|
|
@ -1,15 +1,17 @@
@@ -1,15 +1,17 @@
|
|
|
|
|
package com.cloud.kicc.system.controller; |
|
|
|
|
package com.cloud.kicc.monitor.controller; |
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
|
import com.cloud.kicc.system.api.entity.OperLog; |
|
|
|
|
import com.cloud.kicc.system.service.OperLogService; |
|
|
|
|
import com.cloud.kicc.common.core.api.R; |
|
|
|
|
import com.cloud.kicc.common.core.constant.AppConstants; |
|
|
|
|
import com.cloud.kicc.common.log.annotation.SysLog; |
|
|
|
|
import com.cloud.kicc.common.security.annotation.Inner; |
|
|
|
|
import com.cloud.kicc.monitor.api.entity.OperLog; |
|
|
|
|
import com.cloud.kicc.monitor.service.OperLogService; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
@ -32,14 +34,14 @@ public class OperLogController {
@@ -32,14 +34,14 @@ public class OperLogController {
|
|
|
|
|
|
|
|
|
|
private final OperLogService operLogService; |
|
|
|
|
|
|
|
|
|
private QueryWrapper<OperLog> getQueryWrapper(OperLog operLog) { |
|
|
|
|
return new QueryWrapper<OperLog>() |
|
|
|
|
.like(StrUtil.isNotBlank(operLog.getOperName()), "oper_name", operLog.getOperName()) |
|
|
|
|
.like(StrUtil.isNotBlank(operLog.getTitle()), "title", operLog.getTitle()) |
|
|
|
|
.eq(!StrUtil.isEmptyIfStr(operLog.getStatus()), "status", operLog.getStatus()) |
|
|
|
|
.eq(!StrUtil.isEmptyIfStr(operLog.getType()), "type", operLog.getType()) |
|
|
|
|
.between(StrUtil.isNotBlank(operLog.getBeginTime()) && StrUtil.isNotBlank(operLog.getEndTime()), "oper_time", operLog.getBeginTime(), operLog.getEndTime()) |
|
|
|
|
.orderByDesc("id"); |
|
|
|
|
private LambdaQueryWrapper<OperLog> getQueryWrapper(OperLog operLog) { |
|
|
|
|
return new LambdaQueryWrapper<OperLog>() |
|
|
|
|
.like(StrUtil.isNotBlank(operLog.getOperName()), OperLog::getOperName, operLog.getOperName()) |
|
|
|
|
.like(StrUtil.isNotBlank(operLog.getTitle()), OperLog::getTitle, operLog.getTitle()) |
|
|
|
|
.eq(ObjectUtil.isNotEmpty(operLog.getStatus()), OperLog::getStatus, operLog.getStatus()) |
|
|
|
|
.eq(StrUtil.isNotBlank(operLog.getType()), OperLog::getType, operLog.getType()) |
|
|
|
|
.between(StrUtil.isNotBlank(operLog.getBeginTime()) && StrUtil.isNotBlank(operLog.getEndTime()), OperLog::getOperTime, operLog.getBeginTime(), operLog.getEndTime()) |
|
|
|
|
.orderByDesc(OperLog::getId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping("/list") |
|
|
|
@ -58,20 +60,16 @@ public class OperLogController {
@@ -58,20 +60,16 @@ public class OperLogController {
|
|
|
|
|
@SysLog("操作日志删除") |
|
|
|
|
@DeleteMapping("/remove/{id:[\\w,]+}") |
|
|
|
|
@PreAuthorize("@pms.hasPermission('operLog_del')") |
|
|
|
|
public R remove(@PathVariable String[] id) { |
|
|
|
|
try { |
|
|
|
|
operLogService.removeByIds(Arrays.asList(id)); |
|
|
|
|
return R.ok(); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
return R.error(e.getMessage()); |
|
|
|
|
} |
|
|
|
|
public R remove(@PathVariable String[] ids) { |
|
|
|
|
operLogService.removeByIds(Arrays.asList(ids)); |
|
|
|
|
return R.ok(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@SysLog("操作日志清空") |
|
|
|
|
@DeleteMapping("/clean") |
|
|
|
|
@PreAuthorize("@pms.hasPermission('operLog_del')") |
|
|
|
|
public R clean() { |
|
|
|
|
operLogService.remove(new QueryWrapper<>()); |
|
|
|
|
operLogService.remove(new QueryWrapper()); |
|
|
|
|
return R.ok(); |
|
|
|
|
} |
|
|
|
|
|