From 2e92773b8ce9e70615e61c84136bbedd702aad8c Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期五, 31 三月 2023 10:19:28 +0800
Subject: [PATCH] update 优化 角色 sort 值一样的排序问题

---
 ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java
index 2d89d77..abbedae 100644
--- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java
+++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysOperLogServiceImpl.java
@@ -1,15 +1,17 @@
 package com.ruoyi.system.service.impl;
 
-import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ArrayUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.core.utils.MapstructUtils;
 import com.ruoyi.common.mybatis.core.page.PageQuery;
 import com.ruoyi.common.mybatis.core.page.TableDataInfo;
 import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.utils.ip.AddressUtils;
 import com.ruoyi.common.log.event.OperLogEvent;
 import com.ruoyi.system.domain.SysOperLog;
+import com.ruoyi.system.domain.bo.SysOperLogBo;
+import com.ruoyi.system.domain.vo.SysOperLogVo;
 import com.ruoyi.system.mapper.SysOperLogMapper;
 import com.ruoyi.system.service.ISysOperLogService;
 import lombok.RequiredArgsConstructor;
@@ -41,14 +43,14 @@
     @Async
     @EventListener
     public void recordOper(OperLogEvent operLogEvent) {
-        SysOperLog operLog = BeanUtil.toBean(operLogEvent, SysOperLog.class);
+        SysOperLogBo operLog = MapstructUtils.convert(operLogEvent, SysOperLogBo.class);
         // 杩滅▼鏌ヨ鎿嶄綔鍦扮偣
         operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp()));
         insertOperlog(operLog);
     }
 
     @Override
-    public TableDataInfo<SysOperLog> selectPageOperLogList(SysOperLog operLog, PageQuery pageQuery) {
+    public TableDataInfo<SysOperLogVo> selectPageOperLogList(SysOperLogBo operLog, PageQuery pageQuery) {
         Map<String, Object> params = operLog.getParams();
         LambdaQueryWrapper<SysOperLog> lqw = new LambdaQueryWrapper<SysOperLog>()
             .like(StringUtils.isNotBlank(operLog.getTitle()), SysOperLog::getTitle, operLog.getTitle())
@@ -68,17 +70,18 @@
             pageQuery.setOrderByColumn("oper_id");
             pageQuery.setIsAsc("desc");
         }
-        Page<SysOperLog> page = baseMapper.selectPage(pageQuery.build(), lqw);
+        Page<SysOperLogVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
         return TableDataInfo.build(page);
     }
 
     /**
      * 鏂板鎿嶄綔鏃ュ織
      *
-     * @param operLog 鎿嶄綔鏃ュ織瀵硅薄
+     * @param bo 鎿嶄綔鏃ュ織瀵硅薄
      */
     @Override
-    public void insertOperlog(SysOperLog operLog) {
+    public void insertOperlog(SysOperLogBo bo) {
+        SysOperLog operLog = MapstructUtils.convert(bo, SysOperLog.class);
         operLog.setOperTime(new Date());
         baseMapper.insert(operLog);
     }
@@ -90,9 +93,9 @@
      * @return 鎿嶄綔鏃ュ織闆嗗悎
      */
     @Override
-    public List<SysOperLog> selectOperLogList(SysOperLog operLog) {
+    public List<SysOperLogVo> selectOperLogList(SysOperLogBo operLog) {
         Map<String, Object> params = operLog.getParams();
-        return baseMapper.selectList(new LambdaQueryWrapper<SysOperLog>()
+        return baseMapper.selectVoList(new LambdaQueryWrapper<SysOperLog>()
             .like(StringUtils.isNotBlank(operLog.getTitle()), SysOperLog::getTitle, operLog.getTitle())
             .eq(operLog.getBusinessType() != null && operLog.getBusinessType() > 0,
                 SysOperLog::getBusinessType, operLog.getBusinessType())
@@ -127,8 +130,8 @@
      * @return 鎿嶄綔鏃ュ織瀵硅薄
      */
     @Override
-    public SysOperLog selectOperLogById(Long operId) {
-        return baseMapper.selectById(operId);
+    public SysOperLogVo selectOperLogById(Long operId) {
+        return baseMapper.selectVoById(operId);
     }
 
     /**

--
Gitblit v1.9.3