Browse Source

refactor:优化时间范围查询

YunaiV 2 years ago
parent
commit
26a094a710

+ 1 - 1
README.md

@@ -160,7 +160,7 @@ ps:核心功能已经实现,正在对接微信小程序中...
 |---------------------------------------------------------------------------------------------|-----------------------|-----------|----------------------------------------------------------------|
 | [Spring Boot](https://spring.io/projects/spring-boot)                                       | 应用开发框架             | 2.6.9    | [文档](https://github.com/YunaiV/SpringBoot-Labs)                |
 | [MySQL](https://www.mysql.com/cn/)                                                          | 数据库服务器             | 5.7      |                                                                |
-| [Druid](https://github.com/alibaba/druid)                                                   | JDBC 连接池、监控组件     | 1.2.8    | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) |
+| [Druid](https://github.com/alibaba/druid)                                                   | JDBC 连接池、监控组件     | 1.2.11    | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) |
 | [MyBatis Plus](https://mp.baomidou.com/)                                                    | MyBatis 增强工具包       | 3.5.2    | [文档](http://www.iocoder.cn/Spring-Boot/MyBatis/?yudao)         |
 | [Dynamic Datasource](https://dynamic-datasource.com/)                                       | 动态数据源               | 3.5.0    | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) |
 | [Redis](https://redis.io/)                                                                  | key-value 数据库        | 5.0      |                                                                |

+ 7 - 6
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/ArrayUtils.java

@@ -2,14 +2,8 @@ package cn.iocoder.yudao.framework.common.util.collection;
 
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ArrayUtil;
-import cn.hutool.core.util.TypeUtil;
-import org.springframework.cglib.core.TypeUtils;
 
-import java.lang.reflect.Array;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
 import java.util.Collection;
-import java.util.List;
 import java.util.function.Consumer;
 import java.util.function.Function;
 
@@ -53,4 +47,11 @@ public class ArrayUtils {
         return ArrayUtil.toArray(from, (Class<T>) CollectionUtil.getElementType(from.iterator()));
     }
 
+    public static <T> T get(T[] array, int index) {
+        if (null == array || index >= array.length) {
+            return null;
+        }
+        return array[index];
+    }
+
 }

+ 4 - 0
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/JsonUtils.java

@@ -51,6 +51,10 @@ public class JsonUtils {
         return objectMapper.writeValueAsBytes(object);
     }
 
+    @SneakyThrows
+    public static String toJsonPrettyString(Object object) {
+        return objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(object);
+    }
 
     public static <T> T parseObject(String text, Class<T> clazz) {
         if (StrUtil.isEmpty(text)) {

+ 6 - 13
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/LambdaQueryWrapperX.java

@@ -1,8 +1,8 @@
 package cn.iocoder.yudao.framework.mybatis.core.query;
 
+import cn.hutool.core.util.ArrayUtil;
+import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.ArrayUtils;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
 import org.springframework.util.StringUtils;
@@ -33,7 +33,7 @@ public class LambdaQueryWrapperX<T> extends LambdaQueryWrapper<T> {
     }
 
     public LambdaQueryWrapperX<T> inIfPresent(SFunction<T, ?> column, Object... values) {
-        if (!ArrayUtils.isEmpty(values)) {
+        if (!ArrayUtil.isEmpty(values)) {
             return (LambdaQueryWrapperX<T>) super.in(column, values);
         }
         return this;
@@ -95,16 +95,9 @@ public class LambdaQueryWrapperX<T> extends LambdaQueryWrapper<T> {
     }
 
     public LambdaQueryWrapperX<T> betweenIfPresent(SFunction<T, ?> column, Object[] values) {
-        if (values!= null && values.length >0 && values[0] != null && values[1] != null) {
-            return (LambdaQueryWrapperX<T>) super.between(column, values[0], values[1]);
-        }
-        if (values != null && values.length >0 && values[0] != null) {
-            return (LambdaQueryWrapperX<T>) ge(column, values[0]);
-        }
-        if (values != null && values.length >0 && values[1] != null) {
-            return (LambdaQueryWrapperX<T>) le(column, values[2]);
-        }
-        return this;
+        Object val1 = ArrayUtils.get(values, 0);
+        Object val2 = ArrayUtils.get(values, 1);
+        return betweenIfPresent(column, val1, val2);
     }
 
     // ========== 重写父类方法,方便链式调用 ==========

+ 21 - 21
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiAccessLogMapper.java

@@ -1,10 +1,10 @@
 package cn.iocoder.yudao.module.infra.dal.mysql.logger;
 
-import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;
-import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
-import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;
+import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -19,28 +19,28 @@ import java.util.List;
 public interface ApiAccessLogMapper extends BaseMapperX<ApiAccessLogDO> {
 
     default PageResult<ApiAccessLogDO> selectPage(ApiAccessLogPageReqVO reqVO) {
-        return selectPage(reqVO, new QueryWrapperX<ApiAccessLogDO>()
-                .eqIfPresent("user_id", reqVO.getUserId())
-                .eqIfPresent("user_type", reqVO.getUserType())
-                .eqIfPresent("application_name", reqVO.getApplicationName())
-                .likeIfPresent("request_url", reqVO.getRequestUrl())
-                .betweenIfPresent("begin_time", reqVO.getBeginTime())
-                .geIfPresent("duration", reqVO.getDuration())
-                .eqIfPresent("result_code", reqVO.getResultCode())
-                .orderByDesc("id")
+        return selectPage(reqVO, new LambdaQueryWrapperX<ApiAccessLogDO>()
+                .eqIfPresent(ApiAccessLogDO::getUserId, reqVO.getUserId())
+                .eqIfPresent(ApiAccessLogDO::getUserType, reqVO.getUserType())
+                .eqIfPresent(ApiAccessLogDO::getApplicationName, reqVO.getApplicationName())
+                .likeIfPresent(ApiAccessLogDO::getRequestUrl, reqVO.getRequestUrl())
+                .betweenIfPresent(ApiAccessLogDO::getBeginTime, reqVO.getBeginTime())
+                .geIfPresent(ApiAccessLogDO::getDuration, reqVO.getDuration())
+                .eqIfPresent(ApiAccessLogDO::getResultCode, reqVO.getResultCode())
+                .orderByDesc(ApiAccessLogDO::getId)
         );
     }
 
     default List<ApiAccessLogDO> selectList(ApiAccessLogExportReqVO reqVO) {
-        return selectList(new QueryWrapperX<ApiAccessLogDO>()
-                .eqIfPresent("user_id", reqVO.getUserId())
-                .eqIfPresent("user_type", reqVO.getUserType())
-                .eqIfPresent("application_name", reqVO.getApplicationName())
-                .likeIfPresent("request_url", reqVO.getRequestUrl())
-                .betweenIfPresent("begin_time", reqVO.getBeginTime())
-                .geIfPresent("duration", reqVO.getDuration())
-                .eqIfPresent("result_code", reqVO.getResultCode())
-                .orderByDesc("id")
+        return selectList(new LambdaQueryWrapperX<ApiAccessLogDO>()
+                .eqIfPresent(ApiAccessLogDO::getUserId, reqVO.getUserId())
+                .eqIfPresent(ApiAccessLogDO::getUserType, reqVO.getUserType())
+                .eqIfPresent(ApiAccessLogDO::getApplicationName, reqVO.getApplicationName())
+                .likeIfPresent(ApiAccessLogDO::getRequestUrl, reqVO.getRequestUrl())
+                .betweenIfPresent(ApiAccessLogDO::getBeginTime, reqVO.getBeginTime())
+                .geIfPresent(ApiAccessLogDO::getDuration, reqVO.getDuration())
+                .eqIfPresent(ApiAccessLogDO::getResultCode, reqVO.getResultCode())
+                .orderByDesc(ApiAccessLogDO::getId)
         );
     }
 

+ 17 - 17
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiErrorLogMapper.java

@@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.mysql.logger;
 
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
-import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;
 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
@@ -19,26 +19,26 @@ import java.util.List;
 public interface ApiErrorLogMapper extends BaseMapperX<ApiErrorLogDO> {
 
     default PageResult<ApiErrorLogDO> selectPage(ApiErrorLogPageReqVO reqVO) {
-        return selectPage(reqVO, new QueryWrapperX<ApiErrorLogDO>()
-                .eqIfPresent("user_id", reqVO.getUserId())
-                .eqIfPresent("user_type", reqVO.getUserType())
-                .eqIfPresent("application_name", reqVO.getApplicationName())
-                .likeIfPresent("request_url", reqVO.getRequestUrl())
-                .betweenIfPresent("exception_time", reqVO.getExceptionTime())
-                .eqIfPresent("process_status", reqVO.getProcessStatus())
-                .orderByDesc("id")
+        return selectPage(reqVO, new LambdaQueryWrapperX<ApiErrorLogDO>()
+                .eqIfPresent(ApiErrorLogDO::getUserId, reqVO.getUserId())
+                .eqIfPresent(ApiErrorLogDO::getUserType, reqVO.getUserType())
+                .eqIfPresent(ApiErrorLogDO::getApplicationName, reqVO.getApplicationName())
+                .likeIfPresent(ApiErrorLogDO::getRequestUrl, reqVO.getRequestUrl())
+                .betweenIfPresent(ApiErrorLogDO::getExceptionTime, reqVO.getExceptionTime())
+                .eqIfPresent(ApiErrorLogDO::getProcessStatus, reqVO.getProcessStatus())
+                .orderByDesc(ApiErrorLogDO::getId)
         );
     }
 
     default List<ApiErrorLogDO> selectList(ApiErrorLogExportReqVO reqVO) {
-        return selectList(new QueryWrapperX<ApiErrorLogDO>()
-                .eqIfPresent("user_id", reqVO.getUserId())
-                .eqIfPresent("user_type", reqVO.getUserType())
-                .eqIfPresent("application_name", reqVO.getApplicationName())
-                .likeIfPresent("request_url", reqVO.getRequestUrl())
-                .betweenIfPresent("exception_time", reqVO.getExceptionTime())
-                .eqIfPresent("process_status", reqVO.getProcessStatus())
-				.orderByDesc("id")
+        return selectList(new LambdaQueryWrapperX<ApiErrorLogDO>()
+                .eqIfPresent(ApiErrorLogDO::getUserId, reqVO.getUserId())
+                .eqIfPresent(ApiErrorLogDO::getUserType, reqVO.getUserType())
+                .eqIfPresent(ApiErrorLogDO::getApplicationName, reqVO.getApplicationName())
+                .likeIfPresent(ApiErrorLogDO::getRequestUrl, reqVO.getRequestUrl())
+                .betweenIfPresent(ApiErrorLogDO::getExceptionTime, reqVO.getExceptionTime())
+                .eqIfPresent(ApiErrorLogDO::getProcessStatus, reqVO.getProcessStatus())
+                .orderByDesc(ApiErrorLogDO::getId)
         );
     }
 

+ 1 - 1
yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java

@@ -60,7 +60,7 @@ public class FileServiceTest extends BaseDbUnitTest {
         FilePageReqVO reqVO = new FilePageReqVO();
         reqVO.setPath("yunai");
         reqVO.setType("jp");
-        reqVO.setCreateTime((new Date[]{buildTime(2021, 1, 10),buildTime(2021, 1, 20)}));
+        reqVO.setCreateTime((new Date[]{buildTime(2021, 1, 10), buildTime(2021, 1, 20)}));
 
         // 调用
         PageResult<FileDO> pageResult = fileService.getFilePage(reqVO);

+ 19 - 20
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/errorcode/ErrorCodeMapper.java

@@ -2,11 +2,10 @@ package cn.iocoder.yudao.module.system.dal.mysql.errorcode;
 
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
-import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.module.system.controller.admin.errorcode.vo.ErrorCodeExportReqVO;
 import cn.iocoder.yudao.module.system.controller.admin.errorcode.vo.ErrorCodePageReqVO;
 import cn.iocoder.yudao.module.system.dal.dataobject.errorcode.ErrorCodeDO;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.Collection;
@@ -17,36 +16,36 @@ import java.util.List;
 public interface ErrorCodeMapper extends BaseMapperX<ErrorCodeDO> {
 
     default PageResult<ErrorCodeDO> selectPage(ErrorCodePageReqVO reqVO) {
-        return selectPage(reqVO, new QueryWrapperX<ErrorCodeDO>()
-                .eqIfPresent("type", reqVO.getType())
-                .likeIfPresent("application_name", reqVO.getApplicationName())
-                .eqIfPresent("code", reqVO.getCode())
-                .likeIfPresent("message", reqVO.getMessage())
-                .betweenIfPresent("create_time", reqVO.getCreateTime())
-                .orderByDesc("code"));
+        return selectPage(reqVO, new LambdaQueryWrapperX<ErrorCodeDO>()
+                .eqIfPresent(ErrorCodeDO::getType, reqVO.getType())
+                .likeIfPresent(ErrorCodeDO::getApplicationName, reqVO.getApplicationName())
+                .eqIfPresent(ErrorCodeDO::getCode, reqVO.getCode())
+                .likeIfPresent(ErrorCodeDO::getMessage, reqVO.getMessage())
+                .betweenIfPresent(ErrorCodeDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(ErrorCodeDO::getCode));
     }
 
     default List<ErrorCodeDO> selectList(ErrorCodeExportReqVO reqVO) {
-        return selectList(new QueryWrapperX<ErrorCodeDO>()
-                .eqIfPresent("type", reqVO.getType())
-                .likeIfPresent("application_name", reqVO.getApplicationName())
-                .eqIfPresent("code", reqVO.getCode())
-                .likeIfPresent("message", reqVO.getMessage())
-                .betweenIfPresent("create_time", reqVO.getCreateTime())
-                .orderByAsc("application_name", "code"));
+        return selectList(new LambdaQueryWrapperX<ErrorCodeDO>()
+                .eqIfPresent(ErrorCodeDO::getType, reqVO.getType())
+                .likeIfPresent(ErrorCodeDO::getApplicationName, reqVO.getApplicationName())
+                .eqIfPresent(ErrorCodeDO::getCode, reqVO.getCode())
+                .likeIfPresent(ErrorCodeDO::getMessage, reqVO.getMessage())
+                .betweenIfPresent(ErrorCodeDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(ErrorCodeDO::getCode));
     }
 
     default List<ErrorCodeDO> selectListByCodes(Collection<Integer> codes) {
-        return selectList(new QueryWrapper<ErrorCodeDO>().in("code", codes));
+        return selectList(new LambdaQueryWrapperX<ErrorCodeDO>().in(ErrorCodeDO::getCode, codes));
     }
 
     default ErrorCodeDO selectByCode(Integer code) {
-        return selectOne(new QueryWrapper<ErrorCodeDO>().eq("code", code));
+        return selectOne(new LambdaQueryWrapperX<ErrorCodeDO>().eq(ErrorCodeDO::getCode, code));
     }
 
     default List<ErrorCodeDO> selectListByApplicationNameAndUpdateTimeGt(String applicationName, Date minUpdateTime) {
-        return selectList(new QueryWrapperX<ErrorCodeDO>().eq("application_name", applicationName)
-                .gtIfPresent("update_time", minUpdateTime));
+        return selectList(new LambdaQueryWrapperX<ErrorCodeDO>().eq(ErrorCodeDO::getApplicationName, applicationName)
+                .gtIfPresent(ErrorCodeDO::getUpdateTime, minUpdateTime));
     }
 
 }

+ 16 - 16
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/LoginLogMapper.java

@@ -1,11 +1,11 @@
 package cn.iocoder.yudao.module.system.dal.mysql.logger;
 
-import cn.iocoder.yudao.module.system.dal.dataobject.logger.LoginLogDO;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
-import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogExportReqVO;
 import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogPageReqVO;
+import cn.iocoder.yudao.module.system.dal.dataobject.logger.LoginLogDO;
 import cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -15,30 +15,30 @@ import java.util.List;
 public interface LoginLogMapper extends BaseMapperX<LoginLogDO> {
 
     default PageResult<LoginLogDO> selectPage(LoginLogPageReqVO reqVO) {
-        QueryWrapperX<LoginLogDO> query = new QueryWrapperX<LoginLogDO>()
-                .likeIfPresent("user_ip", reqVO.getUserIp())
-                .likeIfPresent("username", reqVO.getUsername())
-                .betweenIfPresent("create_time", reqVO.getCreateTime());
+        LambdaQueryWrapperX<LoginLogDO> query = new LambdaQueryWrapperX<LoginLogDO>()
+                .likeIfPresent(LoginLogDO::getUserIp, reqVO.getUserIp())
+                .likeIfPresent(LoginLogDO::getUsername, reqVO.getUsername())
+                .betweenIfPresent(LoginLogDO::getCreateTime, reqVO.getCreateTime());
         if (Boolean.TRUE.equals(reqVO.getStatus())) {
-            query.eq("result", LoginResultEnum.SUCCESS.getResult());
+            query.eq(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult());
         } else if (Boolean.FALSE.equals(reqVO.getStatus())) {
-            query.gt("result", LoginResultEnum.SUCCESS.getResult());
+            query.gt(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult());
         }
-        query.orderByDesc("id"); // 降序
+        query.orderByDesc(LoginLogDO::getId); // 降序
         return selectPage(reqVO, query);
     }
 
     default List<LoginLogDO> selectList(LoginLogExportReqVO reqVO) {
-        QueryWrapperX<LoginLogDO> query = new QueryWrapperX<LoginLogDO>()
-                .likeIfPresent("user_ip", reqVO.getUserIp())
-                .likeIfPresent("username", reqVO.getUsername())
-                .betweenIfPresent("create_time", reqVO.getCreateTime());
+        LambdaQueryWrapperX<LoginLogDO> query = new LambdaQueryWrapperX<LoginLogDO>()
+                .likeIfPresent(LoginLogDO::getUserIp, reqVO.getUserIp())
+                .likeIfPresent(LoginLogDO::getUsername, reqVO.getUsername())
+                .betweenIfPresent(LoginLogDO::getCreateTime, reqVO.getCreateTime());
         if (Boolean.TRUE.equals(reqVO.getStatus())) {
-            query.eq("result", LoginResultEnum.SUCCESS.getResult());
+            query.eq(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult());
         } else if (Boolean.FALSE.equals(reqVO.getStatus())) {
-            query.gt("result", LoginResultEnum.SUCCESS.getResult());
+            query.gt(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult());
         }
-        query.orderByDesc("id"); // 降序
+        query.orderByDesc(LoginLogDO::getId); // 降序
         return selectList(query);
     }
 

+ 21 - 21
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsLogMapper.java

@@ -1,11 +1,11 @@
 package cn.iocoder.yudao.module.system.dal.mysql.sms;
 
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExportReqVO;
 import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogPageReqVO;
 import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsLogDO;
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
-import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
@@ -14,27 +14,27 @@ import java.util.List;
 public interface SmsLogMapper extends BaseMapperX<SmsLogDO> {
 
     default PageResult<SmsLogDO> selectPage(SmsLogPageReqVO reqVO) {
-        return selectPage(reqVO, new QueryWrapperX<SmsLogDO>()
-                .eqIfPresent("channel_id", reqVO.getChannelId())
-                .eqIfPresent("template_id", reqVO.getTemplateId())
-                .likeIfPresent("mobile", reqVO.getMobile())
-                .eqIfPresent("send_status", reqVO.getSendStatus())
-                .betweenIfPresent("send_time", reqVO.getSendTime())
-                .eqIfPresent("receive_status", reqVO.getReceiveStatus())
-                .betweenIfPresent("receive_time", reqVO.getReceiveTime())
-                .orderByDesc("id"));
+        return selectPage(reqVO, new LambdaQueryWrapperX<SmsLogDO>()
+                .eqIfPresent(SmsLogDO::getChannelId, reqVO.getChannelId())
+                .eqIfPresent(SmsLogDO::getTemplateId, reqVO.getTemplateId())
+                .likeIfPresent(SmsLogDO::getMobile, reqVO.getMobile())
+                .eqIfPresent(SmsLogDO::getSendStatus, reqVO.getSendStatus())
+                .betweenIfPresent(SmsLogDO::getSendTime, reqVO.getSendTime())
+                .eqIfPresent(SmsLogDO::getSendStatus, reqVO.getReceiveStatus())
+                .betweenIfPresent(SmsLogDO::getReceiveTime, reqVO.getReceiveTime())
+                .orderByDesc(SmsLogDO::getId));
     }
 
     default List<SmsLogDO> selectList(SmsLogExportReqVO reqVO) {
-        return selectList(new QueryWrapperX<SmsLogDO>()
-                .eqIfPresent("channel_id", reqVO.getChannelId())
-                .eqIfPresent("template_id", reqVO.getTemplateId())
-                .likeIfPresent("mobile", reqVO.getMobile())
-                .eqIfPresent("send_status", reqVO.getSendStatus())
-                .betweenIfPresent("send_time", reqVO.getSendTime())
-                .eqIfPresent("receive_status", reqVO.getReceiveStatus())
-                .betweenIfPresent("receive_time", reqVO.getReceiveTime())
-                .orderByDesc("id"));
+        return selectList(new LambdaQueryWrapperX<SmsLogDO>()
+                .eqIfPresent(SmsLogDO::getChannelId, reqVO.getChannelId())
+                .eqIfPresent(SmsLogDO::getTemplateId, reqVO.getTemplateId())
+                .likeIfPresent(SmsLogDO::getMobile, reqVO.getMobile())
+                .eqIfPresent(SmsLogDO::getSendStatus, reqVO.getSendStatus())
+                .betweenIfPresent(SmsLogDO::getSendTime, reqVO.getSendTime())
+                .eqIfPresent(SmsLogDO::getSendStatus, reqVO.getReceiveStatus())
+                .betweenIfPresent(SmsLogDO::getReceiveTime, reqVO.getReceiveTime())
+                .orderByDesc(SmsLogDO::getId));
     }
 
 }

+ 3 - 6
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java

@@ -1,12 +1,11 @@
 package cn.iocoder.yudao.module.system.dal.mysql.user;
 
-import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserExportReqVO;
-import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
-import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
-import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserExportReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
+import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -36,7 +35,6 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
                 .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime())
                 .inIfPresent(AdminUserDO::getDeptId, deptIds)
                 .orderByDesc(AdminUserDO::getId));
-
     }
 
     default List<AdminUserDO> selectList(UserExportReqVO reqVO, Collection<Long> deptIds) {
@@ -65,4 +63,3 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
     }
 
 }
-