From 44a5b9835616f0d8bc37dd35694e3ca6ec288085 Mon Sep 17 00:00:00 2001 From: kapai <282985537@qq.com> Date: Fri, 9 Oct 2020 22:26:37 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20Introducing=20new=20features.=20?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=8A=9F=E8=83=BD=E6=96=B0=E5=A2=9E=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=BF=87=E6=BB=A4=E6=9D=A1=E4=BB=B6=20https://gitee.c?= =?UTF-8?q?om/log4j/pig/issues/I1XPCP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pig/admin/api/dto/SysLogDTO.java | 31 +++++++++++++++++++ .../pig/admin/api/{vo => util}/TreeUtil.java | 2 +- .../pig/admin/controller/LogController.java | 6 ++-- .../pig/admin/service/SysLogService.java | 10 ++++++ .../service/impl/SysDeptServiceImpl.java | 2 +- .../admin/service/impl/SysLogServiceImpl.java | 21 +++++++++++++ .../service/impl/SysMenuServiceImpl.java | 2 +- 7 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/SysLogDTO.java rename pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/{vo => util}/TreeUtil.java (98%) diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/SysLogDTO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/SysLogDTO.java new file mode 100644 index 00000000..0bf75d87 --- /dev/null +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/dto/SysLogDTO.java @@ -0,0 +1,31 @@ +package com.pig4cloud.pig.admin.api.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author lengleng + * @date 2020/10/9 + *

+ * 日志查询传输对象 + */ +@Data +@ApiModel(value = "日志查询对象") +public class SysLogDTO { + + /** + * 查询日志类型 + */ + @ApiModelProperty(value = "日志类型") + private String type; + + /** + * 创建时间区间 [开始时间,结束时间] + */ + @ApiModelProperty(value = "创建时间区间") + private LocalDateTime[] createTime; + +} diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/TreeUtil.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/TreeUtil.java similarity index 98% rename from pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/TreeUtil.java rename to pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/TreeUtil.java index b389333f..3e2d052b 100644 --- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/TreeUtil.java +++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/TreeUtil.java @@ -20,7 +20,7 @@ * @ Apache-2.0 */ -package com.pig4cloud.pig.admin.api.vo; +package com.pig4cloud.pig.admin.api.util; import com.pig4cloud.pig.admin.api.dto.MenuTree; import com.pig4cloud.pig.admin.api.dto.TreeNode; diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/LogController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/LogController.java index bffc21af..85588eb8 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/LogController.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/LogController.java @@ -15,8 +15,8 @@ */ package com.pig4cloud.pig.admin.controller; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pig.admin.api.dto.SysLogDTO; import com.pig4cloud.pig.admin.api.entity.SysLog; import com.pig4cloud.pig.admin.service.SysLogService; import com.pig4cloud.pig.common.core.util.R; @@ -51,8 +51,8 @@ public class LogController { * @return */ @GetMapping("/page") - public R getLogPage(Page page, SysLog sysLog) { - return R.ok(sysLogService.page(page, Wrappers.query(sysLog))); + public R getLogPage(Page page, SysLogDTO sysLog) { + return R.ok(sysLogService.getLogByPage(page, sysLog)); } /** diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysLogService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysLogService.java index 08eee0b0..a5aad234 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysLogService.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysLogService.java @@ -16,7 +16,9 @@ package com.pig4cloud.pig.admin.service; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pig.admin.api.dto.SysLogDTO; import com.pig4cloud.pig.admin.api.entity.SysLog; /** @@ -29,4 +31,12 @@ import com.pig4cloud.pig.admin.api.entity.SysLog; */ public interface SysLogService extends IService { + /** + * 分页查询日志 + * @param page + * @param sysLog + * @return + */ + Page getLogByPage(Page page, SysLogDTO sysLog); + } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptServiceImpl.java index 5b4f88de..32ced0d6 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptServiceImpl.java @@ -22,7 +22,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.pig4cloud.pig.admin.api.dto.DeptTree; import com.pig4cloud.pig.admin.api.entity.SysDept; import com.pig4cloud.pig.admin.api.entity.SysDeptRelation; -import com.pig4cloud.pig.admin.api.vo.TreeUtil; +import com.pig4cloud.pig.admin.api.util.TreeUtil; import com.pig4cloud.pig.admin.mapper.SysDeptMapper; import com.pig4cloud.pig.admin.service.SysDeptRelationService; import com.pig4cloud.pig.admin.service.SysDeptService; diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysLogServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysLogServiceImpl.java index afaf6234..7059f5de 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysLogServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysLogServiceImpl.java @@ -16,7 +16,13 @@ package com.pig4cloud.pig.admin.service.impl; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pig.admin.api.dto.SysLogDTO; import com.pig4cloud.pig.admin.api.entity.SysLog; import com.pig4cloud.pig.admin.mapper.SysLogMapper; import com.pig4cloud.pig.admin.service.SysLogService; @@ -33,4 +39,19 @@ import org.springframework.stereotype.Service; @Service public class SysLogServiceImpl extends ServiceImpl implements SysLogService { + @Override + public Page getLogByPage(Page page, SysLogDTO sysLog) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + if (StrUtil.isNotBlank(sysLog.getType())) { + wrapper.eq(SysLog::getType, sysLog.getType()); + } + + if (ArrayUtil.isNotEmpty(sysLog.getCreateTime())) { + wrapper.ge(SysLog::getCreateTime, sysLog.getCreateTime()[0]).le(SysLog::getCreateTime, + sysLog.getCreateTime()[1]); + } + + return baseMapper.selectPage(page, wrapper); + } + } diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java index 84e8c60b..c1c9e87b 100644 --- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java +++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java @@ -22,8 +22,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.pig4cloud.pig.admin.api.dto.MenuTree; import com.pig4cloud.pig.admin.api.entity.SysMenu; import com.pig4cloud.pig.admin.api.entity.SysRoleMenu; +import com.pig4cloud.pig.admin.api.util.TreeUtil; import com.pig4cloud.pig.admin.api.vo.MenuVO; -import com.pig4cloud.pig.admin.api.vo.TreeUtil; import com.pig4cloud.pig.admin.mapper.SysMenuMapper; import com.pig4cloud.pig.admin.mapper.SysRoleMenuMapper; import com.pig4cloud.pig.admin.service.SysMenuService;