Commit 26a094a7109eab46da240aec297efa73b1224c85

Authored by YunaiV
1 parent 1e3bd472

refactor:优化时间范围查询

README.md
... ... @@ -160,7 +160,7 @@ ps:核心功能已经实现,正在对接微信小程序中...
160 160 |---------------------------------------------------------------------------------------------|-----------------------|-----------|----------------------------------------------------------------|
161 161 | [Spring Boot](https://spring.io/projects/spring-boot) | 应用开发框架 | 2.6.9 | [文档](https://github.com/YunaiV/SpringBoot-Labs) |
162 162 | [MySQL](https://www.mysql.com/cn/) | 数据库服务器 | 5.7 | |
163   -| [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.2.8 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) |
  163 +| [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.2.11 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) |
164 164 | [MyBatis Plus](https://mp.baomidou.com/) | MyBatis 增强工具包 | 3.5.2 | [文档](http://www.iocoder.cn/Spring-Boot/MyBatis/?yudao) |
165 165 | [Dynamic Datasource](https://dynamic-datasource.com/) | 动态数据源 | 3.5.0 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) |
166 166 | [Redis](https://redis.io/) | key-value 数据库 | 5.0 | |
... ...
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;
2 2  
3 3 import cn.hutool.core.collection.CollectionUtil;
4 4 import cn.hutool.core.util.ArrayUtil;
5   -import cn.hutool.core.util.TypeUtil;
6   -import org.springframework.cglib.core.TypeUtils;
7 5  
8   -import java.lang.reflect.Array;
9   -import java.lang.reflect.ParameterizedType;
10   -import java.lang.reflect.Type;
11 6 import java.util.Collection;
12   -import java.util.List;
13 7 import java.util.function.Consumer;
14 8 import java.util.function.Function;
15 9  
... ... @@ -53,4 +47,11 @@ public class ArrayUtils {
53 47 return ArrayUtil.toArray(from, (Class<T>) CollectionUtil.getElementType(from.iterator()));
54 48 }
55 49  
  50 + public static <T> T get(T[] array, int index) {
  51 + if (null == array || index >= array.length) {
  52 + return null;
  53 + }
  54 + return array[index];
  55 + }
  56 +
56 57 }
... ...
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/JsonUtils.java
... ... @@ -51,6 +51,10 @@ public class JsonUtils {
51 51 return objectMapper.writeValueAsBytes(object);
52 52 }
53 53  
  54 + @SneakyThrows
  55 + public static String toJsonPrettyString(Object object) {
  56 + return objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(object);
  57 + }
54 58  
55 59 public static <T> T parseObject(String text, Class<T> clazz) {
56 60 if (StrUtil.isEmpty(text)) {
... ...
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/LambdaQueryWrapperX.java
1 1 package cn.iocoder.yudao.framework.mybatis.core.query;
2 2  
  3 +import cn.hutool.core.util.ArrayUtil;
  4 +import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
3 5 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4   -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5   -import com.baomidou.mybatisplus.core.toolkit.ArrayUtils;
6 6 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
7 7 import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
8 8 import org.springframework.util.StringUtils;
... ... @@ -33,7 +33,7 @@ public class LambdaQueryWrapperX&lt;T&gt; extends LambdaQueryWrapper&lt;T&gt; {
33 33 }
34 34  
35 35 public LambdaQueryWrapperX<T> inIfPresent(SFunction<T, ?> column, Object... values) {
36   - if (!ArrayUtils.isEmpty(values)) {
  36 + if (!ArrayUtil.isEmpty(values)) {
37 37 return (LambdaQueryWrapperX<T>) super.in(column, values);
38 38 }
39 39 return this;
... ... @@ -95,16 +95,9 @@ public class LambdaQueryWrapperX&lt;T&gt; extends LambdaQueryWrapper&lt;T&gt; {
95 95 }
96 96  
97 97 public LambdaQueryWrapperX<T> betweenIfPresent(SFunction<T, ?> column, Object[] values) {
98   - if (values!= null && values.length >0 && values[0] != null && values[1] != null) {
99   - return (LambdaQueryWrapperX<T>) super.between(column, values[0], values[1]);
100   - }
101   - if (values != null && values.length >0 && values[0] != null) {
102   - return (LambdaQueryWrapperX<T>) ge(column, values[0]);
103   - }
104   - if (values != null && values.length >0 && values[1] != null) {
105   - return (LambdaQueryWrapperX<T>) le(column, values[2]);
106   - }
107   - return this;
  98 + Object val1 = ArrayUtils.get(values, 0);
  99 + Object val2 = ArrayUtils.get(values, 1);
  100 + return betweenIfPresent(column, val1, val2);
108 101 }
109 102  
110 103 // ========== 重写父类方法,方便链式调用 ==========
... ...
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiAccessLogMapper.java
1 1 package cn.iocoder.yudao.module.infra.dal.mysql.logger;
2 2  
3   -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;
4   -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
5 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
7   -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
  5 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  6 +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;
  7 +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
8 8 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
9 9 import org.apache.ibatis.annotations.Mapper;
10 10  
... ... @@ -19,28 +19,28 @@ import java.util.List;
19 19 public interface ApiAccessLogMapper extends BaseMapperX<ApiAccessLogDO> {
20 20  
21 21 default PageResult<ApiAccessLogDO> selectPage(ApiAccessLogPageReqVO reqVO) {
22   - return selectPage(reqVO, new QueryWrapperX<ApiAccessLogDO>()
23   - .eqIfPresent("user_id", reqVO.getUserId())
24   - .eqIfPresent("user_type", reqVO.getUserType())
25   - .eqIfPresent("application_name", reqVO.getApplicationName())
26   - .likeIfPresent("request_url", reqVO.getRequestUrl())
27   - .betweenIfPresent("begin_time", reqVO.getBeginTime())
28   - .geIfPresent("duration", reqVO.getDuration())
29   - .eqIfPresent("result_code", reqVO.getResultCode())
30   - .orderByDesc("id")
  22 + return selectPage(reqVO, new LambdaQueryWrapperX<ApiAccessLogDO>()
  23 + .eqIfPresent(ApiAccessLogDO::getUserId, reqVO.getUserId())
  24 + .eqIfPresent(ApiAccessLogDO::getUserType, reqVO.getUserType())
  25 + .eqIfPresent(ApiAccessLogDO::getApplicationName, reqVO.getApplicationName())
  26 + .likeIfPresent(ApiAccessLogDO::getRequestUrl, reqVO.getRequestUrl())
  27 + .betweenIfPresent(ApiAccessLogDO::getBeginTime, reqVO.getBeginTime())
  28 + .geIfPresent(ApiAccessLogDO::getDuration, reqVO.getDuration())
  29 + .eqIfPresent(ApiAccessLogDO::getResultCode, reqVO.getResultCode())
  30 + .orderByDesc(ApiAccessLogDO::getId)
31 31 );
32 32 }
33 33  
34 34 default List<ApiAccessLogDO> selectList(ApiAccessLogExportReqVO reqVO) {
35   - return selectList(new QueryWrapperX<ApiAccessLogDO>()
36   - .eqIfPresent("user_id", reqVO.getUserId())
37   - .eqIfPresent("user_type", reqVO.getUserType())
38   - .eqIfPresent("application_name", reqVO.getApplicationName())
39   - .likeIfPresent("request_url", reqVO.getRequestUrl())
40   - .betweenIfPresent("begin_time", reqVO.getBeginTime())
41   - .geIfPresent("duration", reqVO.getDuration())
42   - .eqIfPresent("result_code", reqVO.getResultCode())
43   - .orderByDesc("id")
  35 + return selectList(new LambdaQueryWrapperX<ApiAccessLogDO>()
  36 + .eqIfPresent(ApiAccessLogDO::getUserId, reqVO.getUserId())
  37 + .eqIfPresent(ApiAccessLogDO::getUserType, reqVO.getUserType())
  38 + .eqIfPresent(ApiAccessLogDO::getApplicationName, reqVO.getApplicationName())
  39 + .likeIfPresent(ApiAccessLogDO::getRequestUrl, reqVO.getRequestUrl())
  40 + .betweenIfPresent(ApiAccessLogDO::getBeginTime, reqVO.getBeginTime())
  41 + .geIfPresent(ApiAccessLogDO::getDuration, reqVO.getDuration())
  42 + .eqIfPresent(ApiAccessLogDO::getResultCode, reqVO.getResultCode())
  43 + .orderByDesc(ApiAccessLogDO::getId)
44 44 );
45 45 }
46 46  
... ...
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;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
5   -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
  5 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
6 6 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;
7 7 import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
8 8 import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
... ... @@ -19,26 +19,26 @@ import java.util.List;
19 19 public interface ApiErrorLogMapper extends BaseMapperX<ApiErrorLogDO> {
20 20  
21 21 default PageResult<ApiErrorLogDO> selectPage(ApiErrorLogPageReqVO reqVO) {
22   - return selectPage(reqVO, new QueryWrapperX<ApiErrorLogDO>()
23   - .eqIfPresent("user_id", reqVO.getUserId())
24   - .eqIfPresent("user_type", reqVO.getUserType())
25   - .eqIfPresent("application_name", reqVO.getApplicationName())
26   - .likeIfPresent("request_url", reqVO.getRequestUrl())
27   - .betweenIfPresent("exception_time", reqVO.getExceptionTime())
28   - .eqIfPresent("process_status", reqVO.getProcessStatus())
29   - .orderByDesc("id")
  22 + return selectPage(reqVO, new LambdaQueryWrapperX<ApiErrorLogDO>()
  23 + .eqIfPresent(ApiErrorLogDO::getUserId, reqVO.getUserId())
  24 + .eqIfPresent(ApiErrorLogDO::getUserType, reqVO.getUserType())
  25 + .eqIfPresent(ApiErrorLogDO::getApplicationName, reqVO.getApplicationName())
  26 + .likeIfPresent(ApiErrorLogDO::getRequestUrl, reqVO.getRequestUrl())
  27 + .betweenIfPresent(ApiErrorLogDO::getExceptionTime, reqVO.getExceptionTime())
  28 + .eqIfPresent(ApiErrorLogDO::getProcessStatus, reqVO.getProcessStatus())
  29 + .orderByDesc(ApiErrorLogDO::getId)
30 30 );
31 31 }
32 32  
33 33 default List<ApiErrorLogDO> selectList(ApiErrorLogExportReqVO reqVO) {
34   - return selectList(new QueryWrapperX<ApiErrorLogDO>()
35   - .eqIfPresent("user_id", reqVO.getUserId())
36   - .eqIfPresent("user_type", reqVO.getUserType())
37   - .eqIfPresent("application_name", reqVO.getApplicationName())
38   - .likeIfPresent("request_url", reqVO.getRequestUrl())
39   - .betweenIfPresent("exception_time", reqVO.getExceptionTime())
40   - .eqIfPresent("process_status", reqVO.getProcessStatus())
41   - .orderByDesc("id")
  34 + return selectList(new LambdaQueryWrapperX<ApiErrorLogDO>()
  35 + .eqIfPresent(ApiErrorLogDO::getUserId, reqVO.getUserId())
  36 + .eqIfPresent(ApiErrorLogDO::getUserType, reqVO.getUserType())
  37 + .eqIfPresent(ApiErrorLogDO::getApplicationName, reqVO.getApplicationName())
  38 + .likeIfPresent(ApiErrorLogDO::getRequestUrl, reqVO.getRequestUrl())
  39 + .betweenIfPresent(ApiErrorLogDO::getExceptionTime, reqVO.getExceptionTime())
  40 + .eqIfPresent(ApiErrorLogDO::getProcessStatus, reqVO.getProcessStatus())
  41 + .orderByDesc(ApiErrorLogDO::getId)
42 42 );
43 43 }
44 44  
... ...
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 {
60 60 FilePageReqVO reqVO = new FilePageReqVO();
61 61 reqVO.setPath("yunai");
62 62 reqVO.setType("jp");
63   - reqVO.setCreateTime((new Date[]{buildTime(2021, 1, 10),buildTime(2021, 1, 20)}));
  63 + reqVO.setCreateTime((new Date[]{buildTime(2021, 1, 10), buildTime(2021, 1, 20)}));
64 64  
65 65 // 调用
66 66 PageResult<FileDO> pageResult = fileService.getFilePage(reqVO);
... ...
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;
2 2  
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
5   -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
  5 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
6 6 import cn.iocoder.yudao.module.system.controller.admin.errorcode.vo.ErrorCodeExportReqVO;
7 7 import cn.iocoder.yudao.module.system.controller.admin.errorcode.vo.ErrorCodePageReqVO;
8 8 import cn.iocoder.yudao.module.system.dal.dataobject.errorcode.ErrorCodeDO;
9   -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
10 9 import org.apache.ibatis.annotations.Mapper;
11 10  
12 11 import java.util.Collection;
... ... @@ -17,36 +16,36 @@ import java.util.List;
17 16 public interface ErrorCodeMapper extends BaseMapperX<ErrorCodeDO> {
18 17  
19 18 default PageResult<ErrorCodeDO> selectPage(ErrorCodePageReqVO reqVO) {
20   - return selectPage(reqVO, new QueryWrapperX<ErrorCodeDO>()
21   - .eqIfPresent("type", reqVO.getType())
22   - .likeIfPresent("application_name", reqVO.getApplicationName())
23   - .eqIfPresent("code", reqVO.getCode())
24   - .likeIfPresent("message", reqVO.getMessage())
25   - .betweenIfPresent("create_time", reqVO.getCreateTime())
26   - .orderByDesc("code"));
  19 + return selectPage(reqVO, new LambdaQueryWrapperX<ErrorCodeDO>()
  20 + .eqIfPresent(ErrorCodeDO::getType, reqVO.getType())
  21 + .likeIfPresent(ErrorCodeDO::getApplicationName, reqVO.getApplicationName())
  22 + .eqIfPresent(ErrorCodeDO::getCode, reqVO.getCode())
  23 + .likeIfPresent(ErrorCodeDO::getMessage, reqVO.getMessage())
  24 + .betweenIfPresent(ErrorCodeDO::getCreateTime, reqVO.getCreateTime())
  25 + .orderByDesc(ErrorCodeDO::getCode));
27 26 }
28 27  
29 28 default List<ErrorCodeDO> selectList(ErrorCodeExportReqVO reqVO) {
30   - return selectList(new QueryWrapperX<ErrorCodeDO>()
31   - .eqIfPresent("type", reqVO.getType())
32   - .likeIfPresent("application_name", reqVO.getApplicationName())
33   - .eqIfPresent("code", reqVO.getCode())
34   - .likeIfPresent("message", reqVO.getMessage())
35   - .betweenIfPresent("create_time", reqVO.getCreateTime())
36   - .orderByAsc("application_name", "code"));
  29 + return selectList(new LambdaQueryWrapperX<ErrorCodeDO>()
  30 + .eqIfPresent(ErrorCodeDO::getType, reqVO.getType())
  31 + .likeIfPresent(ErrorCodeDO::getApplicationName, reqVO.getApplicationName())
  32 + .eqIfPresent(ErrorCodeDO::getCode, reqVO.getCode())
  33 + .likeIfPresent(ErrorCodeDO::getMessage, reqVO.getMessage())
  34 + .betweenIfPresent(ErrorCodeDO::getCreateTime, reqVO.getCreateTime())
  35 + .orderByDesc(ErrorCodeDO::getCode));
37 36 }
38 37  
39 38 default List<ErrorCodeDO> selectListByCodes(Collection<Integer> codes) {
40   - return selectList(new QueryWrapper<ErrorCodeDO>().in("code", codes));
  39 + return selectList(new LambdaQueryWrapperX<ErrorCodeDO>().in(ErrorCodeDO::getCode, codes));
41 40 }
42 41  
43 42 default ErrorCodeDO selectByCode(Integer code) {
44   - return selectOne(new QueryWrapper<ErrorCodeDO>().eq("code", code));
  43 + return selectOne(new LambdaQueryWrapperX<ErrorCodeDO>().eq(ErrorCodeDO::getCode, code));
45 44 }
46 45  
47 46 default List<ErrorCodeDO> selectListByApplicationNameAndUpdateTimeGt(String applicationName, Date minUpdateTime) {
48   - return selectList(new QueryWrapperX<ErrorCodeDO>().eq("application_name", applicationName)
49   - .gtIfPresent("update_time", minUpdateTime));
  47 + return selectList(new LambdaQueryWrapperX<ErrorCodeDO>().eq(ErrorCodeDO::getApplicationName, applicationName)
  48 + .gtIfPresent(ErrorCodeDO::getUpdateTime, minUpdateTime));
50 49 }
51 50  
52 51 }
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/LoginLogMapper.java
1 1 package cn.iocoder.yudao.module.system.dal.mysql.logger;
2 2  
3   -import cn.iocoder.yudao.module.system.dal.dataobject.logger.LoginLogDO;
4 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
6   -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
  5 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
7 6 import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogExportReqVO;
8 7 import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogPageReqVO;
  8 +import cn.iocoder.yudao.module.system.dal.dataobject.logger.LoginLogDO;
9 9 import cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum;
10 10 import org.apache.ibatis.annotations.Mapper;
11 11  
... ... @@ -15,30 +15,30 @@ import java.util.List;
15 15 public interface LoginLogMapper extends BaseMapperX<LoginLogDO> {
16 16  
17 17 default PageResult<LoginLogDO> selectPage(LoginLogPageReqVO reqVO) {
18   - QueryWrapperX<LoginLogDO> query = new QueryWrapperX<LoginLogDO>()
19   - .likeIfPresent("user_ip", reqVO.getUserIp())
20   - .likeIfPresent("username", reqVO.getUsername())
21   - .betweenIfPresent("create_time", reqVO.getCreateTime());
  18 + LambdaQueryWrapperX<LoginLogDO> query = new LambdaQueryWrapperX<LoginLogDO>()
  19 + .likeIfPresent(LoginLogDO::getUserIp, reqVO.getUserIp())
  20 + .likeIfPresent(LoginLogDO::getUsername, reqVO.getUsername())
  21 + .betweenIfPresent(LoginLogDO::getCreateTime, reqVO.getCreateTime());
22 22 if (Boolean.TRUE.equals(reqVO.getStatus())) {
23   - query.eq("result", LoginResultEnum.SUCCESS.getResult());
  23 + query.eq(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult());
24 24 } else if (Boolean.FALSE.equals(reqVO.getStatus())) {
25   - query.gt("result", LoginResultEnum.SUCCESS.getResult());
  25 + query.gt(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult());
26 26 }
27   - query.orderByDesc("id"); // 降序
  27 + query.orderByDesc(LoginLogDO::getId); // 降序
28 28 return selectPage(reqVO, query);
29 29 }
30 30  
31 31 default List<LoginLogDO> selectList(LoginLogExportReqVO reqVO) {
32   - QueryWrapperX<LoginLogDO> query = new QueryWrapperX<LoginLogDO>()
33   - .likeIfPresent("user_ip", reqVO.getUserIp())
34   - .likeIfPresent("username", reqVO.getUsername())
35   - .betweenIfPresent("create_time", reqVO.getCreateTime());
  32 + LambdaQueryWrapperX<LoginLogDO> query = new LambdaQueryWrapperX<LoginLogDO>()
  33 + .likeIfPresent(LoginLogDO::getUserIp, reqVO.getUserIp())
  34 + .likeIfPresent(LoginLogDO::getUsername, reqVO.getUsername())
  35 + .betweenIfPresent(LoginLogDO::getCreateTime, reqVO.getCreateTime());
36 36 if (Boolean.TRUE.equals(reqVO.getStatus())) {
37   - query.eq("result", LoginResultEnum.SUCCESS.getResult());
  37 + query.eq(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult());
38 38 } else if (Boolean.FALSE.equals(reqVO.getStatus())) {
39   - query.gt("result", LoginResultEnum.SUCCESS.getResult());
  39 + query.gt(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult());
40 40 }
41   - query.orderByDesc("id"); // 降序
  41 + query.orderByDesc(LoginLogDO::getId); // 降序
42 42 return selectList(query);
43 43 }
44 44  
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsLogMapper.java
1 1 package cn.iocoder.yudao.module.system.dal.mysql.sms;
2 2  
  3 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  4 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  5 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
3 6 import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExportReqVO;
4 7 import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogPageReqVO;
5 8 import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsLogDO;
6   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
7   -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
8   -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
9 9 import org.apache.ibatis.annotations.Mapper;
10 10  
11 11 import java.util.List;
... ... @@ -14,27 +14,27 @@ import java.util.List;
14 14 public interface SmsLogMapper extends BaseMapperX<SmsLogDO> {
15 15  
16 16 default PageResult<SmsLogDO> selectPage(SmsLogPageReqVO reqVO) {
17   - return selectPage(reqVO, new QueryWrapperX<SmsLogDO>()
18   - .eqIfPresent("channel_id", reqVO.getChannelId())
19   - .eqIfPresent("template_id", reqVO.getTemplateId())
20   - .likeIfPresent("mobile", reqVO.getMobile())
21   - .eqIfPresent("send_status", reqVO.getSendStatus())
22   - .betweenIfPresent("send_time", reqVO.getSendTime())
23   - .eqIfPresent("receive_status", reqVO.getReceiveStatus())
24   - .betweenIfPresent("receive_time", reqVO.getReceiveTime())
25   - .orderByDesc("id"));
  17 + return selectPage(reqVO, new LambdaQueryWrapperX<SmsLogDO>()
  18 + .eqIfPresent(SmsLogDO::getChannelId, reqVO.getChannelId())
  19 + .eqIfPresent(SmsLogDO::getTemplateId, reqVO.getTemplateId())
  20 + .likeIfPresent(SmsLogDO::getMobile, reqVO.getMobile())
  21 + .eqIfPresent(SmsLogDO::getSendStatus, reqVO.getSendStatus())
  22 + .betweenIfPresent(SmsLogDO::getSendTime, reqVO.getSendTime())
  23 + .eqIfPresent(SmsLogDO::getSendStatus, reqVO.getReceiveStatus())
  24 + .betweenIfPresent(SmsLogDO::getReceiveTime, reqVO.getReceiveTime())
  25 + .orderByDesc(SmsLogDO::getId));
26 26 }
27 27  
28 28 default List<SmsLogDO> selectList(SmsLogExportReqVO reqVO) {
29   - return selectList(new QueryWrapperX<SmsLogDO>()
30   - .eqIfPresent("channel_id", reqVO.getChannelId())
31   - .eqIfPresent("template_id", reqVO.getTemplateId())
32   - .likeIfPresent("mobile", reqVO.getMobile())
33   - .eqIfPresent("send_status", reqVO.getSendStatus())
34   - .betweenIfPresent("send_time", reqVO.getSendTime())
35   - .eqIfPresent("receive_status", reqVO.getReceiveStatus())
36   - .betweenIfPresent("receive_time", reqVO.getReceiveTime())
37   - .orderByDesc("id"));
  29 + return selectList(new LambdaQueryWrapperX<SmsLogDO>()
  30 + .eqIfPresent(SmsLogDO::getChannelId, reqVO.getChannelId())
  31 + .eqIfPresent(SmsLogDO::getTemplateId, reqVO.getTemplateId())
  32 + .likeIfPresent(SmsLogDO::getMobile, reqVO.getMobile())
  33 + .eqIfPresent(SmsLogDO::getSendStatus, reqVO.getSendStatus())
  34 + .betweenIfPresent(SmsLogDO::getSendTime, reqVO.getSendTime())
  35 + .eqIfPresent(SmsLogDO::getSendStatus, reqVO.getReceiveStatus())
  36 + .betweenIfPresent(SmsLogDO::getReceiveTime, reqVO.getReceiveTime())
  37 + .orderByDesc(SmsLogDO::getId));
38 38 }
39 39  
40 40 }
... ...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java
1 1 package cn.iocoder.yudao.module.system.dal.mysql.user;
2 2  
3   -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserExportReqVO;
4   -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
5   -import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
6   -import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
7 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
8 4 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
9 5 import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  6 +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserExportReqVO;
  7 +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
  8 +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
10 9 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
11 10 import org.apache.ibatis.annotations.Mapper;
12 11  
... ... @@ -36,7 +35,6 @@ public interface AdminUserMapper extends BaseMapperX&lt;AdminUserDO&gt; {
36 35 .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime())
37 36 .inIfPresent(AdminUserDO::getDeptId, deptIds)
38 37 .orderByDesc(AdminUserDO::getId));
39   -
40 38 }
41 39  
42 40 default List<AdminUserDO> selectList(UserExportReqVO reqVO, Collection<Long> deptIds) {
... ... @@ -65,4 +63,3 @@ public interface AdminUserMapper extends BaseMapperX&lt;AdminUserDO&gt; {
65 63 }
66 64  
67 65 }
68   -
... ...