日志列表接口
This commit is contained in:
parent
77dcfc46a0
commit
1ee84896a4
|
|
@ -0,0 +1,47 @@
|
|||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.system.dto.OperationLogDTO;
|
||||
import com.czg.system.entity.OperationLog;
|
||||
import com.czg.system.service.OperationLogService;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 日志管理
|
||||
* @author Administrator
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin/log")
|
||||
public class SysLogController {
|
||||
@Resource
|
||||
private OperationLogService operationLogService;
|
||||
|
||||
/**
|
||||
* 日志列表
|
||||
* @param param 参数
|
||||
* @return 分页信息
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "sysLog:list", name = "日志列表")
|
||||
@GetMapping
|
||||
public CzgResult<Page<OperationLogDTO>> get(OperationLogDTO param) {
|
||||
return CzgResult.success(operationLogService.page(param));
|
||||
}
|
||||
|
||||
/**
|
||||
* 日志删除
|
||||
* @return 是否成功
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "sysLog:del", name = "日志删除")
|
||||
@DeleteMapping
|
||||
public CzgResult<Boolean> del() {
|
||||
return CzgResult.success(operationLogService.remove(new QueryWrapper().eq(OperationLog::getShopId, StpKit.USER.getShopId())));
|
||||
}
|
||||
}
|
||||
|
|
@ -86,11 +86,11 @@ public class OperationLogDTO implements Serializable {
|
|||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime beginTime;
|
||||
private String startTime;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
private String endTime;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.czg.service.system.service.impl;
|
|||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.product.entity.ShopProdUnit;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.system.mapper.OperationLogMapper;
|
||||
import com.czg.system.dto.OperationLogDTO;
|
||||
|
|
@ -30,15 +29,15 @@ public class OperationLogServiceImpl extends ServiceImpl<OperationLogMapper, Ope
|
|||
if (StrUtil.isNotEmpty(param.getOperation())) {
|
||||
queryWrapper.like(OperationLog::getOperation, param.getOperation());
|
||||
}
|
||||
if (param.getBeginTime() != null) {
|
||||
queryWrapper.ge(OperationLog::getCreateTime, param.getBeginTime());
|
||||
if (StrUtil.isNotBlank(param.getStartTime())) {
|
||||
queryWrapper.ge(OperationLog::getCreateTime, param.getStartTime());
|
||||
}
|
||||
if (param.getEndTime() != null) {
|
||||
if (StrUtil.isNotBlank(param.getEndTime())) {
|
||||
queryWrapper.le(OperationLog::getCreateTime, param.getEndTime());
|
||||
}
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
queryWrapper.eq(ShopProdUnit::getShopId, shopId);
|
||||
queryWrapper.orderBy(ShopProdUnit::getId, false);
|
||||
queryWrapper.eq(OperationLog::getShopId, shopId);
|
||||
queryWrapper.orderBy(OperationLog::getId, false);
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
|
@ -54,4 +53,4 @@ public class OperationLogServiceImpl extends ServiceImpl<OperationLogMapper, Ope
|
|||
return super.listAs(queryWrapper, OperationLogDTO.class);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue