From 33161db8c99c0efcb4df887fee4d7d9cff271189 Mon Sep 17 00:00:00 2001 From: zyf972 <1525833171@qq.com> Date: Tue, 25 Feb 2025 00:21:52 +0800 Subject: [PATCH] =?UTF-8?q?feat():=E5=B0=86operLog=E5=92=8Cnotice=E4=BB=A5?= =?UTF-8?q?DDD=E7=9A=84=E5=BD=A2=E5=BC=8F=E8=BF=9B=E9=A1=B9=E7=BC=96?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../muyu/common/system/domain/SysOperLog.java | 17 +-- .../controller/SysNoticeController.java | 26 ++-- .../controller/SysOperlogController.java | 48 +++++-- .../com/muyu/system/domain/SysNotice.java | 54 +++++-- .../domain/model/SysNoticeAddModel.java | 79 +++++++++++ .../domain/model/SysNoticeDetailModel.java | 62 ++++++++ .../domain/model/SysNoticeListModel.java | 65 +++++++++ .../domain/model/SysNoticeUpdModel.java | 72 ++++++++++ .../domain/model/SysOperLogAddModel.java | 132 ++++++++++++++++++ .../system/domain/rep/SysNoticeAddReq.java | 54 +++++++ .../system/domain/rep/SysNoticeUpdReq.java | 46 ++++++ .../system/domain/rep/SysOperLogAddReq.java | 103 ++++++++++++++ .../domain/resp/SysNoticeDetailResp.java | 61 ++++++++ .../system/domain/resp/SysNoticeListResp.java | 46 ++++++ .../domain/resp/SysOperLogDetailResp.java | 103 ++++++++++++++ .../domain/resp/SysOperlogListResp.java | 126 +++++++++++++++++ .../muyu/system/service/SysNoticeService.java | 18 +-- .../system/service/SysOperLogService.java | 8 +- .../service/impl/SysNoticeServiceImpl.java | 43 +++--- .../service/impl/SysOperLogServiceImpl.java | 42 +++++- 20 files changed, 1122 insertions(+), 83 deletions(-) create mode 100644 cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeAddModel.java create mode 100644 cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeDetailModel.java create mode 100644 cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeListModel.java create mode 100644 cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeUpdModel.java create mode 100644 cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysOperLogAddModel.java create mode 100644 cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/rep/SysNoticeAddReq.java create mode 100644 cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/rep/SysNoticeUpdReq.java create mode 100644 cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/rep/SysOperLogAddReq.java create mode 100644 cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysNoticeDetailResp.java create mode 100644 cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysNoticeListResp.java create mode 100644 cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysOperLogDetailResp.java create mode 100644 cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysOperlogListResp.java diff --git a/cloud-common/cloud-common-system/src/main/java/com/muyu/common/system/domain/SysOperLog.java b/cloud-common/cloud-common-system/src/main/java/com/muyu/common/system/domain/SysOperLog.java index b207611..804cff8 100644 --- a/cloud-common/cloud-common-system/src/main/java/com/muyu/common/system/domain/SysOperLog.java +++ b/cloud-common/cloud-common-system/src/main/java/com/muyu/common/system/domain/SysOperLog.java @@ -3,12 +3,7 @@ package com.muyu.common.system.domain; import com.fasterxml.jackson.annotation.JsonFormat; import com.muyu.common.core.annotation.Excel; import com.muyu.common.core.annotation.Excel.ColumnType; -import com.muyu.common.core.web.domain.BaseEntity; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import lombok.experimental.SuperBuilder; +import lombok.*; import java.util.Date; @@ -18,11 +13,10 @@ import java.util.Date; * @author muyu */ @Data -@SuperBuilder +@Builder @NoArgsConstructor @AllArgsConstructor -@EqualsAndHashCode(callSuper = true) -public class SysOperLog extends BaseEntity { +public class SysOperLog { private static final long serialVersionUID = 1L; /** @@ -43,11 +37,6 @@ public class SysOperLog extends BaseEntity { @Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据") private Integer businessType; - /** - * 业务类型数组 - */ - private Integer[] businessTypes; - /** * 请求方法 */ diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/controller/SysNoticeController.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/controller/SysNoticeController.java index d61a49b..485ee89 100644 --- a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/controller/SysNoticeController.java +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/controller/SysNoticeController.java @@ -9,8 +9,11 @@ import com.muyu.common.log.enums.BusinessType; import com.muyu.common.security.annotation.RequiresPermissions; import com.muyu.common.security.utils.SecurityUtils; import com.muyu.system.domain.SysNotice; -import com.muyu.system.domain.model.SysNoticePageQueryModel; +import com.muyu.system.domain.model.*; +import com.muyu.system.domain.rep.SysNoticeAddReq; import com.muyu.system.domain.rep.SysNoticeListReq; +import com.muyu.system.domain.rep.SysNoticeUpdReq; +import com.muyu.system.domain.resp.SysNoticeDetailResp; import com.muyu.system.service.SysNoticeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; @@ -34,8 +37,8 @@ public class SysNoticeController extends BaseController { */ @RequiresPermissions("system:notice:list") @PostMapping("/list") - public Result> list (@RequestBody SysNoticeListReq sysNoticeListReq) { - PageQueryModel sysNoticePageQueryModel = noticeService.pageQuery(SysNoticePageQueryModel.reqBuild(sysNoticeListReq)); + public Result> list (@RequestBody SysNoticeListReq sysNoticeListReq) { + PageQueryModel sysNoticePageQueryModel = noticeService.pageQuery(SysNoticePageQueryModel.reqBuild(sysNoticeListReq)); return Result.success( DataPageResp.of(sysNoticePageQueryModel) ); @@ -46,8 +49,9 @@ public class SysNoticeController extends BaseController { */ @RequiresPermissions("system:notice:query") @GetMapping(value = "/{noticeId}") - public Result getInfo (@PathVariable("noticeId") Long noticeId) { - return success(noticeService.selectNoticeById(noticeId)); + public Result getInfo (@PathVariable("noticeId") Long noticeId) { + SysNoticeDetailModel sysNoticeDetailModel = noticeService.selectNoticeById(noticeId); + return Result.success(SysNoticeDetailResp.detailModelBuildToResp(sysNoticeDetailModel)); } /** @@ -56,9 +60,8 @@ public class SysNoticeController extends BaseController { @RequiresPermissions("system:notice:add") @Log(title = "通知公告", businessType = BusinessType.INSERT) @PostMapping - public Result add (@Validated @RequestBody SysNotice notice) { - notice.setCreateBy(SecurityUtils.getUsername()); - noticeService.insertNotice(notice); + public Result add (@Validated @RequestBody SysNoticeAddReq sysNoticeAddReq) { + noticeService.insertNotice(SysNoticeAddModel.addReqBuildToModel(sysNoticeAddReq,SecurityUtils::getUsername)); return Result.success(); } @@ -67,10 +70,9 @@ public class SysNoticeController extends BaseController { */ @RequiresPermissions("system:notice:edit") @Log(title = "通知公告", businessType = BusinessType.UPDATE) - @PutMapping - public Result edit (@Validated @RequestBody SysNotice notice) { - notice.setUpdateBy(SecurityUtils.getUsername()); - noticeService.updateNotice(notice); + @PutMapping("/{id}") + public Result edit (@PathVariable("id") Long id,@Validated @RequestBody SysNoticeUpdReq sysNoticeUpdReq) { + noticeService.updateNotice(id, SysNoticeUpdModel.updReqBuildToModel(sysNoticeUpdReq,SecurityUtils::getUsername)); return Result.success(); } diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/controller/SysOperlogController.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/controller/SysOperlogController.java index bf825c0..f0ea12d 100644 --- a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/controller/SysOperlogController.java +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/controller/SysOperlogController.java @@ -9,10 +9,13 @@ import com.muyu.common.log.annotation.Log; import com.muyu.common.log.enums.BusinessType; import com.muyu.common.security.annotation.InnerAuth; import com.muyu.common.security.annotation.RequiresPermissions; -import com.muyu.common.system.domain.SysOperLog; +import com.muyu.system.domain.model.SysOperLogAddModel; import com.muyu.system.domain.model.SysOperlogPageQueryModel; +import com.muyu.system.domain.rep.SysOperLogAddReq; import com.muyu.system.domain.rep.SysOperlogListReq; +import com.muyu.system.domain.resp.SysOperlogListResp; import com.muyu.system.service.SysOperLogService; +import io.jsonwebtoken.lang.Arrays; import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -27,30 +30,51 @@ import java.util.List; @RestController @RequestMapping("/operlog") public class SysOperlogController extends BaseController { + + /** + * 操作日志记录 服务对象 + */ @Autowired private SysOperLogService operLogService; + /** + * 操作日志记录列表 + * + * @param sysOperlogListReq 操作日志记录列表查询请求对象 + * @return 列表数据 + */ @RequiresPermissions("system:operlog:list") @PostMapping("/list") - public Result> list (@RequestBody SysOperlogListReq sysOperlogListReq) { - PageQueryModel sysOperLogPageQueryModel = operLogService.pageQuery( + public Result> list (@RequestBody SysOperlogListReq sysOperlogListReq) { + PageQueryModel sysOperLogPageQueryModel = operLogService.pageQuery( SysOperlogPageQueryModel.reqBuild(sysOperlogListReq) ); return Result.success(DataPageResp.of(sysOperLogPageQueryModel)); } + /** + * 操作日志记录导出 + * + * @param response 响应对象 + * @param sysOperlogListReq 操作日志记录列表查询请求对象 + */ @Log(title = "操作日志", businessType = BusinessType.EXPORT) @RequiresPermissions("system:operlog:export") @PostMapping("/export") public void export (HttpServletResponse response, SysOperlogListReq sysOperlogListReq) { // TODO 导出需要重新编写 - PageQueryModel sysOperLogPageQueryModel = operLogService.pageQuery( + PageQueryModel sysOperLogPageQueryModel = operLogService.pageQuery( SysOperlogPageQueryModel.reqBuild(sysOperlogListReq) ); - ExcelUtil util = new ExcelUtil(SysOperLog.class); + ExcelUtil util = new ExcelUtil<>(SysOperlogListResp.class); util.exportExcel(response, sysOperLogPageQueryModel.getDataList(), "操作日志"); } + /** + * 批量删除操作日志记录 + * + * @param operIds 操作日志记录的id集合 + */ @Log(title = "操作日志", businessType = BusinessType.DELETE) @RequiresPermissions("system:operlog:remove") @DeleteMapping("/{operIds}") @@ -59,7 +83,10 @@ public class SysOperlogController extends BaseController { return Result.success(); } - @RequiresPermissions("system:operlog:remove") + /** + * 清空操作日志记录 + */ + @RequiresPermissions("system:operlog:clean") @Log(title = "操作日志", businessType = BusinessType.CLEAN) @DeleteMapping("/clean") public Result clean () { @@ -67,10 +94,15 @@ public class SysOperlogController extends BaseController { return success(); } + /** + * 新增操作日志记录 + * + * @param operLogAddReq 操作日志记录新增请求对象 + */ @InnerAuth @PostMapping - public Result add (@RequestBody SysOperLog operLog) { - operLogService.insertOperlog(operLog); + public Result add (@RequestBody SysOperLogAddReq operLogAddReq) { + operLogService.insertOperlog(SysOperLogAddModel.addReqBuildToModel(operLogAddReq)); return Result.success(); } } diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/SysNotice.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/SysNotice.java index 9774297..3fa0206 100644 --- a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/SysNotice.java +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/SysNotice.java @@ -4,9 +4,9 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.muyu.common.core.web.domain.BaseEntity; -import com.muyu.common.core.xss.Xss; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Size; +import com.muyu.system.domain.model.SysNoticeAddModel; +import com.muyu.system.domain.model.SysNoticeDetailModel; +import com.muyu.system.domain.model.SysNoticeUpdModel; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; @@ -53,10 +53,48 @@ public class SysNotice extends BaseEntity { */ private String status; - @Xss(message = "公告标题不能包含脚本字符") - @NotBlank(message = "公告标题不能为空") - @Size(min = 0, max = 50, message = "公告标题不能超过50个字符") - public String getNoticeTitle () { - return noticeTitle; + /** + * 范围scope + */ + private String scope; + + + /** + * 将通知公告添加模型构建成原生实体类 + * + * @param sysNoticeAddModel 通知公告添加模型 + * @return 原生实体类 + */ + public static SysNotice addModelBuildToInfo(SysNoticeAddModel sysNoticeAddModel){ + return SysNotice.builder() + .noticeId(sysNoticeAddModel.getNoticeId()) + .noticeTitle(sysNoticeAddModel.getNoticeTitle()) + .noticeType(sysNoticeAddModel.getNoticeType()) + .noticeContent(sysNoticeAddModel.getNoticeContent()) + .status(sysNoticeAddModel.getStatus()) + .scope(sysNoticeAddModel.getScope()) + .createBy(sysNoticeAddModel.getCreateBy()) + .createTime(sysNoticeAddModel.getCreateTime()) + .build(); + } + + + /** + * 将通知公告更新模型构建成原生实体类 + * + * @param id 通知公告ID + * @param sysNoticeUpdModel 通知公告更新模型 + * @return 原生实体类 + */ + public static SysNotice updReqBuildToInfo(Long id, SysNoticeUpdModel sysNoticeUpdModel){ + return SysNotice.builder() + .noticeId(id) + .noticeTitle(sysNoticeUpdModel.getNoticeTitle()) + .noticeType(sysNoticeUpdModel.getNoticeType()) + .noticeContent(sysNoticeUpdModel.getNoticeContent()) + .status(sysNoticeUpdModel.getStatus()) + .updateBy(sysNoticeUpdModel.getUpdateBy()) + .updateTime(sysNoticeUpdModel.getUpdateTime()) + .build(); } } diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeAddModel.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeAddModel.java new file mode 100644 index 0000000..173b9a2 --- /dev/null +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeAddModel.java @@ -0,0 +1,79 @@ +package com.muyu.system.domain.model; + +import com.muyu.common.core.web.domain.BaseEntity; +import com.muyu.common.core.xss.Xss; +import com.muyu.system.domain.rep.SysNoticeAddReq; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; +import lombok.*; +import lombok.experimental.SuperBuilder; + +import java.util.Date; +import java.util.function.Supplier; + +/** + * 通知公告添加模型 + * + * @author 夜は眠れるかい? + * @Date 2025/2/24 12:25 + */ +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SysNoticeAddModel extends BaseEntity { + + /** + * 公告ID + */ + private Long noticeId; + + /** + * 公告标题 + */ + @Xss(message = "公告标题不能包含脚本字符") + @NotBlank(message = "公告标题不能为空") + @Size(min = 0, max = 50, message = "公告标题不能超过50个字符") + private String noticeTitle; + + /** + * 公告类型(1通知 2公告) + */ + private String noticeType; + + /** + * 公告内容 + */ + private String noticeContent; + + /** + * 公告状态(0正常 1关闭) + */ + private String status; + + /** + * 范围scope + */ + private String scope; + + + /** + * 将通知公告添加请求对象构建成模型 + * + * @param sysNoticeAddReq 通知公告添加请求对象 + * @param creatBy 创建人 + * @return 通知公告添加模型 + */ + public static SysNoticeAddModel addReqBuildToModel(SysNoticeAddReq sysNoticeAddReq, Supplier creatBy) { + return SysNoticeAddModel.builder() + .noticeTitle(sysNoticeAddReq.getNoticeTitle()) + .noticeType(sysNoticeAddReq.getNoticeType()) + .noticeContent(sysNoticeAddReq.getNoticeContent()) + .status(sysNoticeAddReq.getStatus()) + .scope("若依框架") + .createBy(creatBy.get()) + .createTime(new Date()) + .build(); + } +} diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeDetailModel.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeDetailModel.java new file mode 100644 index 0000000..89fc8d0 --- /dev/null +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeDetailModel.java @@ -0,0 +1,62 @@ +package com.muyu.system.domain.model; + +import com.muyu.system.domain.SysNotice; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 通知公告详情模型 + * + * @author 夜は眠れるかい? + * @Date 2025/2/24 19:41 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysNoticeDetailModel { + + /** + * 公告ID + */ + private Long noticeId; + + /** + * 公告标题 + */ + private String noticeTitle; + + /** + * 公告类型(1通知 2公告) + */ + private String noticeType; + + /** + * 公告内容 + */ + private String noticeContent; + + /** + * 公告状态(0正常 1关闭) + */ + private String status; + + + /** + * 将通知公告信息转换为详情模型 + * + * @param sysNotice 通知公告信息 + * @return 详情模型 + */ + public static SysNoticeDetailModel infoBuildToDetailModel(SysNotice sysNotice) { + return SysNoticeDetailModel.builder() + .noticeId(sysNotice.getNoticeId()) + .noticeTitle(sysNotice.getNoticeTitle()) + .noticeType(sysNotice.getNoticeType()) + .noticeContent(sysNotice.getNoticeContent()) + .status(sysNotice.getStatus()) + .build(); + } +} diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeListModel.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeListModel.java new file mode 100644 index 0000000..ce5b59e --- /dev/null +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeListModel.java @@ -0,0 +1,65 @@ +package com.muyu.system.domain.model; + +import com.muyu.common.core.web.domain.BaseEntity; +import com.muyu.system.domain.SysNotice; +import lombok.*; +import lombok.experimental.SuperBuilder; + +/** + * 通知公告列表模型 + * + * @author 夜は眠れるかい? + * @Date 2025/2/24 12:01 + */ +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SysNoticeListModel extends BaseEntity { + + /** + * 公告ID + */ + private Long noticeId; + + /** + * 公告标题 + */ + private String noticeTitle; + + /** + * 公告类型(1通知 2公告) + */ + private String noticeType; + + /** + * 公告内容 + */ + private String noticeContent; + + /** + * 公告状态(0正常 1关闭) + */ + private String status; + + + /** + * 将公告通知原生实体类构建成列表响应对象 + * + * @param sysNotice 公告通知原生实体类 + * @return 列表模型 + */ + public static SysNoticeListModel listInfoBuildToModel(SysNotice sysNotice){ + return SysNoticeListModel.builder() + .noticeId(sysNotice.getNoticeId()) + .noticeTitle(sysNotice.getNoticeTitle()) + .noticeType(sysNotice.getNoticeType()) + .noticeContent(sysNotice.getNoticeContent()) + .status(sysNotice.getStatus()) + .createBy(sysNotice.getCreateBy()) + .createTime(sysNotice.getCreateTime()) + .remark(sysNotice.getRemark()) + .build(); + } +} diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeUpdModel.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeUpdModel.java new file mode 100644 index 0000000..c7e832d --- /dev/null +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysNoticeUpdModel.java @@ -0,0 +1,72 @@ +package com.muyu.system.domain.model; + +import com.muyu.common.core.web.domain.BaseEntity; +import com.muyu.common.core.xss.Xss; +import com.muyu.system.domain.rep.SysNoticeUpdReq; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import java.util.Date; +import java.util.function.Supplier; + +/** + * 通知公告修改模型 + * + * @author 夜は眠れるかい? + * @Date 2025/2/24 15:58 + */ +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SysNoticeUpdModel extends BaseEntity { + + /** + * 公告标题 + */ + @Xss(message = "公告标题不能包含脚本字符") + @NotBlank(message = "公告标题不能为空") + @Size(min = 0, max = 50, message = "公告标题不能超过50个字符") + private String noticeTitle; + + /** + * 公告类型(1通知 2公告) + */ + private String noticeType; + + /** + * 公告内容 + */ + private String noticeContent; + + /** + * 公告状态(0正常 1关闭) + */ + private String status; + + + /** + * 将通知公告修改请求对象构建成通知公告修改模型 + * + * @param sysNoticeUpdReq 通知公告修改请求对象 + * @param updateBy 通知公告修改模型 + * @return 通知公告修改模型 + */ + public static SysNoticeUpdModel updReqBuildToModel(SysNoticeUpdReq sysNoticeUpdReq, Supplier updateBy){ + return SysNoticeUpdModel.builder() + .noticeTitle(sysNoticeUpdReq.getNoticeTitle()) + .noticeType(sysNoticeUpdReq.getNoticeType()) + .noticeContent(sysNoticeUpdReq.getNoticeContent()) + .status(sysNoticeUpdReq.getStatus()) + .remark(sysNoticeUpdReq.getRemark()) + .updateBy(updateBy.get()) + .updateTime(new Date()) + .build(); + } +} diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysOperLogAddModel.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysOperLogAddModel.java new file mode 100644 index 0000000..fa531a6 --- /dev/null +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/model/SysOperLogAddModel.java @@ -0,0 +1,132 @@ +package com.muyu.system.domain.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.muyu.system.domain.rep.SysOperLogAddReq; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * 操作日志记录添加模型 + * + * @author 夜は眠れるかい? + * @Date 2025/2/23 22:21 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysOperLogAddModel { + + /** + * 日志主键 + */ + private Long operId; + + /** + * 操作模块 + */ + private String title; + + /** + * 业务类型(0其它 1新增 2修改 3删除) + */ + private Integer businessType; + + /** + * 请求方法 + */ + private String method; + + /** + * 请求方式 + */ + private String requestMethod; + + /** + * 操作类别(0其它 1后台用户 2手机端用户) + */ + private Integer operatorType; + + /** + * 操作人员 + */ + private String operName; + + /** + * 部门名称 + */ + private String deptName; + + /** + * 请求url + */ + private String operUrl; + + /** + * 操作地址 + */ + private String operIp; + + /** + * 请求参数 + */ + private String operParam; + + /** + * 返回参数 + */ + private String jsonResult; + + /** + * 操作状态(0正常 1异常) + */ + private Integer status; + + /** + * 错误消息 + */ + private String errorMsg; + + /** + * 操作时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date operTime; + + /** + * 消耗时间 + */ + private Long costTime; + + + /** + * 将操作日志记录添加请求对象构建成操作日志记录添加模型 + * + * @param sysOperLogAddReq 操作日志记录添加请求对象 + * @return 操作日志记录添加模型 + */ + public static SysOperLogAddModel addReqBuildToModel(SysOperLogAddReq sysOperLogAddReq){ + return SysOperLogAddModel.builder() + .operId(sysOperLogAddReq.getOperId()) + .title(sysOperLogAddReq.getTitle()) + .businessType(sysOperLogAddReq.getBusinessType()) + .method(sysOperLogAddReq.getMethod()) + .requestMethod(sysOperLogAddReq.getRequestMethod()) + .operatorType(sysOperLogAddReq.getOperatorType()) + .operName(sysOperLogAddReq.getOperName()) + .deptName(sysOperLogAddReq.getDeptName()) + .operUrl(sysOperLogAddReq.getOperUrl()) + .operIp(sysOperLogAddReq.getOperIp()) + .operParam(sysOperLogAddReq.getOperParam()) + .jsonResult(sysOperLogAddReq.getJsonResult()) + .status(sysOperLogAddReq.getStatus()) + .errorMsg(sysOperLogAddReq.getErrorMsg()) + .operTime(new Date()) + .costTime(sysOperLogAddReq.getCostTime()) + .build(); + } +} diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/rep/SysNoticeAddReq.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/rep/SysNoticeAddReq.java new file mode 100644 index 0000000..a2dce8b --- /dev/null +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/rep/SysNoticeAddReq.java @@ -0,0 +1,54 @@ +package com.muyu.system.domain.rep; + +import com.muyu.common.core.web.domain.BaseEntity; +import com.muyu.common.core.xss.Xss; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; +import lombok.*; +import lombok.experimental.SuperBuilder; + +/** + * 通知公告新增请求对象 + * + * @author 夜は眠れるかい? + * @Date 2025/2/24 12:22 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SysNoticeAddReq extends BaseEntity { + + /** + * 公告ID + */ + private Long noticeId; + + /** + * 公告标题 + */ + @Xss(message = "公告标题不能包含脚本字符") + @NotBlank(message = "公告标题不能为空") + @Size(min = 0, max = 50, message = "公告标题不能超过50个字符") + private String noticeTitle; + + /** + * 公告类型(1通知 2公告) + */ + private String noticeType; + + /** + * 公告内容 + */ + private String noticeContent; + + /** + * 公告状态(0正常 1关闭) + */ + private String status; + + /** + * 范围scope + */ + private String scope; +} diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/rep/SysNoticeUpdReq.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/rep/SysNoticeUpdReq.java new file mode 100644 index 0000000..cc08095 --- /dev/null +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/rep/SysNoticeUpdReq.java @@ -0,0 +1,46 @@ +package com.muyu.system.domain.rep; + +import com.muyu.common.core.web.domain.BaseEntity; +import com.muyu.common.core.xss.Xss; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; + +/** + * 通知公告修改请求对象 + * + * @author 夜は眠れるかい? + * @Date 2025/2/24 15:57 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SysNoticeUpdReq extends BaseEntity { + + /** + * 公告标题 + */ + @Xss(message = "公告标题不能包含脚本字符") + @NotBlank(message = "公告标题不能为空") + @Size(min = 0, max = 50, message = "公告标题不能超过50个字符") + private String noticeTitle; + + /** + * 公告类型(1通知 2公告) + */ + private String noticeType; + + /** + * 公告内容 + */ + private String noticeContent; + + /** + * 公告状态(0正常 1关闭) + */ + private String status; +} diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/rep/SysOperLogAddReq.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/rep/SysOperLogAddReq.java new file mode 100644 index 0000000..86ba149 --- /dev/null +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/rep/SysOperLogAddReq.java @@ -0,0 +1,103 @@ +package com.muyu.system.domain.rep; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * 操作日志添加请求对象 + * + * @author 夜は眠れるかい? + * @Date 2025/2/23 22:10 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysOperLogAddReq { + + /** + * 日志主键 + */ + private Long operId; + + /** + * 操作模块 + */ + private String title; + + /** + * 业务类型(0其它 1新增 2修改 3删除) + */ + private Integer businessType; + + /** + * 请求方法 + */ + private String method; + + /** + * 请求方式 + */ + private String requestMethod; + + /** + * 操作类别(0其它 1后台用户 2手机端用户) + */ + private Integer operatorType; + + /** + * 操作人员 + */ + private String operName; + + /** + * 部门名称 + */ + private String deptName; + + /** + * 请求url + */ + private String operUrl; + + /** + * 操作地址 + */ + private String operIp; + + /** + * 请求参数 + */ + private String operParam; + + /** + * 返回参数 + */ + private String jsonResult; + + /** + * 操作状态(0正常 1异常) + */ + private Integer status; + + /** + * 错误消息 + */ + private String errorMsg; + + /** + * 操作时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date operTime; + + /** + * 消耗时间 + */ + private Long costTime; +} diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysNoticeDetailResp.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysNoticeDetailResp.java new file mode 100644 index 0000000..19f743b --- /dev/null +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysNoticeDetailResp.java @@ -0,0 +1,61 @@ +package com.muyu.system.domain.resp; + +import com.muyu.system.domain.model.SysNoticeDetailModel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 通知公告详情响应对象 + * + * @author 夜は眠れるかい? + * @Date 2025/2/24 19:37 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysNoticeDetailResp { + + /** + * 公告ID + */ + private Long noticeId; + + /** + * 公告标题 + */ + private String noticeTitle; + + /** + * 公告类型(1通知 2公告) + */ + private String noticeType; + + /** + * 公告内容 + */ + private String noticeContent; + + /** + * 公告状态(0正常 1关闭) + */ + private String status; + + + /** + * 详情模型构建响应对象 + * @param sysNoticeDetailModel 详情模型 + * @return 详情响应对象 + */ + public static SysNoticeDetailResp detailModelBuildToResp(SysNoticeDetailModel sysNoticeDetailModel){ + return SysNoticeDetailResp.builder() + .noticeId(sysNoticeDetailModel.getNoticeId()) + .noticeTitle(sysNoticeDetailModel.getNoticeTitle()) + .noticeType(sysNoticeDetailModel.getNoticeType()) + .noticeContent(sysNoticeDetailModel.getNoticeContent()) + .status(sysNoticeDetailModel.getStatus()) + .build(); + } +} diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysNoticeListResp.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysNoticeListResp.java new file mode 100644 index 0000000..471c264 --- /dev/null +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysNoticeListResp.java @@ -0,0 +1,46 @@ +package com.muyu.system.domain.resp; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.muyu.common.core.web.domain.BaseEntity; +import lombok.*; +import lombok.experimental.SuperBuilder; + +/** + * 通知公告列表响应对象 + * + * @author 夜は眠れるかい? + * @Date 2025/2/24 11:58 + */ +@Data +@SuperBuilder +@NoArgsConstructor +@AllArgsConstructor +@EqualsAndHashCode(callSuper = true) +public class SysNoticeListResp extends BaseEntity { + + /** + * 公告ID + */ + private Long noticeId; + + /** + * 公告标题 + */ + private String noticeTitle; + + /** + * 公告类型(1通知 2公告) + */ + private String noticeType; + + /** + * 公告内容 + */ + private String noticeContent; + + /** + * 公告状态(0正常 1关闭) + */ + private String status; +} diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysOperLogDetailResp.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysOperLogDetailResp.java new file mode 100644 index 0000000..101a3b9 --- /dev/null +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysOperLogDetailResp.java @@ -0,0 +1,103 @@ +package com.muyu.system.domain.resp; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * 操作日志记录详情响应对象 + * + * @author 夜は眠れるかい? + * @Date 2025/2/23 22:34 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysOperLogDetailResp { + + /** + * 日志主键 + */ + private Long operId; + + /** + * 操作模块 + */ + private String title; + + /** + * 业务类型(0其它 1新增 2修改 3删除) + */ + private Integer businessType; + + /** + * 请求方法 + */ + private String method; + + /** + * 请求方式 + */ + private String requestMethod; + + /** + * 操作类别(0其它 1后台用户 2手机端用户) + */ + private Integer operatorType; + + /** + * 操作人员 + */ + private String operName; + + /** + * 部门名称 + */ + private String deptName; + + /** + * 请求url + */ + private String operUrl; + + /** + * 操作地址 + */ + private String operIp; + + /** + * 请求参数 + */ + private String operParam; + + /** + * 返回参数 + */ + private String jsonResult; + + /** + * 操作状态(0正常 1异常) + */ + private Integer status; + + /** + * 错误消息 + */ + private String errorMsg; + + /** + * 操作时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date operTime; + + /** + * 消耗时间 + */ + private Long costTime; +} diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysOperlogListResp.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysOperlogListResp.java new file mode 100644 index 0000000..a5bcaa3 --- /dev/null +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/domain/resp/SysOperlogListResp.java @@ -0,0 +1,126 @@ +package com.muyu.system.domain.resp; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.muyu.common.system.domain.SysOperLog; +import lombok.*; + +import java.util.Date; + +/** + * 操作日志记录列表响应对象 + * + * @author 夜は眠れるかい? + * @Date 2025/2/23 19:57 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class SysOperlogListResp { + + /** + * 日志主键 + */ + private Long operId; + + /** + * 操作模块 + */ + private String title; + + /** + * 业务类型(0其它 1新增 2修改 3删除) + */ + private Integer businessType; + + /** + * 请求方法 + */ + private String method; + + /** + * 请求方式 + */ + private String requestMethod; + + /** + * 操作类别(0其它 1后台用户 2手机端用户) + */ + private Integer operatorType; + + /** + * 操作人员 + */ + private String operName; + + /** + * 部门名称 + */ + private String deptName; + + /** + * 请求url + */ + private String operUrl; + + /** + * 操作地址 + */ + private String operIp; + + /** + * 请求参数 + */ + private String operParam; + + /** + * 返回参数 + */ + private String jsonResult; + + /** + * 操作状态(0正常 1异常) + */ + private Integer status; + + /** + * 错误消息 + */ + private String errorMsg; + + /** + * 操作时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date operTime; + + /** + * 消耗时间 + */ + private Long costTime; + + + /** + * 将操作日志记录原生实体类构建成列表响应对象 + */ + public static SysOperlogListResp infoBuildToResp(SysOperLog sysOperLog){ + return SysOperlogListResp.builder() + .operId(sysOperLog.getOperId()) + .title(sysOperLog.getTitle()) + .businessType(sysOperLog.getBusinessType()) + .method(sysOperLog.getMethod()) + .requestMethod(sysOperLog.getRequestMethod()) + .operatorType(sysOperLog.getOperatorType()) + .operName(sysOperLog.getOperName()) + .deptName(sysOperLog.getDeptName()) + .operUrl(sysOperLog.getOperUrl()) + .operIp(sysOperLog.getOperIp()) + .operParam(sysOperLog.getOperParam()) + .jsonResult(sysOperLog.getJsonResult()) + .status(sysOperLog.getStatus()) + .errorMsg(sysOperLog.getErrorMsg()) + .operTime(sysOperLog.getOperTime()) + .costTime(sysOperLog.getCostTime()) + .build(); + } +} diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/SysNoticeService.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/SysNoticeService.java index 3703d63..b2272f6 100644 --- a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/SysNoticeService.java +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/SysNoticeService.java @@ -3,7 +3,8 @@ package com.muyu.system.service; import com.baomidou.mybatisplus.extension.service.IService; import com.muyu.common.core.web.page.PageQueryModel; import com.muyu.system.domain.SysNotice; -import com.muyu.system.domain.model.SysNoticePageQueryModel; +import com.muyu.system.domain.model.*; +import com.muyu.system.domain.rep.SysNoticeUpdReq; import java.util.List; @@ -20,7 +21,7 @@ public interface SysNoticeService extends IService { * @param sysNoticePageQueryModel 分页查询模型 * @return 分页结果 */ - PageQueryModel pageQuery(SysNoticePageQueryModel sysNoticePageQueryModel); + PageQueryModel pageQuery(SysNoticePageQueryModel sysNoticePageQueryModel); /** * 查询公告信息 @@ -29,25 +30,24 @@ public interface SysNoticeService extends IService { * * @return 公告信息 */ - public SysNotice selectNoticeById (Long noticeId); + public SysNoticeDetailModel selectNoticeById (Long noticeId); /** * 新增公告 * - * @param notice 公告信息 + * @param sysNoticeAddModel 通知公告添加模型 * * @return 结果 */ - public void insertNotice (SysNotice notice); + public void insertNotice (SysNoticeAddModel sysNoticeAddModel); /** * 修改公告 * - * @param notice 公告信息 - * - * @return 结果 + * @param sysNoticeUpdModel 公告信息修改模型 + * @param id 通知公告id */ - public void updateNotice (SysNotice notice); + public void updateNotice (Long id, SysNoticeUpdModel sysNoticeUpdModel); /** * 删除公告信息 diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/SysOperLogService.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/SysOperLogService.java index 7916497..23c820e 100644 --- a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/SysOperLogService.java +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/SysOperLogService.java @@ -3,7 +3,9 @@ package com.muyu.system.service; import com.baomidou.mybatisplus.extension.service.IService; import com.muyu.common.core.web.page.PageQueryModel; import com.muyu.common.system.domain.SysOperLog; +import com.muyu.system.domain.model.SysOperLogAddModel; import com.muyu.system.domain.model.SysOperlogPageQueryModel; +import com.muyu.system.domain.resp.SysOperlogListResp; import java.util.List; @@ -16,18 +18,18 @@ public interface SysOperLogService extends IService { /** * 新增操作日志 * - * @param operLog 操作日志对象 + * @param sysOperLogAddModel 操作日志对象 * * @return 结果 */ - public void insertOperlog (SysOperLog operLog); + public void insertOperlog (SysOperLogAddModel sysOperLogAddModel); /** * 操作日志 分页查询 * @param sysOperlogPageQueryModel 分页模型查询 * @return 分页结果 */ - PageQueryModel pageQuery(SysOperlogPageQueryModel sysOperlogPageQueryModel); + PageQueryModel pageQuery(SysOperlogPageQueryModel sysOperlogPageQueryModel); /** * 批量删除系统操作日志 diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/impl/SysNoticeServiceImpl.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/impl/SysNoticeServiceImpl.java index 10dcbca..8b78c29 100644 --- a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/impl/SysNoticeServiceImpl.java +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/impl/SysNoticeServiceImpl.java @@ -6,7 +6,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.muyu.common.core.utils.StringUtils; import com.muyu.common.core.web.page.PageQueryModel; import com.muyu.system.domain.SysNotice; -import com.muyu.system.domain.model.SysNoticePageQueryModel; +import com.muyu.system.domain.model.*; +import com.muyu.system.domain.rep.SysNoticeUpdReq; import com.muyu.system.mapper.SysNoticeMapper; import com.muyu.system.service.SysNoticeService; import org.springframework.beans.factory.annotation.Autowired; @@ -21,9 +22,6 @@ import java.util.List; */ @Service public class SysNoticeServiceImpl extends ServiceImpl implements SysNoticeService { - @Autowired - private SysNoticeMapper noticeMapper; - /** * 通知公告份也查询 @@ -31,13 +29,20 @@ public class SysNoticeServiceImpl extends ServiceImpl pageQuery(SysNoticePageQueryModel sysNoticePageQueryModel) { + public PageQueryModel pageQuery(SysNoticePageQueryModel sysNoticePageQueryModel) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.like(StringUtils.isNotEmpty(sysNoticePageQueryModel.getNoticeTitle()),SysNotice::getNoticeTitle, sysNoticePageQueryModel.getNoticeTitle()); queryWrapper.eq(StringUtils.isNotEmpty(sysNoticePageQueryModel.getNoticeType()),SysNotice::getNoticeType, sysNoticePageQueryModel.getNoticeType()); queryWrapper.like(StringUtils.isNotEmpty(sysNoticePageQueryModel.getCreateBy()),SysNotice::getCreateBy, sysNoticePageQueryModel.getCreateBy()); Page page = this.page(sysNoticePageQueryModel.buildPage(), queryWrapper); - return PageQueryModel.of(page); + List noticeListModels = page.getRecords().stream() + .map(SysNoticeListModel::listInfoBuildToModel) + .toList(); + Page modelPage = new Page<>(page.getCurrent(), page.getSize()); + modelPage.setRecords(noticeListModels); + modelPage.setTotal(page.getTotal()); + modelPage.setOrders(page.orders()); + return PageQueryModel.of(modelPage); } /** @@ -48,40 +53,36 @@ public class SysNoticeServiceImpl extends ServiceImpl noticeIds) { diff --git a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/impl/SysOperLogServiceImpl.java b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/impl/SysOperLogServiceImpl.java index dc9258c..2ebd899 100644 --- a/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/impl/SysOperLogServiceImpl.java +++ b/cloud-modules/cloud-modules-system/src/main/java/com/muyu/system/service/impl/SysOperLogServiceImpl.java @@ -6,12 +6,16 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.muyu.common.core.utils.StringUtils; import com.muyu.common.core.web.page.PageQueryModel; import com.muyu.common.system.domain.SysOperLog; +import com.muyu.system.domain.model.SysOperLogAddModel; import com.muyu.system.domain.model.SysOperlogPageQueryModel; +import com.muyu.system.domain.resp.SysOperlogListResp; import com.muyu.system.mapper.SysOperLogMapper; import com.muyu.system.service.SysOperLogService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Objects; @@ -28,13 +32,30 @@ public class SysOperLogServiceImpl extends ServiceImpl pageQuery(SysOperlogPageQueryModel sysOperlogPageQueryModel) { + public PageQueryModel pageQuery(SysOperlogPageQueryModel sysOperlogPageQueryModel) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.like(StringUtils.isNotEmpty(sysOperlogPageQueryModel.getOperIp()),SysOperLog::getOperIp, sysOperlogPageQueryModel.getOperIp()); queryWrapper.like(StringUtils.isNotEmpty(sysOperlogPageQueryModel.getTitle()),SysOperLog::getTitle, sysOperlogPageQueryModel.getTitle()); @@ -54,7 +75,14 @@ public class SysOperLogServiceImpl extends ServiceImpl page = this.page(sysOperlogPageQueryModel.buildPage(), queryWrapper); - return PageQueryModel.of(page); + List sysOperlogListResp = page.getRecords().stream() + .map(SysOperlogListResp::infoBuildToResp) + .toList(); + Page respPage = new Page<>(page.getCurrent(),page.getSize()); + respPage.setRecords(sysOperlogListResp); + respPage.setTotal(page.getTotal()); + respPage.setOrders(page.orders()); + return PageQueryModel.of(respPage); } /**