From f1cf5f9f880217dc996b76bf78f845d18101713d Mon Sep 17 00:00:00 2001 From: YunaiV Date: Tue, 26 Jul 2022 23:10:31 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=97=B6=E9=97=B4=E5=8C=BA?= =?UTF-8?q?=E9=97=B4=E6=9F=A5=E8=AF=A2=E4=BC=A0=E5=85=A5=E6=95=B0=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README_bak.md | 218 ++++++++++++++++++ .../common/util/collection/ArrayUtils.java | 13 +- .../core/query/LambdaQueryWrapperX.java | 12 +- .../filter/logging/AccessLogFilter.java | 3 +- .../vo/table/CodegenTablePageReqVO.java | 8 +- .../file/vo/config/FileConfigPageReqVO.java | 8 +- .../admin/file/vo/file/FilePageReqVO.java | 8 +- .../apiaccesslog/ApiAccessLogExportReqVO.java | 8 +- .../apiaccesslog/ApiAccessLogPageReqVO.java | 8 +- .../apierrorlog/ApiErrorLogExportReqVO.java | 8 +- .../vo/apierrorlog/ApiErrorLogPageReqVO.java | 8 +- .../admin/test/vo/TestDemoExportReqVO.java | 17 +- .../admin/test/vo/TestDemoPageReqVO.java | 18 +- .../dal/mysql/codegen/CodegenTableMapper.java | 2 +- .../dal/mysql/file/FileConfigMapper.java | 2 +- .../infra/dal/mysql/file/FileMapper.java | 2 +- .../dal/mysql/logger/ApiAccessLogMapper.java | 42 ++-- .../dal/mysql/logger/ApiErrorLogMapper.java | 34 +-- .../infra/dal/mysql/test/TestDemoMapper.java | 4 +- .../file/FileConfigServiceImplTest.java | 58 ++--- .../infra/service/file/FileServiceTest.java | 5 +- .../logger/ApiAccessLogServiceImplTest.java | 10 +- .../logger/ApiErrorLogServiceImplTest.java | 9 +- .../service/test/TestDemoServiceImplTest.java | 8 +- .../dict/vo/type/DictTypeExportReqVO.java | 8 +- .../admin/dict/vo/type/DictTypePageReqVO.java | 8 +- .../errorcode/vo/ErrorCodeExportReqVO.java | 8 +- .../errorcode/vo/ErrorCodePageReqVO.java | 8 +- .../vo/loginlog/LoginLogExportReqVO.java | 8 +- .../logger/vo/loginlog/LoginLogPageReqVO.java | 8 +- .../vo/operatelog/OperateLogExportReqVO.java | 8 +- .../vo/operatelog/OperateLogPageReqVO.java | 8 +- .../permission/vo/role/RoleExportReqVO.java | 8 +- .../permission/vo/role/RolePageReqVO.java | 9 +- .../vo/SensitiveWordExportReqVO.java | 8 +- .../vo/SensitiveWordPageReqVO.java | 8 +- .../sms/vo/channel/SmsChannelPageReqVO.java | 8 +- .../admin/sms/vo/log/SmsLogExportReqVO.java | 12 +- .../admin/sms/vo/log/SmsLogPageReqVO.java | 12 +- .../vo/template/SmsTemplateExportReqVO.java | 8 +- .../sms/vo/template/SmsTemplatePageReqVO.java | 8 +- .../vo/packages/TenantPackagePageReqVO.java | 8 +- .../tenant/vo/tenant/TenantExportReqVO.java | 8 +- .../tenant/vo/tenant/TenantPageReqVO.java | 8 +- .../admin/user/vo/user/UserExportReqVO.java | 8 +- .../admin/user/vo/user/UserPageReqVO.java | 8 +- .../system/dal/mysql/dict/DictTypeMapper.java | 5 +- .../dal/mysql/errorcode/ErrorCodeMapper.java | 39 ++-- .../dal/mysql/logger/LoginLogMapper.java | 32 +-- .../dal/mysql/logger/OperateLogMapper.java | 4 +- .../dal/mysql/permission/RoleMapper.java | 4 +- .../sensitiveword/SensitiveWordMapper.java | 4 +- .../dal/mysql/sms/SmsChannelMapper.java | 2 +- .../system/dal/mysql/sms/SmsLogMapper.java | 42 ++-- .../dal/mysql/sms/SmsTemplateMapper.java | 4 +- .../system/dal/mysql/tenant/TenantMapper.java | 4 +- .../dal/mysql/tenant/TenantPackageMapper.java | 2 +- .../dal/mysql/user/AdminUserMapper.java | 13 +- .../service/dict/DictTypeServiceTest.java | 61 +++-- .../errorcode/ErrorCodeServiceTest.java | 55 +++-- .../logger/LoginLogServiceImplTest.java | 9 +- .../logger/OperateLogServiceImplTest.java | 12 +- .../service/permission/RoleServiceTest.java | 7 +- .../SensitiveWordServiceImplTest.java | 8 +- .../service/sms/SmsChannelServiceTest.java | 53 +++-- .../system/service/sms/SmsLogServiceTest.java | 98 ++++---- .../service/sms/SmsTemplateServiceTest.java | 98 ++++---- .../tenant/TenantPackageServiceImplTest.java | 71 +++--- .../service/tenant/TenantServiceImplTest.java | 9 +- .../user/AdminUserServiceImplTest.java | 9 +- 70 files changed, 706 insertions(+), 637 deletions(-) create mode 100644 README_bak.md diff --git a/README_bak.md b/README_bak.md new file mode 100644 index 000000000..f72d46699 --- /dev/null +++ b/README_bak.md @@ -0,0 +1,218 @@ +以 [ruoyi-vue-pro](https://github.com/YunaiV/ruoyi-vue-pro) 为基础,实现的 Spring Cloud Alibaba 微服务架构。进度如下: + +* [x] `gateway` 网关服务 +* [x] `system` 系统服务 +* [x] `infra` 基础设施 +* [ ] `bpm` 工作流服务 +* [ ] `pay` 支付服务 +* [ ] `member` 会员服务 +* [ ] `product` 商品服务 +* [ ] `market` 营销服务 +* [ ] `trade` 交易服务 + +启动文档,可见 地址。 + +---- + +# 前言 + +基于微服务的思想,构建在 B2C 电商场景下的项目实战。 + +* 「Talk is cheap. Show me the code」(屁话少说,放码过来) + > 我们看过很多技术文章,却依然不知道微服务该咋整。 + +* 这会是一个认真做的业务开源项目,目前 Java 代码 2w+ 行,不包括注释的情况下。 + +* 整体的功能如下图:![功能图](http://static.iocoder.cn/mall%20%E5%8A%9F%E8%83%BD%E5%9B%BE-min.png) + > 功能图,和实际后端模块拆分,并不是绝对对应。 + * [功能列表 - H5 商城](https://gitee.com/zhijiantianya/onemall/blob/master/docs/guides/%E5%8A%9F%E8%83%BD%E5%88%97%E8%A1%A8/%E5%8A%9F%E8%83%BD%E5%88%97%E8%A1%A8-H5%20%E5%95%86%E5%9F%8E.md) + * [功能列表 - 管理后台](https://gitee.com/zhijiantianya/onemall/blob/master/docs/guides/%E5%8A%9F%E8%83%BD%E5%88%97%E8%A1%A8/%E5%8A%9F%E8%83%BD%E5%88%97%E8%A1%A8-%E7%AE%A1%E7%90%86%E5%90%8E%E5%8F%B0.md) + +* 交流群:[传送门](http://www.iocoder.cn/mall-user-group/?vip&gitee) + > 一起交流,Get 知识。 + +* 我们迫切希望更多的参与进来,可以加入「交流群」,一起骚聊。 + * [《Onemall 电商开源项目 —— 应用分层》](http://www.iocoder.cn/Onemall/Application-layer/?onemall) + * [《Onemall 电商开源项目 —— 搭建调试环境》](http://www.iocoder.cn/Onemall/build-debugger-environment/?onemall) + +* 前端项目地址: + +# 演示 + +> 艿艿:目前的开发者,都是后端出身。所以,一帮没有审美自觉的人,撸出来的前端界面,可能是东半球倒数第二难看。 +> +> 迫切希望,有前端能力不错的小伙伴,加入我们,一起来完善「芋道商城」。 + +## 管理后台 + +体验传送门: + +![GIF 图-耐心等待](https://raw.githubusercontent.com/YunaiV/Blog/master/Mall/onemall-admin-min.gif) + +## H5 商城 + +体验传送门: + +*2M 带宽小水管,访问略微有点慢* + +![GIF 图-耐心等待](https://raw.githubusercontent.com/YunaiV/Blog/master/Mall/onemall-h5-min.gif) + +## 其它演示 + +下面,我们会提供目前用到的中间件的管理平台。 + +> 艿艿:考虑到大家可以看到更全的功能,所以一般提供 admin 账号。所以,大家素质使用哟。 + +**SkyWalking UI** + +* 地址: + +> 教程:[《芋道 SkyWalking 安装部署》](http://www.iocoder.cn/SkyWalking/install/?onemall) + +**Grafana UI** + +* 地址:http://grafana.shop.iocoder.cn:18099 +* 演示账号:yudaoyuanma / yudaoyuanma +* 用于展示 Prometheus 收集的 Metrics 指标数据。 + +**Dubbo Admin** + +* 地址:http://dubbo-admin.shop.iocoder.cn:18099 +* 管理员账号:无需登陆 + +**RocketMQ Console** + +* 地址: + +> 教程:[《芋道 RocketMQ 安装部署》](http://www.iocoder.cn/RocketMQ/install/?onemall) + +**XXL-Job Console** + +* 地址: +* 管理员账号:admin / 123456 + +> 教程:[《芋道 XXL-Job 安装部署》](http://www.iocoder.cn/XXL-JOB/install/?onemall) + +**Sentinel Console** + +* 地址: +* 账号:sentinel / sentinel + +> 教程:[《芋道 Sentinel 安装部署》](http://www.iocoder.cn/Sentinel/install/?onemall) + +# 技术 + +## 搭建环境 + +[搭建调试环境](http://www.iocoder.cn/Onemall/build-debugger-environment/) + +## 架构图 + +TODO 此处应有一个架构图的装逼 JPG 图。 + +## 项目结构 + +| 模块 | 名称 | 端口 | | +| --- | --- | --- | --- | +| [`admin-dashboard-vue`](https://github.com/YunaiV/onemall-web/tree/master/admin-dashboard-vue) | 【前端】管理后台 | HTTP 9527 | | +| [`user-dashboard-vue`](https://github.com/YunaiV/onemall-web/tree/master/user-h5-vue) | 【前端】商城平台 | HTTP 8080 | | +| | | | +| | | | +| `management-web-app` | 【后端】管理平台 HTTP 服务 | HTTP 18083 | [接口文档](http://api-dashboard.shop.iocoder.cn/management-api/doc.html) | +| `shop-web-app` | 【后端】商城平台 HTTP 服务 | HTTP 18084 | [接口文档](http://api-h5.shop.iocoder.cn/shop-api/doc.html) | +| | | | +| | | | +| `system-service-project` | 系统 RPC 服务 | 随机 | +| `user-service-project` | 用户 RPC 服务 | 随机 | | +| `promotion-service-project` | 营销 RPC 服务 | 随机 | | +| `pay-service-project` | 支付 RPC 服务 | 随机 | | +| `trade-service-project` | 交易 RPC 服务 | 随机 | | +| `product-service-project` | 商品 RPC 服务 | 随机 | | +| `search-service-project` | 搜索 RPC 服务 | 随机 | | + +------- + +后端项目,目前的项目结构如下: + +```Java +[-] xxx-web-app // 提供对外 HTTP API。 + +[-] xxx-service-project + ├──[-] xxx-service-api // 提供对内 RPC API 。 + ├──[-] xxx-service-app // 提供对内 RPC 实现。 + ├──[-] xxx-service-integration-test // 集成测试。 +``` + + +## 技术栈 + +### 后端 + +| 框架 | 说明 | 版本 | +| --- | --- | --- | +| [Spring Boot](https://spring.io/projects/spring-boot) | 应用开发框架 | 2.1.4 | +| [MySQL](https://www.mysql.com/cn/) | 数据库服务器 | 5.6 | +| [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.1.16 | +| [MyBatis](http://www.mybatis.org/mybatis-3/zh/index.html) | 数据持久层框架 | 3.5.1 | +| [MyBatis-Plus](https://mp.baomidou.com/) | Mybatis 增强工具包 | 3.1.1 | +| [Redis](https://redis.io/) | key-value 数据库 | 暂未引入,等压测后,部分模块 | +| [Redisson](https://github.com/redisson/redisson) | Redis 客户端 | 暂未引入,等压测后,部分模块 | +| [Elasticsearch](https://www.elastic.co/cn/) | 分布式搜索引擎 | 6.7.1 | +| [Dubbo](http://dubbo.apache.org/) | 分布式 RPC 服务框架 | 2.7.1 | +| [RocketMQ](http://dubbo.apache.org/) | 消息中间件 | 4.3.2 | +| [Seata](https://github.com/seata/seata) | 分布式事务中间件 | 0.5.1 | +| [Zookeeper](http://zookeeper.apache.org/) | 分布式系统协调 | 3.4.9 作为注册中心 | +| [XXL-Job](http://www.xuxueli.com/xxl-job/) | 分布式任务调度平台 | 2.0.1 | +| [springfox-swagger2](https://github.com/springfox/springfox/tree/master/springfox-swagger2) | API 文档 | 2.9.2 | +| [swagger-bootstrap-ui](https://gitee.com/xiaoym/swagger-bootstrap-ui) | Swagger 增强 UI 实现 | 1.9.3 | + +未来考虑引入 + +* [ ] 配置中心 Apollo +* [ ] 服务保障 Sentinel +* [ ] 网关 Soul + +### 前端 + +**商城 H5** + +| 框架 | 说明 | 版本 | +| --- | --- | --- | +| [Vue](https://cn.vuejs.org/index.html) | JavaScript 框架 | 2.5.17 | +| [Vant](https://youzan.github.io/vant/#/zh-CN/intro) | Vue UI 组件库 | 3.13.0 | + +**管理后台** + +| 框架 | 说明 | 版本 | +| --- | --- | --- | +| [Vue](https://cn.vuejs.org/index.html) | JavaScript 框架 | 2.5.17 | +| [Vue Element Admin](https://ant.design/docs/react/introduce-cn) | 后台前端解决方案 | - | + +### 监控 + +一般来说,监控会有三种方式: + +* 1、Tracing ,我们采用 Apache SkyWalking +* 2、Logging ,我们采用 ELK +* 3、Metrics ,我们采用 Prometheus + +| 框架 | 说明 | 版本 | +| --- | --- | --- | +| [SkyWalking](http://skywalking.apache.org/) | 分布式应用追踪系统 | 6.0.0 | +| [Prometheus](https://prometheus.io/) | 服务监控体系 | 2.9.2 | +| [Alertmanager](https://prometheus.io/docs/alerting/alertmanager/) | 告警管理器 | 0.17.0 | +| [Grafana](https://grafana.com/) | 仪表盘和图形编辑器 | 0.17.0 | + +### 其它 + +* Jenkins 持续集成 +* Nginx 服务器 +* [ ] Docker 容器 +* [ ] Nginx + +# 某种结尾 + +目前成员 + +* 小范 +* 芋艿 diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/ArrayUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/ArrayUtils.java index 899acbfc7..366f96008 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/ArrayUtils.java +++ b/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) CollectionUtil.getElementType(from.iterator())); } + public static T get(T[] array, int index) { + if (null == array || index >= array.length) { + return null; + } + return array[index]; + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/LambdaQueryWrapperX.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/LambdaQueryWrapperX.java index 463db3038..9fd1d16f8 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/LambdaQueryWrapperX.java +++ b/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 extends LambdaQueryWrapper { } public LambdaQueryWrapperX inIfPresent(SFunction column, Object... values) { - if (!ArrayUtils.isEmpty(values)) { + if (!ArrayUtil.isEmpty(values)) { return (LambdaQueryWrapperX) super.in(column, values); } return this; @@ -94,6 +94,12 @@ public class LambdaQueryWrapperX extends LambdaQueryWrapper { return this; } + public LambdaQueryWrapperX betweenIfPresent(SFunction column, Object[] values) { + Object val1 = ArrayUtils.get(values, 0); + Object val2 = ArrayUtils.get(values, 1); + return betweenIfPresent(column, val1, val2); + } + // ========== 重写父类方法,方便链式调用 ========== @Override diff --git a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/logging/AccessLogFilter.java b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/logging/AccessLogFilter.java index d55d2149a..f753ef5f1 100644 --- a/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/logging/AccessLogFilter.java +++ b/yudao-gateway/src/main/java/cn/iocoder/yudao/gateway/filter/logging/AccessLogFilter.java @@ -86,7 +86,8 @@ public class AccessLogFilter implements GlobalFilter, Ordered { values.put("userIp", gatewayLog.getUserIp()); values.put("responseBody", JsonUtils.isJson(gatewayLog.getResponseBody()) ? // 保证 body 的展示好看 JSONUtil.parse(gatewayLog.getResponseBody()) : gatewayLog.getResponseBody()); - values.put("responseHeaders", JsonUtils.toJsonString(gatewayLog.getResponseHeaders().toSingleValueMap())); + values.put("responseHeaders", gatewayLog.getResponseHeaders() != null ? + JsonUtils.toJsonString(gatewayLog.getResponseHeaders().toSingleValueMap()) : null); values.put("httpStatus", gatewayLog.getHttpStatus()); values.put("startTime", DateUtil.format(gatewayLog.getStartTime(), NORM_DATETIME_MS_FORMAT)); values.put("endTime", DateUtil.format(gatewayLog.getEndTime(), NORM_DATETIME_MS_FORMAT)); diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java index 491a7d87c..adff119b0 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java @@ -24,12 +24,8 @@ public class CodegenTablePageReqVO extends PageParam { @ApiModelProperty(value = "表描述", example = "芋道", notes = "模糊匹配") private String tableComment; - @ApiModelProperty(value = "开始创建时间", example = "2020-10-24 00:00:00") + @ApiModelProperty(value = "创建时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginCreateTime; - - @ApiModelProperty(value = "结束创建时间", example = "2020-10-24 23:59:59") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endCreateTime; + private Date[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java index 3b3f0d4e5..3752b37c5 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java @@ -24,12 +24,8 @@ public class FileConfigPageReqVO extends PageParam { @ApiModelProperty(value = "存储器", example = "1") private Integer storage; + @ApiModelProperty(value = "创建时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + private Date[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java index 346314e83..0ae43bbe0 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java @@ -24,12 +24,8 @@ public class FilePageReqVO extends PageParam { @ApiModelProperty(value = "文件类型", example = "jpg", notes = "模糊匹配") private String type; + @ApiModelProperty(value = "创建时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + private Date[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java index 83eefabd6..dc2ef8714 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java @@ -25,13 +25,9 @@ public class ApiAccessLogExportReqVO { @ApiModelProperty(value = "请求地址", example = "/xxx/yyy", notes = "模糊匹配") private String requestUrl; + @ApiModelProperty(value = "开始时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始开始请求时间") - private Date beginBeginTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束开始请求时间") - private Date endBeginTime; + private Date[] beginTime; @ApiModelProperty(value = "执行时长", example = "100", notes = "大于等于,单位:毫秒") private Integer duration; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java index d318bfa92..97ff8e949 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java @@ -30,13 +30,9 @@ public class ApiAccessLogPageReqVO extends PageParam { @ApiModelProperty(value = "请求地址", example = "/xxx/yyy", notes = "模糊匹配") private String requestUrl; + @ApiModelProperty(value = "开始时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始开始请求时间") - private Date beginBeginTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束开始请求时间") - private Date endBeginTime; + private Date[] beginTime; @ApiModelProperty(value = "执行时长", example = "100", notes = "大于等于,单位:毫秒") private Integer duration; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java index b799a3238..d8e121e0b 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java @@ -26,12 +26,8 @@ public class ApiErrorLogExportReqVO { private String requestUrl; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始异常发生时间") - private Date beginExceptionTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束异常发生时间") - private Date endExceptionTime; + @ApiModelProperty(value = "异常发生时间") + private Date[] exceptionTime; @ApiModelProperty(value = "处理状态", example = "0") private Integer processStatus; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java index e9a36af96..fda23ba14 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java @@ -31,12 +31,8 @@ public class ApiErrorLogPageReqVO extends PageParam { private String requestUrl; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始异常发生时间") - private Date beginExceptionTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束异常发生时间") - private Date endExceptionTime; + @ApiModelProperty(value = "异常发生时间") + private Date[] exceptionTime; @ApiModelProperty(value = "处理状态", example = "0") private Integer processStatus; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExportReqVO.java index 09011682e..8836919a6 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExportReqVO.java @@ -1,11 +1,12 @@ package cn.iocoder.yudao.module.infra.controller.admin.test.vo; -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; -import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; +import java.util.Date; + import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @ApiModel(value = "管理后台 - 字典类型 Excel 导出 Request VO", description = "参数和 TestDemoPageReqVO 是一致的") @@ -28,11 +29,7 @@ public class TestDemoExportReqVO { private String remark; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + @ApiModelProperty(value = "创建时间") + private Date[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoPageReqVO.java index 75cf79140..0ee9e060c 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoPageReqVO.java @@ -1,11 +1,15 @@ package cn.iocoder.yudao.module.infra.controller.admin.test.vo; -import lombok.*; -import java.util.*; -import io.swagger.annotations.*; import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; +import java.util.Date; + import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @ApiModel("管理后台 - 字典类型分页 Request VO") @@ -30,11 +34,7 @@ public class TestDemoPageReqVO extends PageParam { private String remark; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + @ApiModelProperty(value = "创建时间") + private Date[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/codegen/CodegenTableMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/codegen/CodegenTableMapper.java index 6e8ad3de9..c53268de0 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/codegen/CodegenTableMapper.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/codegen/CodegenTableMapper.java @@ -21,7 +21,7 @@ public interface CodegenTableMapper extends BaseMapperX { return selectPage(pageReqVO, new LambdaQueryWrapperX() .likeIfPresent(CodegenTableDO::getTableName, pageReqVO.getTableName()) .likeIfPresent(CodegenTableDO::getTableComment, pageReqVO.getTableComment()) - .betweenIfPresent(CodegenTableDO::getCreateTime, pageReqVO.getBeginCreateTime(), pageReqVO.getEndCreateTime())); + .betweenIfPresent(CodegenTableDO::getCreateTime, pageReqVO.getCreateTime())); } default List selectListByDataSourceConfigId(Long dataSourceConfigId) { diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileConfigMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileConfigMapper.java index 5d29a98aa..69a1e1cd7 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileConfigMapper.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileConfigMapper.java @@ -22,7 +22,7 @@ public interface FileConfigMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(FileConfigDO::getName, reqVO.getName()) .eqIfPresent(FileConfigDO::getStorage, reqVO.getStorage()) - .betweenIfPresent(FileConfigDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .betweenIfPresent(FileConfigDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(FileConfigDO::getId)); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileMapper.java index 845addc14..11233a457 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileMapper.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileMapper.java @@ -19,7 +19,7 @@ public interface FileMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(FileDO::getPath, reqVO.getPath()) .likeIfPresent(FileDO::getType, reqVO.getType()) - .betweenIfPresent(FileDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .betweenIfPresent(FileDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(FileDO::getId)); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiAccessLogMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiAccessLogMapper.java index 8f00fbebc..427675636 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiAccessLogMapper.java +++ b/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 { default PageResult selectPage(ApiAccessLogPageReqVO reqVO) { - return selectPage(reqVO, new QueryWrapperX() - .eqIfPresent("user_id", reqVO.getUserId()) - .eqIfPresent("user_type", reqVO.getUserType()) - .eqIfPresent("application_name", reqVO.getApplicationName()) - .likeIfPresent("request_url", reqVO.getRequestUrl()) - .betweenIfPresent("begin_time", reqVO.getBeginBeginTime(), reqVO.getEndBeginTime()) - .geIfPresent("duration", reqVO.getDuration()) - .eqIfPresent("result_code", reqVO.getResultCode()) - .orderByDesc("id") + return selectPage(reqVO, new LambdaQueryWrapperX() + .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 selectList(ApiAccessLogExportReqVO reqVO) { - return selectList(new QueryWrapperX() - .eqIfPresent("user_id", reqVO.getUserId()) - .eqIfPresent("user_type", reqVO.getUserType()) - .eqIfPresent("application_name", reqVO.getApplicationName()) - .likeIfPresent("request_url", reqVO.getRequestUrl()) - .betweenIfPresent("begin_time", reqVO.getBeginBeginTime(), reqVO.getEndBeginTime()) - .geIfPresent("duration", reqVO.getDuration()) - .eqIfPresent("result_code", reqVO.getResultCode()) - .orderByDesc("id") + return selectList(new LambdaQueryWrapperX() + .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) ); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiErrorLogMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiErrorLogMapper.java index 7e4ab62c3..e9748b624 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiErrorLogMapper.java +++ b/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 { default PageResult selectPage(ApiErrorLogPageReqVO reqVO) { - return selectPage(reqVO, new QueryWrapperX() - .eqIfPresent("user_id", reqVO.getUserId()) - .eqIfPresent("user_type", reqVO.getUserType()) - .eqIfPresent("application_name", reqVO.getApplicationName()) - .likeIfPresent("request_url", reqVO.getRequestUrl()) - .betweenIfPresent("exception_time", reqVO.getBeginExceptionTime(), reqVO.getEndExceptionTime()) - .eqIfPresent("process_status", reqVO.getProcessStatus()) - .orderByDesc("id") + return selectPage(reqVO, new LambdaQueryWrapperX() + .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 selectList(ApiErrorLogExportReqVO reqVO) { - return selectList(new QueryWrapperX() - .eqIfPresent("user_id", reqVO.getUserId()) - .eqIfPresent("user_type", reqVO.getUserType()) - .eqIfPresent("application_name", reqVO.getApplicationName()) - .likeIfPresent("request_url", reqVO.getRequestUrl()) - .betweenIfPresent("exception_time", reqVO.getBeginExceptionTime(), reqVO.getEndExceptionTime()) - .eqIfPresent("process_status", reqVO.getProcessStatus()) - .orderByDesc("id") + return selectList(new LambdaQueryWrapperX() + .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) ); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/test/TestDemoMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/test/TestDemoMapper.java index 7b7dd315a..d600b3f4b 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/test/TestDemoMapper.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/test/TestDemoMapper.java @@ -25,7 +25,7 @@ public interface TestDemoMapper extends BaseMapperX { .eqIfPresent(TestDemoDO::getType, reqVO.getType()) .eqIfPresent(TestDemoDO::getCategory, reqVO.getCategory()) .eqIfPresent(TestDemoDO::getRemark, reqVO.getRemark()) - .betweenIfPresent(TestDemoDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .betweenIfPresent(TestDemoDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(TestDemoDO::getId)); } @@ -36,7 +36,7 @@ public interface TestDemoMapper extends BaseMapperX { .eqIfPresent(TestDemoDO::getType, reqVO.getType()) .eqIfPresent(TestDemoDO::getCategory, reqVO.getCategory()) .eqIfPresent(TestDemoDO::getRemark, reqVO.getRemark()) - .betweenIfPresent(TestDemoDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .betweenIfPresent(TestDemoDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(TestDemoDO::getId)); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java index 9eb3a70f1..cdd9db27e 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImplTest.java @@ -22,6 +22,7 @@ import org.springframework.context.annotation.Import; import javax.annotation.Resource; import javax.validation.Validator; import java.io.Serializable; +import java.util.Date; import java.util.Map; import static cn.hutool.core.util.RandomUtil.randomEle; @@ -39,10 +40,10 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; /** -* {@link FileConfigServiceImpl} 的单元测试类 -* -* @author 芋道源码 -*/ + * {@link FileConfigServiceImpl} 的单元测试类 + * + * @author 芋道源码 + */ @Import(FileConfigServiceImpl.class) public class FileConfigServiceImplTest extends BaseDbUnitTest { @@ -172,8 +173,8 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { // 调用 fileConfigService.deleteFileConfig(id); - // 校验数据不存在了 - assertNull(fileConfigMapper.selectById(id)); + // 校验数据不存在了 + assertNull(fileConfigMapper.selectById(id)); // verify 调用 verify(fileConfigProducer).sendFileConfigRefreshMessage(); } @@ -201,30 +202,29 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest { @Test public void testGetFileConfigPage() { - // mock 数据 - FileConfigDO dbFileConfig = randomFileConfigDO().setName("芋道源码") - .setStorage(FileStorageEnum.LOCAL.getStorage()); - dbFileConfig.setCreateTime(buildTime(2022, 11, 11));// 等会查询到 - fileConfigMapper.insert(dbFileConfig); - // 测试 name 不匹配 - fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setName("源码"))); - // 测试 storage 不匹配 - fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setStorage(FileStorageEnum.DB.getStorage()))); - // 测试 createTime 不匹配 - fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setCreateTime(buildTime(2022, 12, 12)))); - // 准备参数 - FileConfigPageReqVO reqVO = new FileConfigPageReqVO(); - reqVO.setName("芋道"); - reqVO.setStorage(FileStorageEnum.LOCAL.getStorage()); - reqVO.setBeginCreateTime(buildTime(2022, 11, 10)); - reqVO.setEndCreateTime(buildTime(2022, 11, 12)); + // mock 数据 + FileConfigDO dbFileConfig = randomFileConfigDO().setName("芋道源码") + .setStorage(FileStorageEnum.LOCAL.getStorage()); + dbFileConfig.setCreateTime(buildTime(2022, 11, 11));// 等会查询到 + fileConfigMapper.insert(dbFileConfig); + // 测试 name 不匹配 + fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setName("源码"))); + // 测试 storage 不匹配 + fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setStorage(FileStorageEnum.DB.getStorage()))); + // 测试 createTime 不匹配 + fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setCreateTime(buildTime(2022, 12, 12)))); + // 准备参数 + FileConfigPageReqVO reqVO = new FileConfigPageReqVO(); + reqVO.setName("芋道"); + reqVO.setStorage(FileStorageEnum.LOCAL.getStorage()); + reqVO.setCreateTime((new Date[]{buildTime(2022, 11, 10),buildTime(2022, 11, 12)})); - // 调用 - PageResult pageResult = fileConfigService.getFileConfigPage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbFileConfig, pageResult.getList().get(0)); + // 调用 + PageResult pageResult = fileConfigService.getFileConfigPage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbFileConfig, pageResult.getList().get(0)); } @Test diff --git a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java index b5acbb8a4..2ccceac69 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java @@ -15,6 +15,8 @@ import org.springframework.context.annotation.Import; import javax.annotation.Resource; +import java.util.Date; + import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; @@ -58,8 +60,7 @@ public class FileServiceTest extends BaseDbUnitTest { FilePageReqVO reqVO = new FilePageReqVO(); reqVO.setPath("yunai"); reqVO.setType("jp"); - reqVO.setBeginCreateTime(buildTime(2021, 1, 10)); - reqVO.setEndCreateTime(buildTime(2021, 1, 20)); + reqVO.setCreateTime((new Date[]{buildTime(2021, 1, 10),buildTime(2021, 1, 20)})); // 调用 PageResult pageResult = fileService.getFilePage(reqVO); diff --git a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImplTest.java b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImplTest.java index 1aa699042..3da29f2df 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImplTest.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImplTest.java @@ -1,7 +1,6 @@ package cn.iocoder.yudao.module.infra.service.logger; import cn.hutool.core.util.RandomUtil; -import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLog; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -78,8 +77,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest { reqVO.setUserType(userType); reqVO.setApplicationName(applicationName); reqVO.setRequestUrl(requestUrl); - reqVO.setBeginBeginTime(buildTime(2021, 3, 12)); - reqVO.setEndBeginTime(buildTime(2021, 3, 14)); + reqVO.setBeginTime((new Date[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)})); reqVO.setDuration(duration); reqVO.setResultCode(resultCode); @@ -136,8 +134,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest { reqVO.setUserType(userType); reqVO.setApplicationName(applicationName); reqVO.setRequestUrl(requestUrl); - reqVO.setBeginBeginTime(buildTime(2021, 3, 12)); - reqVO.setEndBeginTime(buildTime(2021, 3, 14)); + reqVO.setBeginTime((new Date[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)})); reqVO.setDuration(duration); reqVO.setResultCode(resultCode); @@ -150,7 +147,7 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest { } @Test - public void testCreateApiAccessLog() { + public void testCreateApiAccessLogAsync() { // 准备参数 ApiAccessLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiAccessLogCreateReqDTO.class, dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue())); @@ -163,5 +160,4 @@ public class ApiAccessLogServiceImplTest extends BaseDbUnitTest { assertPojoEquals(createDTO, infApiAccessLogDO); } - } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImplTest.java b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImplTest.java index 6fdd7a368..4c4612716 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImplTest.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImplTest.java @@ -1,7 +1,6 @@ package cn.iocoder.yudao.module.infra.service.logger; import cn.hutool.core.util.RandomUtil; -import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLog; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; @@ -78,8 +77,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest { reqVO.setUserType(userType); reqVO.setApplicationName(applicationName); reqVO.setRequestUrl(requestUrl); - reqVO.setBeginExceptionTime(buildTime(2021, 3, 12)); - reqVO.setEndExceptionTime(buildTime(2021, 3, 14)); + reqVO.setExceptionTime((new Date[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)})); reqVO.setProcessStatus(progressStatus); // 调用service方法 @@ -131,8 +129,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest { reqVO.setUserType(userType); reqVO.setApplicationName(applicationName); reqVO.setRequestUrl(requestUrl); - reqVO.setBeginExceptionTime(buildTime(2021, 3, 12)); - reqVO.setEndExceptionTime(buildTime(2021, 3, 14)); + reqVO.setExceptionTime((new Date[]{buildTime(2021, 3, 12),buildTime(2021, 3, 14)})); reqVO.setProcessStatus(progressStatus); // 调用service方法 @@ -182,7 +179,7 @@ public class ApiErrorLogServiceImplTest extends BaseDbUnitTest { } @Test - public void testCreateApiErrorLog() { + public void testCreateApiErrorLogAsync() { // 准备参数 ApiErrorLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiErrorLogCreateReqDTO.class, dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue())); diff --git a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/test/TestDemoServiceImplTest.java b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/test/TestDemoServiceImplTest.java index be02b0ed6..a099bc787 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/test/TestDemoServiceImplTest.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/test/java/cn/iocoder/yudao/module/infra/service/test/TestDemoServiceImplTest.java @@ -14,8 +14,10 @@ import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; import javax.annotation.Resource; +import java.util.Date; import java.util.List; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; @@ -132,8 +134,7 @@ public class TestDemoServiceImplTest extends BaseDbUnitTest { reqVO.setType(1); reqVO.setCategory(2); reqVO.setRemark("哈哈哈"); - reqVO.setBeginCreateTime(DateUtils.buildTime(2021, 11, 10)); - reqVO.setEndCreateTime(DateUtils.buildTime(2021, 11, 12)); + reqVO.setCreateTime((new Date[]{buildTime(2021, 11, 10),buildTime(2021, 11, 12)})); // 调用 PageResult pageResult = testDemoService.getTestDemoPage(reqVO); @@ -174,8 +175,7 @@ public class TestDemoServiceImplTest extends BaseDbUnitTest { reqVO.setType(1); reqVO.setCategory(2); reqVO.setRemark("哈哈哈"); - reqVO.setBeginCreateTime(DateUtils.buildTime(2021, 11, 10)); - reqVO.setEndCreateTime(DateUtils.buildTime(2021, 11, 12)); + reqVO.setCreateTime((new Date[]{buildTime(2021, 11, 10),buildTime(2021, 11, 12)})); // 调用 List list = testDemoService.getTestDemoList(reqVO); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/type/DictTypeExportReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/type/DictTypeExportReqVO.java index 1043a1e72..e952b6b2f 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/type/DictTypeExportReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/type/DictTypeExportReqVO.java @@ -23,11 +23,7 @@ public class DictTypeExportReqVO { private Integer status; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + @ApiModelProperty(value = "创建时间") + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/type/DictTypePageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/type/DictTypePageReqVO.java index 84635621c..5eab6bd80 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/type/DictTypePageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/type/DictTypePageReqVO.java @@ -28,11 +28,7 @@ public class DictTypePageReqVO extends PageParam { private Integer status; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + @ApiModelProperty(value = "创建时间") + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/errorcode/vo/ErrorCodeExportReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/errorcode/vo/ErrorCodeExportReqVO.java index 9f716152c..8659602f7 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/errorcode/vo/ErrorCodeExportReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/errorcode/vo/ErrorCodeExportReqVO.java @@ -26,11 +26,7 @@ public class ErrorCodeExportReqVO { private String message; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + @ApiModelProperty(value = "创建时间") + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/errorcode/vo/ErrorCodePageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/errorcode/vo/ErrorCodePageReqVO.java index ff3d09833..cd01bdd43 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/errorcode/vo/ErrorCodePageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/errorcode/vo/ErrorCodePageReqVO.java @@ -31,11 +31,7 @@ public class ErrorCodePageReqVO extends PageParam { private String message; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + @ApiModelProperty(value = "创建时间") + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogExportReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogExportReqVO.java index df1a57ea5..558c24cd1 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogExportReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogExportReqVO.java @@ -22,12 +22,8 @@ public class LoginLogExportReqVO { @ApiModelProperty(value = "操作状态", example = "true") private Boolean status; - @ApiModelProperty(value = "开始时间", example = "2020-10-24") + @ApiModelProperty(value = "登录时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginTime; - - @ApiModelProperty(value = "结束时间", example = "2020-10-24") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endTime; + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogPageReqVO.java index ebefb728e..b792f6a9b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogPageReqVO.java @@ -25,12 +25,8 @@ public class LoginLogPageReqVO extends PageParam { @ApiModelProperty(value = "操作状态", example = "true") private Boolean status; - @ApiModelProperty(value = "开始时间", example = "2020-10-24") + @ApiModelProperty(value = "登录时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginTime; - - @ApiModelProperty(value = "结束时间", example = "2020-10-24") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endTime; + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/operatelog/OperateLogExportReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/operatelog/OperateLogExportReqVO.java index 90adb822e..12eaa7d66 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/operatelog/OperateLogExportReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/operatelog/OperateLogExportReqVO.java @@ -25,12 +25,8 @@ public class OperateLogExportReqVO { @ApiModelProperty(value = "操作状态", example = "true") private Boolean success; - @ApiModelProperty(value = "开始时间", example = "2020-10-24") + @ApiModelProperty(value = "开始时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginTime; - - @ApiModelProperty(value = "结束时间", example = "2020-10-24") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endTime; + private Date[] startTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/operatelog/OperateLogPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/operatelog/OperateLogPageReqVO.java index 0741abd88..f8c594323 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/operatelog/OperateLogPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/operatelog/OperateLogPageReqVO.java @@ -26,12 +26,8 @@ public class OperateLogPageReqVO extends PageParam { @ApiModelProperty(value = "操作状态", example = "true") private Boolean success; - @ApiModelProperty(value = "开始时间", example = "2020-10-24") + @ApiModelProperty(value = "开始时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginTime; - - @ApiModelProperty(value = "结束时间", example = "2020-10-24") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endTime; + private Date[] startTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/role/RoleExportReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/role/RoleExportReqVO.java index 02e47ac6f..d3ab4565f 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/role/RoleExportReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/role/RoleExportReqVO.java @@ -22,12 +22,8 @@ public class RoleExportReqVO { @ApiModelProperty(value = "展示状态", example = "1", notes = "参见 CommonStatusEnum 枚举类") private Integer status; - @ApiModelProperty(value = "开始时间", example = "2020-10-24") + @ApiModelProperty(value = "开始时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginTime; - - @ApiModelProperty(value = "结束时间", example = "2020-10-24") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endTime; + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/role/RolePageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/role/RolePageReqVO.java index 2f4cc1858..ca81b9c13 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/role/RolePageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/role/RolePageReqVO.java @@ -25,12 +25,7 @@ public class RolePageReqVO extends PageParam { @ApiModelProperty(value = "展示状态", example = "1", notes = "参见 CommonStatusEnum 枚举类") private Integer status; - @ApiModelProperty(value = "开始时间", example = "2020-10-24") + @ApiModelProperty(value = "开始时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginTime; - - @ApiModelProperty(value = "结束时间", example = "2020-10-24") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endTime; - + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sensitiveword/vo/SensitiveWordExportReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sensitiveword/vo/SensitiveWordExportReqVO.java index cec4944de..85e2aa92e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sensitiveword/vo/SensitiveWordExportReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sensitiveword/vo/SensitiveWordExportReqVO.java @@ -23,11 +23,7 @@ public class SensitiveWordExportReqVO { private Integer status; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + @ApiModelProperty(value = "创建时间") + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sensitiveword/vo/SensitiveWordPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sensitiveword/vo/SensitiveWordPageReqVO.java index 45d9cf161..411ff6e69 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sensitiveword/vo/SensitiveWordPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sensitiveword/vo/SensitiveWordPageReqVO.java @@ -28,11 +28,7 @@ public class SensitiveWordPageReqVO extends PageParam { private Integer status; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + @ApiModelProperty(value = "创建时间") + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/channel/SmsChannelPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/channel/SmsChannelPageReqVO.java index 306c7d06f..b41ecc88c 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/channel/SmsChannelPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/channel/SmsChannelPageReqVO.java @@ -25,11 +25,7 @@ public class SmsChannelPageReqVO extends PageParam { private String signature; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + @ApiModelProperty(value = "创建时间") + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogExportReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogExportReqVO.java index 6754b43b2..0f493fa2b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogExportReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogExportReqVO.java @@ -27,21 +27,13 @@ public class SmsLogExportReqVO { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始发送时间") - private Date beginSendTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束发送时间") - private Date endSendTime; + private Date[] sendTime; @ApiModelProperty(value = "接收状态", example = "0") private Integer receiveStatus; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始接收时间") - private Date beginReceiveTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束接收时间") - private Date endReceiveTime; + private Date[] receiveTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogPageReqVO.java index 767201f81..1bf4b04d2 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogPageReqVO.java @@ -32,21 +32,13 @@ public class SmsLogPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始发送时间") - private Date beginSendTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束发送时间") - private Date endSendTime; + private Date[] sendTime; @ApiModelProperty(value = "接收状态", example = "0", notes = "参见 SmsReceiveStatusEnum 枚举类") private Integer receiveStatus; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始接收时间") - private Date beginReceiveTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束接收时间") - private Date endReceiveTime; + private Date[] receiveTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateExportReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateExportReqVO.java index e775e4c70..b25e60548 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateExportReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateExportReqVO.java @@ -32,11 +32,7 @@ public class SmsTemplateExportReqVO { private Long channelId; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + @ApiModelProperty(value = "创建时间") + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplatePageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplatePageReqVO.java index 6932d2946..5a6a3d47f 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplatePageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplatePageReqVO.java @@ -37,11 +37,7 @@ public class SmsTemplatePageReqVO extends PageParam { private Long channelId; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + @ApiModelProperty(value = "创建时间") + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/packages/TenantPackagePageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/packages/TenantPackagePageReqVO.java index 8dd5b609d..66e9a77ad 100755 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/packages/TenantPackagePageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/packages/TenantPackagePageReqVO.java @@ -28,11 +28,7 @@ public class TenantPackagePageReqVO extends PageParam { private String remark; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + @ApiModelProperty(value = "创建时间") + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantExportReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantExportReqVO.java index 1ce620efd..dcf0bb120 100755 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantExportReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantExportReqVO.java @@ -26,11 +26,7 @@ public class TenantExportReqVO { private Integer status; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + @ApiModelProperty(value = "创建时间") + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantPageReqVO.java index 9723985a3..711ac3c84 100755 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/vo/tenant/TenantPageReqVO.java @@ -31,11 +31,7 @@ public class TenantPageReqVO extends PageParam { private Integer status; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "开始创建时间") - private Date beginCreateTime; - - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - @ApiModelProperty(value = "结束创建时间") - private Date endCreateTime; + @ApiModelProperty(value = "创建时间") + private Date[] createTime; } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserExportReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserExportReqVO.java index a25ba0b0f..4c25d0ce2 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserExportReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserExportReqVO.java @@ -26,13 +26,9 @@ public class UserExportReqVO { @ApiModelProperty(value = "展示状态", example = "1", notes = "参见 CommonStatusEnum 枚举类") private Integer status; - @ApiModelProperty(value = "开始时间", example = "2020-10-24") + @ApiModelProperty(value = "创建时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginTime; - - @ApiModelProperty(value = "结束时间", example = "2020-10-24") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endTime; + private Date[] createTime; @ApiModelProperty(value = "部门编号", example = "1024", notes = "同时筛选子部门") private Long deptId; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java index 00f20eb4d..c4f13a21e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserPageReqVO.java @@ -29,13 +29,9 @@ public class UserPageReqVO extends PageParam { @ApiModelProperty(value = "展示状态", example = "1", notes = "参见 CommonStatusEnum 枚举类") private Integer status; - @ApiModelProperty(value = "开始时间", example = "2020-10-24") + @ApiModelProperty(value = "创建时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginTime; - - @ApiModelProperty(value = "结束时间", example = "2020-10-24") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endTime; + private Date[] createTime; @ApiModelProperty(value = "部门编号", example = "1024", notes = "同时筛选子部门") private Long deptId; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dict/DictTypeMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dict/DictTypeMapper.java index 85c2acee4..7f87fde77 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dict/DictTypeMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dict/DictTypeMapper.java @@ -5,7 +5,6 @@ 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.dict.vo.type.DictTypeExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypePageReqVO; -import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO; import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO; import org.apache.ibatis.annotations.Mapper; @@ -19,7 +18,7 @@ public interface DictTypeMapper extends BaseMapperX { .likeIfPresent(DictTypeDO::getName, reqVO.getName()) .likeIfPresent(DictTypeDO::getType, reqVO.getType()) .eqIfPresent(DictTypeDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(DictTypeDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .betweenIfPresent(DictTypeDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(DictTypeDO::getId)); } @@ -28,7 +27,7 @@ public interface DictTypeMapper extends BaseMapperX { .likeIfPresent(DictTypeDO::getName, reqVO.getName()) .likeIfPresent(DictTypeDO::getType, reqVO.getType()) .eqIfPresent(DictTypeDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(DictTypeDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())); + .betweenIfPresent(DictTypeDO::getCreateTime, reqVO.getCreateTime())); } default DictTypeDO selectByType(String type) { diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/errorcode/ErrorCodeMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/errorcode/ErrorCodeMapper.java index 84842497c..0fcfbf68b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/errorcode/ErrorCodeMapper.java +++ b/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 { default PageResult selectPage(ErrorCodePageReqVO reqVO) { - return selectPage(reqVO, new QueryWrapperX() - .eqIfPresent("type", reqVO.getType()) - .likeIfPresent("application_name", reqVO.getApplicationName()) - .eqIfPresent("code", reqVO.getCode()) - .likeIfPresent("message", reqVO.getMessage()) - .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc("code")); + return selectPage(reqVO, new LambdaQueryWrapperX() + .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 selectList(ErrorCodeExportReqVO reqVO) { - return selectList(new QueryWrapperX() - .eqIfPresent("type", reqVO.getType()) - .likeIfPresent("application_name", reqVO.getApplicationName()) - .eqIfPresent("code", reqVO.getCode()) - .likeIfPresent("message", reqVO.getMessage()) - .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByAsc("application_name", "code")); + return selectList(new LambdaQueryWrapperX() + .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 selectListByCodes(Collection codes) { - return selectList(new QueryWrapper().in("code", codes)); + return selectList(new LambdaQueryWrapperX().in(ErrorCodeDO::getCode, codes)); } default ErrorCodeDO selectByCode(Integer code) { - return selectOne(new QueryWrapper().eq("code", code)); + return selectOne(new LambdaQueryWrapperX().eq(ErrorCodeDO::getCode, code)); } default List selectListByApplicationNameAndUpdateTimeGt(String applicationName, Date minUpdateTime) { - return selectList(new QueryWrapperX().eq("application_name", applicationName) - .gtIfPresent("update_time", minUpdateTime)); + return selectList(new LambdaQueryWrapperX().eq(ErrorCodeDO::getApplicationName, applicationName) + .gtIfPresent(ErrorCodeDO::getUpdateTime, minUpdateTime)); } } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/LoginLogMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/LoginLogMapper.java index a2731a5f6..1617fe075 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/LoginLogMapper.java +++ b/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 { default PageResult selectPage(LoginLogPageReqVO reqVO) { - QueryWrapperX query = new QueryWrapperX() - .likeIfPresent("user_ip", reqVO.getUserIp()) - .likeIfPresent("username", reqVO.getUsername()) - .betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime()); + LambdaQueryWrapperX query = new LambdaQueryWrapperX() + .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 selectList(LoginLogExportReqVO reqVO) { - QueryWrapperX query = new QueryWrapperX() - .likeIfPresent("user_ip", reqVO.getUserIp()) - .likeIfPresent("username", reqVO.getUsername()) - .betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime()); + LambdaQueryWrapperX query = new LambdaQueryWrapperX() + .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); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/OperateLogMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/OperateLogMapper.java index c8e0f2442..86e53a510 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/OperateLogMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/OperateLogMapper.java @@ -20,7 +20,7 @@ public interface OperateLogMapper extends BaseMapperX { .likeIfPresent(OperateLogDO::getModule, reqVO.getModule()) .inIfPresent(OperateLogDO::getUserId, userIds) .eqIfPresent(OperateLogDO::getType, reqVO.getType()) - .betweenIfPresent(OperateLogDO::getStartTime, reqVO.getBeginTime(), reqVO.getEndTime()); + .betweenIfPresent(OperateLogDO::getStartTime, reqVO.getStartTime()); if (Boolean.TRUE.equals(reqVO.getSuccess())) { query.eq(OperateLogDO::getResultCode, GlobalErrorCodeConstants.SUCCESS.getCode()); } else if (Boolean.FALSE.equals(reqVO.getSuccess())) { @@ -35,7 +35,7 @@ public interface OperateLogMapper extends BaseMapperX { .likeIfPresent(OperateLogDO::getModule, reqVO.getModule()) .inIfPresent(OperateLogDO::getUserId, userIds) .eqIfPresent(OperateLogDO::getType, reqVO.getType()) - .betweenIfPresent(OperateLogDO::getStartTime, reqVO.getBeginTime(), reqVO.getEndTime()); + .betweenIfPresent(OperateLogDO::getStartTime, reqVO.getStartTime()); if (Boolean.TRUE.equals(reqVO.getSuccess())) { query.eq(OperateLogDO::getResultCode, GlobalErrorCodeConstants.SUCCESS.getCode()); } else if (Boolean.FALSE.equals(reqVO.getSuccess())) { diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/RoleMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/RoleMapper.java index 359c7290b..de0bb68d9 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/RoleMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/RoleMapper.java @@ -23,7 +23,7 @@ public interface RoleMapper extends BaseMapperX { .likeIfPresent(RoleDO::getName, reqVO.getName()) .likeIfPresent(RoleDO::getCode, reqVO.getCode()) .eqIfPresent(RoleDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(BaseDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime()) + .betweenIfPresent(BaseDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(RoleDO::getId)); } @@ -32,7 +32,7 @@ public interface RoleMapper extends BaseMapperX { .likeIfPresent(RoleDO::getName, reqVO.getName()) .likeIfPresent(RoleDO::getCode, reqVO.getCode()) .eqIfPresent(RoleDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(BaseDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime())); + .betweenIfPresent(BaseDO::getCreateTime, reqVO.getCreateTime())); } default RoleDO selectByName(String name) { diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sensitiveword/SensitiveWordMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sensitiveword/SensitiveWordMapper.java index 4529f1a50..85d5dd3e9 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sensitiveword/SensitiveWordMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sensitiveword/SensitiveWordMapper.java @@ -25,7 +25,7 @@ public interface SensitiveWordMapper extends BaseMapperX { .likeIfPresent(SensitiveWordDO::getName, reqVO.getName()) .likeIfPresent(SensitiveWordDO::getTags, reqVO.getTag()) .eqIfPresent(SensitiveWordDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(SensitiveWordDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .betweenIfPresent(SensitiveWordDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(SensitiveWordDO::getId)); } @@ -34,7 +34,7 @@ public interface SensitiveWordMapper extends BaseMapperX { .likeIfPresent(SensitiveWordDO::getName, reqVO.getName()) .likeIfPresent(SensitiveWordDO::getTags, reqVO.getTag()) .eqIfPresent(SensitiveWordDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(SensitiveWordDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .betweenIfPresent(SensitiveWordDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(SensitiveWordDO::getId)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsChannelMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsChannelMapper.java index fbef490a5..d331ee43e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsChannelMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsChannelMapper.java @@ -17,7 +17,7 @@ public interface SmsChannelMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(SmsChannelDO::getSignature, reqVO.getSignature()) .eqIfPresent(SmsChannelDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(SmsChannelDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .betweenIfPresent(SmsChannelDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(SmsChannelDO::getId)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsLogMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsLogMapper.java index 01ea77a46..33f93a8a1 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsLogMapper.java +++ b/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 { default PageResult selectPage(SmsLogPageReqVO reqVO) { - return selectPage(reqVO, new QueryWrapperX() - .eqIfPresent("channel_id", reqVO.getChannelId()) - .eqIfPresent("template_id", reqVO.getTemplateId()) - .likeIfPresent("mobile", reqVO.getMobile()) - .eqIfPresent("send_status", reqVO.getSendStatus()) - .betweenIfPresent("send_time", reqVO.getBeginSendTime(), reqVO.getEndSendTime()) - .eqIfPresent("receive_status", reqVO.getReceiveStatus()) - .betweenIfPresent("receive_time", reqVO.getBeginReceiveTime(), reqVO.getEndReceiveTime()) - .orderByDesc("id")); + return selectPage(reqVO, new LambdaQueryWrapperX() + .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 selectList(SmsLogExportReqVO reqVO) { - return selectList(new QueryWrapperX() - .eqIfPresent("channel_id", reqVO.getChannelId()) - .eqIfPresent("template_id", reqVO.getTemplateId()) - .likeIfPresent("mobile", reqVO.getMobile()) - .eqIfPresent("send_status", reqVO.getSendStatus()) - .betweenIfPresent("send_time", reqVO.getBeginSendTime(), reqVO.getEndSendTime()) - .eqIfPresent("receive_status", reqVO.getReceiveStatus()) - .betweenIfPresent("receive_time", reqVO.getBeginReceiveTime(), reqVO.getEndReceiveTime()) - .orderByDesc("id")); + return selectList(new LambdaQueryWrapperX() + .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)); } } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsTemplateMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsTemplateMapper.java index d89449156..d41ee75b0 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsTemplateMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SmsTemplateMapper.java @@ -30,7 +30,7 @@ public interface SmsTemplateMapper extends BaseMapperX { .likeIfPresent(SmsTemplateDO::getContent, reqVO.getContent()) .likeIfPresent(SmsTemplateDO::getApiTemplateId, reqVO.getApiTemplateId()) .eqIfPresent(SmsTemplateDO::getChannelId, reqVO.getChannelId()) - .betweenIfPresent(SmsTemplateDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .betweenIfPresent(SmsTemplateDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(SmsTemplateDO::getId)); } @@ -42,7 +42,7 @@ public interface SmsTemplateMapper extends BaseMapperX { .likeIfPresent(SmsTemplateDO::getContent, reqVO.getContent()) .likeIfPresent(SmsTemplateDO::getApiTemplateId, reqVO.getApiTemplateId()) .eqIfPresent(SmsTemplateDO::getChannelId, reqVO.getChannelId()) - .betweenIfPresent(SmsTemplateDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .betweenIfPresent(SmsTemplateDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(SmsTemplateDO::getId)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantMapper.java index 39d04edd3..33771eeb2 100755 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantMapper.java @@ -26,7 +26,7 @@ public interface TenantMapper extends BaseMapperX { .likeIfPresent(TenantDO::getContactName, reqVO.getContactName()) .likeIfPresent(TenantDO::getContactMobile, reqVO.getContactMobile()) .eqIfPresent(TenantDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(TenantDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .betweenIfPresent(TenantDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(TenantDO::getId)); } @@ -36,7 +36,7 @@ public interface TenantMapper extends BaseMapperX { .likeIfPresent(TenantDO::getContactName, reqVO.getContactName()) .likeIfPresent(TenantDO::getContactMobile, reqVO.getContactMobile()) .eqIfPresent(TenantDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(TenantDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .betweenIfPresent(TenantDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(TenantDO::getId)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantPackageMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantPackageMapper.java index 2f7006555..e8a41c770 100755 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantPackageMapper.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/TenantPackageMapper.java @@ -22,7 +22,7 @@ public interface TenantPackageMapper extends BaseMapperX { .likeIfPresent(TenantPackageDO::getName, reqVO.getName()) .eqIfPresent(TenantPackageDO::getStatus, reqVO.getStatus()) .likeIfPresent(TenantPackageDO::getRemark, reqVO.getRemark()) - .betweenIfPresent(TenantPackageDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .betweenIfPresent(TenantPackageDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(TenantPackageDO::getId)); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java index b7d5e3daa..e6713bacb 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java +++ b/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; @@ -33,10 +32,9 @@ public interface AdminUserMapper extends BaseMapperX { .likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername()) .likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile()) .eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime()) + .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime()) .inIfPresent(AdminUserDO::getDeptId, deptIds) .orderByDesc(AdminUserDO::getId)); - } default List selectList(UserExportReqVO reqVO, Collection deptIds) { @@ -44,7 +42,7 @@ public interface AdminUserMapper extends BaseMapperX { .likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername()) .likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile()) .eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime()) + .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime()) .inIfPresent(AdminUserDO::getDeptId, deptIds)); } @@ -65,4 +63,3 @@ public interface AdminUserMapper extends BaseMapperX { } } - diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceTest.java index 127e602ea..a3ac2cba3 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceTest.java @@ -16,6 +16,7 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import javax.annotation.Resource; +import java.util.Date; import java.util.List; import java.util.function.Consumer; @@ -42,36 +43,35 @@ public class DictTypeServiceTest extends BaseDbUnitTest { @Test public void testGetDictTypePage() { - // mock 数据 - DictTypeDO dbDictType = randomPojo(DictTypeDO.class, o -> { // 等会查询到 - o.setName("yunai"); - o.setType("芋艿"); - o.setStatus(CommonStatusEnum.ENABLE.getStatus()); - o.setCreateTime(buildTime(2021, 1, 15)); - }); - dictTypeMapper.insert(dbDictType); - // 测试 name 不匹配 - dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setName("tudou"))); - // 测试 type 不匹配 - dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setType("土豆"))); - // 测试 status 不匹配 - dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); - // 测试 createTime 不匹配 - dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setCreateTime(buildTime(2021, 1, 1)))); - // 准备参数 - DictTypePageReqVO reqVO = new DictTypePageReqVO(); - reqVO.setName("nai"); - reqVO.setType("艿"); - reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setBeginCreateTime(buildTime(2021, 1, 10)); - reqVO.setEndCreateTime(buildTime(2021, 1, 20)); + // mock 数据 + DictTypeDO dbDictType = randomPojo(DictTypeDO.class, o -> { // 等会查询到 + o.setName("yunai"); + o.setType("芋艿"); + o.setStatus(CommonStatusEnum.ENABLE.getStatus()); + o.setCreateTime(buildTime(2021, 1, 15)); + }); + dictTypeMapper.insert(dbDictType); + // 测试 name 不匹配 + dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setName("tudou"))); + // 测试 type 不匹配 + dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setType("土豆"))); + // 测试 status 不匹配 + dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); + // 测试 createTime 不匹配 + dictTypeMapper.insert(ObjectUtils.cloneIgnoreId(dbDictType, o -> o.setCreateTime(buildTime(2021, 1, 1)))); + // 准备参数 + DictTypePageReqVO reqVO = new DictTypePageReqVO(); + reqVO.setName("nai"); + reqVO.setType("艿"); + reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); + reqVO.setCreateTime((new Date[]{buildTime(2021, 1, 10),buildTime(2021, 1, 20)})); - // 调用 - PageResult pageResult = dictTypeService.getDictTypePage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbDictType, pageResult.getList().get(0)); + // 调用 + PageResult pageResult = dictTypeService.getDictTypePage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbDictType, pageResult.getList().get(0)); } @Test @@ -97,8 +97,7 @@ public class DictTypeServiceTest extends BaseDbUnitTest { reqVO.setName("nai"); reqVO.setType("艿"); reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setBeginCreateTime(buildTime(2021, 1, 10)); - reqVO.setEndCreateTime(buildTime(2021, 1, 20)); + reqVO.setCreateTime((new Date[]{buildTime(2021, 1, 10),buildTime(2021, 1, 20)})); // 调用 List list = dictTypeService.getDictTypeList(reqVO); diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/errorcode/ErrorCodeServiceTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/errorcode/ErrorCodeServiceTest.java index c8181d8a2..bbddae3c6 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/errorcode/ErrorCodeServiceTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/errorcode/ErrorCodeServiceTest.java @@ -1,32 +1,33 @@ package cn.iocoder.yudao.module.system.service.errorcode; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; +import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; import cn.iocoder.yudao.module.system.api.errorcode.dto.ErrorCodeAutoGenerateReqDTO; -import cn.iocoder.yudao.module.system.dal.dataobject.errorcode.ErrorCodeDO; import cn.iocoder.yudao.module.system.controller.admin.errorcode.vo.ErrorCodeCreateReqVO; 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.controller.admin.errorcode.vo.ErrorCodeUpdateReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.errorcode.ErrorCodeDO; import cn.iocoder.yudao.module.system.dal.mysql.errorcode.ErrorCodeMapper; import cn.iocoder.yudao.module.system.enums.errorcode.ErrorCodeTypeEnum; -import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; -import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; import org.assertj.core.util.Lists; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; import javax.annotation.Resource; +import java.util.Date; import java.util.List; import java.util.function.Consumer; import static cn.hutool.core.util.RandomUtil.randomEle; -import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.ERROR_CODE_DUPLICATE; -import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.ERROR_CODE_NOT_EXISTS; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.ERROR_CODE_DUPLICATE; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.ERROR_CODE_NOT_EXISTS; import static org.junit.jupiter.api.Assertions.*; @Import(ErrorCodeServiceImpl.class) @@ -81,29 +82,28 @@ public class ErrorCodeServiceTest extends BaseDbUnitTest { // 调用 errorCodeService.deleteErrorCode(id); - // 校验数据不存在了 - assertNull(errorCodeMapper.selectById(id)); + // 校验数据不存在了 + assertNull(errorCodeMapper.selectById(id)); } @Test public void testGetErrorCodePage() { - // mock 数据 - ErrorCodeDO dbErrorCode = initGetErrorCodePage(); - // 准备参数 - ErrorCodePageReqVO reqVO = new ErrorCodePageReqVO(); - reqVO.setType(ErrorCodeTypeEnum.AUTO_GENERATION.getType()); - reqVO.setApplicationName("tu"); - reqVO.setCode(1); - reqVO.setMessage("ma"); - reqVO.setBeginCreateTime(buildTime(2020, 11, 1)); - reqVO.setEndCreateTime(buildTime(2020, 11, 30)); + // mock 数据 + ErrorCodeDO dbErrorCode = initGetErrorCodePage(); + // 准备参数 + ErrorCodePageReqVO reqVO = new ErrorCodePageReqVO(); + reqVO.setType(ErrorCodeTypeEnum.AUTO_GENERATION.getType()); + reqVO.setApplicationName("tu"); + reqVO.setCode(1); + reqVO.setMessage("ma"); + reqVO.setCreateTime((new Date[]{buildTime(2020, 11, 1),buildTime(2020, 11, 30)})); - // 调用 - PageResult pageResult = errorCodeService.getErrorCodePage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbErrorCode, pageResult.getList().get(0)); + // 调用 + PageResult pageResult = errorCodeService.getErrorCodePage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbErrorCode, pageResult.getList().get(0)); } /** @@ -141,8 +141,7 @@ public class ErrorCodeServiceTest extends BaseDbUnitTest { reqVO.setApplicationName("tu"); reqVO.setCode(1); reqVO.setMessage("ma"); - reqVO.setBeginCreateTime(buildTime(2020, 11, 1)); - reqVO.setEndCreateTime(buildTime(2020, 11, 30)); + reqVO.setCreateTime((new Date[]{buildTime(2020, 11, 1),buildTime(2020, 11, 30)})); // 调用 List list = errorCodeService.getErrorCodeList(reqVO); @@ -250,7 +249,7 @@ public class ErrorCodeServiceTest extends BaseDbUnitTest { // 准备参数 ErrorCodeAutoGenerateReqDTO generateReqDTO = randomPojo(ErrorCodeAutoGenerateReqDTO.class, o -> o.setCode(dbErrorCode.getCode()).setApplicationName(dbErrorCode.getApplicationName()) - .setMessage(dbErrorCode.getMessage())); + .setMessage(dbErrorCode.getMessage())); // mock 方法 // 调用 diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/logger/LoginLogServiceImplTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/logger/LoginLogServiceImplTest.java index b42a7db96..363f497dc 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/logger/LoginLogServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/logger/LoginLogServiceImplTest.java @@ -18,6 +18,7 @@ import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; import javax.annotation.Resource; +import java.util.Date; import java.util.List; import static cn.hutool.core.util.RandomUtil.randomEle; @@ -66,8 +67,7 @@ public class LoginLogServiceImplTest extends BaseDbUnitTest { reqVO.setUsername("wangkai"); reqVO.setUserIp("192.168.199"); reqVO.setStatus(true); - reqVO.setBeginTime(buildTime(2021, 3, 5)); - reqVO.setEndTime(buildTime(2021, 3, 7)); + reqVO.setCreateTime((new Date[]{buildTime(2021, 3, 5),buildTime(2021, 3, 5)})); // 调用service方法 PageResult pageResult = loginLogService.getLoginLogPage(reqVO); @@ -105,15 +105,12 @@ public class LoginLogServiceImplTest extends BaseDbUnitTest { // 构造一个早期时间 2021-02-06 00:00:00 loginLogMapper.insert(ObjectUtils.cloneIgnoreId(loginLogDO, logDO -> logDO.setCreateTime(buildTime(2021, 2, 6)))); - // 构造调用参数 LoginLogExportReqVO reqVO = new LoginLogExportReqVO(); reqVO.setUsername("wangxiaokai"); reqVO.setUserIp("192.168.111"); reqVO.setStatus(true); - reqVO.setBeginTime(buildTime(2021, 3, 5)); - reqVO.setEndTime(buildTime(2021, 3, 7)); - + reqVO.setCreateTime((new Date[]{buildTime(2021, 3, 5),buildTime(2021, 3, 5)})); // 调用service方法 List loginLogList = loginLogService.getLoginLogList(reqVO); diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImplTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImplTest.java index 948ea3abc..1f1c0809e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImplTest.java @@ -7,8 +7,8 @@ import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstant import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; -import cn.iocoder.yudao.framework.operatelog.core.service.OperateLog; import cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum; +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; import cn.iocoder.yudao.framework.test.core.util.RandomUtils; import cn.iocoder.yudao.module.system.api.logger.dto.OperateLogCreateReqDTO; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogExportReqVO; @@ -18,16 +18,14 @@ import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.dal.mysql.logger.OperateLogMapper; import cn.iocoder.yudao.module.system.enums.common.SexEnum; import cn.iocoder.yudao.module.system.service.user.AdminUserService; -import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; import org.junit.jupiter.api.Test; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import javax.annotation.Resource; import java.util.Collections; +import java.util.Date; import java.util.List; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; import static cn.hutool.core.util.RandomUtil.randomEle; import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; @@ -106,8 +104,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest { reqVO.setUserNickname("wangkai"); reqVO.setModule("order"); reqVO.setType(OperateTypeEnum.CREATE.getType()); - reqVO.setBeginTime(buildTime(2021, 3, 5)); - reqVO.setEndTime(buildTime(2021, 3, 7)); + reqVO.setStartTime((new Date[]{buildTime(2021, 3, 5),buildTime(2021, 3, 7)})); reqVO.setSuccess(true); // 调用service方法 @@ -158,8 +155,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest { reqVO.setUserNickname("wangkai"); reqVO.setModule("order"); reqVO.setType(OperateTypeEnum.CREATE.getType()); - reqVO.setBeginTime(buildTime(2021, 3, 5)); - reqVO.setEndTime(buildTime(2021, 3, 7)); + reqVO.setStartTime((new Date[]{buildTime(2021, 3, 5),buildTime(2021, 3, 7)})); reqVO.setSuccess(true); // 调用 service 方法 diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceTest.java index b81777fb6..b471a4cd5 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceTest.java @@ -22,6 +22,7 @@ import javax.annotation.Resource; import java.util.*; import java.util.stream.Collectors; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.max; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; @@ -178,8 +179,7 @@ public class RoleServiceTest extends BaseDbUnitTest { reqVO.setName("土豆"); reqVO.setCode("tu"); reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setBeginTime(DateUtils.buildTime(2022, 2, 1)); - reqVO.setEndTime(DateUtils.buildTime(2022, 2, 12)); + reqVO.setCreateTime((new Date[]{buildTime(2022, 2, 1),buildTime(2022, 2, 12)})); // 调用 List list = roleService.getRoleList(reqVO); @@ -209,8 +209,7 @@ public class RoleServiceTest extends BaseDbUnitTest { reqVO.setName("土豆"); reqVO.setCode("tu"); reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setBeginTime(DateUtils.buildTime(2022, 2, 1)); - reqVO.setEndTime(DateUtils.buildTime(2022, 2, 12)); + reqVO.setCreateTime((new Date[]{buildTime(2022, 2, 1),buildTime(2022, 2, 12)})); // 调用 PageResult pageResult = roleService.getRolePage(reqVO); diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sensitiveword/SensitiveWordServiceImplTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sensitiveword/SensitiveWordServiceImplTest.java index 09edfb910..8c347b97d 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sensitiveword/SensitiveWordServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sensitiveword/SensitiveWordServiceImplTest.java @@ -18,8 +18,10 @@ import org.springframework.context.annotation.Import; import javax.annotation.Resource; import java.util.Arrays; +import java.util.Date; import java.util.List; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.max; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; @@ -157,8 +159,7 @@ public class SensitiveWordServiceImplTest extends BaseDbUnitTest { reqVO.setName("笨"); reqVO.setTag("论坛"); reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setBeginCreateTime(DateUtils.buildTime(2022, 2, 1)); - reqVO.setEndCreateTime(DateUtils.buildTime(2022, 2, 12)); + reqVO.setCreateTime((new Date[]{buildTime(2022, 2, 1),buildTime(2022, 2, 12)})); // 调用 PageResult pageResult = sensitiveWordService.getSensitiveWordPage(reqVO); @@ -189,8 +190,7 @@ public class SensitiveWordServiceImplTest extends BaseDbUnitTest { reqVO.setName("笨"); reqVO.setTag("论坛"); reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setBeginCreateTime(DateUtils.buildTime(2022, 2, 1)); - reqVO.setEndCreateTime(DateUtils.buildTime(2022, 2, 12)); + reqVO.setCreateTime((new Date[]{buildTime(2022, 2, 1),buildTime(2022, 2, 12)})); // 调用 List list = sensitiveWordService.getSensitiveWordList(reqVO); diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceTest.java index a53a06fab..df851124b 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceTest.java @@ -124,8 +124,8 @@ public class SmsChannelServiceTest extends BaseDbUnitTest { // 调用 smsChannelService.deleteSmsChannel(id); - // 校验数据不存在了 - assertNull(smsChannelMapper.selectById(id)); + // 校验数据不存在了 + assertNull(smsChannelMapper.selectById(id)); // 校验调用 verify(smsProducer, times(1)).sendSmsChannelRefreshMessage(); } @@ -155,32 +155,31 @@ public class SmsChannelServiceTest extends BaseDbUnitTest { @Test public void testGetSmsChannelPage() { - // mock 数据 - SmsChannelDO dbSmsChannel = randomPojo(SmsChannelDO.class, o -> { // 等会查询到 - o.setSignature("芋道源码"); - o.setStatus(CommonStatusEnum.ENABLE.getStatus()); - o.setCreateTime(buildTime(2020, 12, 12)); - }); - smsChannelMapper.insert(dbSmsChannel); - // 测试 signature 不匹配 - smsChannelMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsChannel, o -> o.setSignature("源码"))); - // 测试 status 不匹配 - smsChannelMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsChannel, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); - // 测试 createTime 不匹配 - smsChannelMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsChannel, o -> o.setCreateTime(buildTime(2020, 11, 11)))); - // 准备参数 - SmsChannelPageReqVO reqVO = new SmsChannelPageReqVO(); - reqVO.setSignature("芋道"); - reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setBeginCreateTime(buildTime(2020, 12, 1)); - reqVO.setEndCreateTime(buildTime(2020, 12, 24)); + // mock 数据 + SmsChannelDO dbSmsChannel = randomPojo(SmsChannelDO.class, o -> { // 等会查询到 + o.setSignature("芋道源码"); + o.setStatus(CommonStatusEnum.ENABLE.getStatus()); + o.setCreateTime(buildTime(2020, 12, 12)); + }); + smsChannelMapper.insert(dbSmsChannel); + // 测试 signature 不匹配 + smsChannelMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsChannel, o -> o.setSignature("源码"))); + // 测试 status 不匹配 + smsChannelMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsChannel, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); + // 测试 createTime 不匹配 + smsChannelMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsChannel, o -> o.setCreateTime(buildTime(2020, 11, 11)))); + // 准备参数 + SmsChannelPageReqVO reqVO = new SmsChannelPageReqVO(); + reqVO.setSignature("芋道"); + reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); + reqVO.setCreateTime((new Date[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)})); - // 调用 - PageResult pageResult = smsChannelService.getSmsChannelPage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbSmsChannel, pageResult.getList().get(0)); + // 调用 + PageResult pageResult = smsChannelService.getSmsChannelPage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbSmsChannel, pageResult.getList().get(0)); } // ========== 随机对象 ========== diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceTest.java index c4205f538..f69f30e92 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceTest.java @@ -43,49 +43,47 @@ public class SmsLogServiceTest extends BaseDbUnitTest { @Test public void testGetSmsLogPage() { - // mock 数据 - SmsLogDO dbSmsLog = randomSmsLogDO(o -> { // 等会查询到 - o.setChannelId(1L); - o.setTemplateId(10L); - o.setMobile("15601691300"); - o.setSendStatus(SmsSendStatusEnum.INIT.getStatus()); - o.setSendTime(buildTime(2020, 11, 11)); - o.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus()); - o.setReceiveTime(buildTime(2021, 11, 11)); - }); - smsLogMapper.insert(dbSmsLog); - // 测试 channelId 不匹配 - smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setChannelId(2L))); - // 测试 templateId 不匹配 - smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setTemplateId(20L))); - // 测试 mobile 不匹配 - smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setMobile("18818260999"))); - // 测试 sendStatus 不匹配 - smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendStatus(SmsSendStatusEnum.IGNORE.getStatus()))); - // 测试 sendTime 不匹配 - smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendTime(buildTime(2020, 12, 12)))); - // 测试 receiveStatus 不匹配 - smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveStatus(SmsReceiveStatusEnum.SUCCESS.getStatus()))); - // 测试 receiveTime 不匹配 - smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveTime(buildTime(2021, 12, 12)))); - // 准备参数 - SmsLogPageReqVO reqVO = new SmsLogPageReqVO(); - reqVO.setChannelId(1L); - reqVO.setTemplateId(10L); - reqVO.setMobile("156"); - reqVO.setSendStatus(SmsSendStatusEnum.INIT.getStatus()); - reqVO.setBeginSendTime(buildTime(2020, 11, 1)); - reqVO.setEndSendTime(buildTime(2020, 11, 30)); - reqVO.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus()); - reqVO.setBeginReceiveTime(buildTime(2021, 11, 1)); - reqVO.setEndReceiveTime(buildTime(2021, 11, 30)); + // mock 数据 + SmsLogDO dbSmsLog = randomSmsLogDO(o -> { // 等会查询到 + o.setChannelId(1L); + o.setTemplateId(10L); + o.setMobile("15601691300"); + o.setSendStatus(SmsSendStatusEnum.INIT.getStatus()); + o.setSendTime(buildTime(2020, 11, 11)); + o.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus()); + o.setReceiveTime(buildTime(2021, 11, 11)); + }); + smsLogMapper.insert(dbSmsLog); + // 测试 channelId 不匹配 + smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setChannelId(2L))); + // 测试 templateId 不匹配 + smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setTemplateId(20L))); + // 测试 mobile 不匹配 + smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setMobile("18818260999"))); + // 测试 sendStatus 不匹配 + smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendStatus(SmsSendStatusEnum.IGNORE.getStatus()))); + // 测试 sendTime 不匹配 + smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setSendTime(buildTime(2020, 12, 12)))); + // 测试 receiveStatus 不匹配 + smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveStatus(SmsReceiveStatusEnum.SUCCESS.getStatus()))); + // 测试 receiveTime 不匹配 + smsLogMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsLog, o -> o.setReceiveTime(buildTime(2021, 12, 12)))); + // 准备参数 + SmsLogPageReqVO reqVO = new SmsLogPageReqVO(); + reqVO.setChannelId(1L); + reqVO.setTemplateId(10L); + reqVO.setMobile("156"); + reqVO.setSendStatus(SmsSendStatusEnum.INIT.getStatus()); + reqVO.setSendTime((new Date[]{buildTime(2020, 11, 1),buildTime(2020, 11, 30)})); + reqVO.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus()); + reqVO.setReceiveTime((new Date[]{buildTime(2021, 11, 1),buildTime(2021, 11, 30)})); - // 调用 - PageResult pageResult = smsLogService.getSmsLogPage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbSmsLog, pageResult.getList().get(0)); + // 调用 + PageResult pageResult = smsLogService.getSmsLogPage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbSmsLog, pageResult.getList().get(0)); } @Test @@ -121,17 +119,15 @@ public class SmsLogServiceTest extends BaseDbUnitTest { reqVO.setTemplateId(10L); reqVO.setMobile("156"); reqVO.setSendStatus(SmsSendStatusEnum.INIT.getStatus()); - reqVO.setBeginSendTime(buildTime(2020, 11, 1)); - reqVO.setEndSendTime(buildTime(2020, 11, 30)); + reqVO.setSendTime((new Date[]{buildTime(2020, 11, 1),buildTime(2020, 11, 30)})); reqVO.setReceiveStatus(SmsReceiveStatusEnum.INIT.getStatus()); - reqVO.setBeginReceiveTime(buildTime(2021, 11, 1)); - reqVO.setEndReceiveTime(buildTime(2021, 11, 30)); + reqVO.setReceiveTime((new Date[]{buildTime(2021, 11, 1),buildTime(2021, 11, 30)})); - // 调用 - List list = smsLogService.getSmsLogList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbSmsLog, list.get(0)); + // 调用 + List list = smsLogService.getSmsLogList(reqVO); + // 断言 + assertEquals(1, list.size()); + assertPojoEquals(dbSmsLog, list.get(0)); } @Test diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceTest.java index 50f1b3fd8..2a3860b0c 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceTest.java @@ -180,8 +180,8 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest { // 调用 smsTemplateService.deleteSmsTemplate(id); - // 校验数据不存在了 - assertNull(smsTemplateMapper.selectById(id)); + // 校验数据不存在了 + assertNull(smsTemplateMapper.selectById(id)); // 校验调用 verify(smsProducer, times(1)).sendSmsTemplateRefreshMessage(); } @@ -197,48 +197,47 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest { @Test public void testGetSmsTemplatePage() { - // mock 数据 - SmsTemplateDO dbSmsTemplate = randomPojo(SmsTemplateDO.class, o -> { // 等会查询到 - o.setType(SmsTemplateTypeEnum.PROMOTION.getType()); - o.setStatus(CommonStatusEnum.ENABLE.getStatus()); - o.setCode("tudou"); - o.setContent("芋道源码"); - o.setApiTemplateId("yunai"); - o.setChannelId(1L); - o.setCreateTime(buildTime(2021, 11, 11)); - }); - smsTemplateMapper.insert(dbSmsTemplate); - // 测试 type 不匹配 - smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setType(SmsTemplateTypeEnum.VERIFICATION_CODE.getType()))); - // 测试 status 不匹配 - smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); - // 测试 code 不匹配 - smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setCode("yuanma"))); - // 测试 content 不匹配 - smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setContent("源码"))); - // 测试 apiTemplateId 不匹配 - smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setApiTemplateId("nai"))); - // 测试 channelId 不匹配 - smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setChannelId(2L))); - // 测试 createTime 不匹配 - smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setCreateTime(buildTime(2021, 12, 12)))); - // 准备参数 - SmsTemplatePageReqVO reqVO = new SmsTemplatePageReqVO(); - reqVO.setType(SmsTemplateTypeEnum.PROMOTION.getType()); - reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setCode("tu"); - reqVO.setContent("芋道"); - reqVO.setApiTemplateId("yu"); - reqVO.setChannelId(1L); - reqVO.setBeginCreateTime(buildTime(2021, 11, 1)); - reqVO.setEndCreateTime(buildTime(2021, 12, 1)); + // mock 数据 + SmsTemplateDO dbSmsTemplate = randomPojo(SmsTemplateDO.class, o -> { // 等会查询到 + o.setType(SmsTemplateTypeEnum.PROMOTION.getType()); + o.setStatus(CommonStatusEnum.ENABLE.getStatus()); + o.setCode("tudou"); + o.setContent("芋道源码"); + o.setApiTemplateId("yunai"); + o.setChannelId(1L); + o.setCreateTime(buildTime(2021, 11, 11)); + }); + smsTemplateMapper.insert(dbSmsTemplate); + // 测试 type 不匹配 + smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setType(SmsTemplateTypeEnum.VERIFICATION_CODE.getType()))); + // 测试 status 不匹配 + smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); + // 测试 code 不匹配 + smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setCode("yuanma"))); + // 测试 content 不匹配 + smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setContent("源码"))); + // 测试 apiTemplateId 不匹配 + smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setApiTemplateId("nai"))); + // 测试 channelId 不匹配 + smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setChannelId(2L))); + // 测试 createTime 不匹配 + smsTemplateMapper.insert(ObjectUtils.cloneIgnoreId(dbSmsTemplate, o -> o.setCreateTime(buildTime(2021, 12, 12)))); + // 准备参数 + SmsTemplatePageReqVO reqVO = new SmsTemplatePageReqVO(); + reqVO.setType(SmsTemplateTypeEnum.PROMOTION.getType()); + reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); + reqVO.setCode("tu"); + reqVO.setContent("芋道"); + reqVO.setApiTemplateId("yu"); + reqVO.setChannelId(1L); + reqVO.setCreateTime((new Date[]{buildTime(2021, 11, 1),buildTime(2021, 12, 1)})); - // 调用 - PageResult pageResult = smsTemplateService.getSmsTemplatePage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbSmsTemplate, pageResult.getList().get(0)); + // 调用 + PageResult pageResult = smsTemplateService.getSmsTemplatePage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbSmsTemplate, pageResult.getList().get(0)); } @Test @@ -276,14 +275,13 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest { reqVO.setContent("芋道"); reqVO.setApiTemplateId("yu"); reqVO.setChannelId(1L); - reqVO.setBeginCreateTime(buildTime(2021, 11, 1)); - reqVO.setEndCreateTime(buildTime(2021, 12, 1)); + reqVO.setCreateTime((new Date[]{buildTime(2021, 11, 1),buildTime(2021, 12, 1)})); - // 调用 - List list = smsTemplateService.getSmsTemplateList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbSmsTemplate, list.get(0)); + // 调用 + List list = smsTemplateService.getSmsTemplateList(reqVO); + // 断言 + assertEquals(1, list.size()); + assertPojoEquals(dbSmsTemplate, list.get(0)); } @Test diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantPackageServiceImplTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantPackageServiceImplTest.java index 32ed34972..406920ed1 100755 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantPackageServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantPackageServiceImplTest.java @@ -15,6 +15,8 @@ import org.springframework.context.annotation.Import; import javax.annotation.Resource; +import java.util.Date; + import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; @@ -29,10 +31,10 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; /** -* {@link TenantPackageServiceImpl} 的单元测试类 -* -* @author 芋道源码 -*/ + * {@link TenantPackageServiceImpl} 的单元测试类 + * + * @author 芋道源码 + */ @Import(TenantPackageServiceImpl.class) public class TenantPackageServiceImplTest extends BaseDbUnitTest { @@ -106,8 +108,8 @@ public class TenantPackageServiceImplTest extends BaseDbUnitTest { // 调用 tenantPackageService.deleteTenantPackage(id); - // 校验数据不存在了 - assertNull(tenantPackageMapper.selectById(id)); + // 校验数据不存在了 + assertNull(tenantPackageMapper.selectById(id)); } @Test @@ -135,36 +137,35 @@ public class TenantPackageServiceImplTest extends BaseDbUnitTest { @Test public void testGetTenantPackagePage() { - // mock 数据 - TenantPackageDO dbTenantPackage = randomPojo(TenantPackageDO.class, o -> { // 等会查询到 - o.setName("芋道源码"); - o.setStatus(CommonStatusEnum.ENABLE.getStatus()); - o.setRemark("源码解析"); - o.setCreateTime(buildTime(2022, 10, 10)); - }); - tenantPackageMapper.insert(dbTenantPackage); - // 测试 name 不匹配 - tenantPackageMapper.insert(cloneIgnoreId(dbTenantPackage, o -> o.setName("源码"))); - // 测试 status 不匹配 - tenantPackageMapper.insert(cloneIgnoreId(dbTenantPackage, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); - // 测试 remark 不匹配 - tenantPackageMapper.insert(cloneIgnoreId(dbTenantPackage, o -> o.setRemark("解析"))); - // 测试 createTime 不匹配 - tenantPackageMapper.insert(cloneIgnoreId(dbTenantPackage, o -> o.setCreateTime(buildTime(2022, 11, 11)))); - // 准备参数 - TenantPackagePageReqVO reqVO = new TenantPackagePageReqVO(); - reqVO.setName("芋道"); - reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setRemark("源码"); - reqVO.setBeginCreateTime(buildTime(2022, 10, 9)); - reqVO.setEndCreateTime(buildTime(2022, 10, 11)); + // mock 数据 + TenantPackageDO dbTenantPackage = randomPojo(TenantPackageDO.class, o -> { // 等会查询到 + o.setName("芋道源码"); + o.setStatus(CommonStatusEnum.ENABLE.getStatus()); + o.setRemark("源码解析"); + o.setCreateTime(buildTime(2022, 10, 10)); + }); + tenantPackageMapper.insert(dbTenantPackage); + // 测试 name 不匹配 + tenantPackageMapper.insert(cloneIgnoreId(dbTenantPackage, o -> o.setName("源码"))); + // 测试 status 不匹配 + tenantPackageMapper.insert(cloneIgnoreId(dbTenantPackage, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); + // 测试 remark 不匹配 + tenantPackageMapper.insert(cloneIgnoreId(dbTenantPackage, o -> o.setRemark("解析"))); + // 测试 createTime 不匹配 + tenantPackageMapper.insert(cloneIgnoreId(dbTenantPackage, o -> o.setCreateTime(buildTime(2022, 11, 11)))); + // 准备参数 + TenantPackagePageReqVO reqVO = new TenantPackagePageReqVO(); + reqVO.setName("芋道"); + reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); + reqVO.setRemark("源码"); + reqVO.setCreateTime((new Date[]{buildTime(2022, 10, 9),buildTime(2022, 10, 11)})); - // 调用 - PageResult pageResult = tenantPackageService.getTenantPackagePage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - assertPojoEquals(dbTenantPackage, pageResult.getList().get(0)); + // 调用 + PageResult pageResult = tenantPackageService.getTenantPackagePage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + assertPojoEquals(dbTenantPackage, pageResult.getList().get(0)); } @Test diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImplTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImplTest.java index 61daa866f..1f7164e02 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImplTest.java @@ -31,6 +31,7 @@ import javax.annotation.Resource; import java.time.Duration; import java.util.Arrays; import java.util.Collections; +import java.util.Date; import java.util.List; import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet; @@ -311,8 +312,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest { reqVO.setContactName("艿"); reqVO.setContactMobile("1560"); reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setBeginCreateTime(buildTime(2020, 12, 1)); - reqVO.setEndCreateTime(buildTime(2020, 12, 24)); + reqVO.setCreateTime(new Date[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)}); // 调用 PageResult pageResult = tenantService.getTenantPage(reqVO); @@ -349,8 +349,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest { reqVO.setContactName("艿"); reqVO.setContactMobile("1560"); reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setBeginCreateTime(buildTime(2020, 12, 1)); - reqVO.setEndCreateTime(buildTime(2020, 12, 24)); + reqVO.setCreateTime(new Date[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)}); // 调用 List list = tenantService.getTenantList(reqVO); @@ -457,7 +456,7 @@ public class TenantServiceImplTest extends BaseDbUnitTest { TenantContextHolder.setTenantId(dbTenant.getId()); // mock 菜单 when(menuService.getMenus()).thenReturn(Arrays.asList(randomPojo(MenuDO.class, o -> o.setId(100L)), - randomPojo(MenuDO.class, o -> o.setId(101L)))); + randomPojo(MenuDO.class, o -> o.setId(101L)))); // 调用 tenantService.handleTenantMenu(handler); diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java index 4bacb2657..0884f8187 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImplTest.java @@ -33,6 +33,7 @@ import org.springframework.security.crypto.password.PasswordEncoder; import javax.annotation.Resource; import java.io.ByteArrayInputStream; import java.util.Collection; +import java.util.Date; import java.util.List; import java.util.function.Consumer; @@ -225,7 +226,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { ByteArrayInputStream avatarFile = new ByteArrayInputStream(avatarFileBytes); // mock 方法 String avatar = randomString(); - when(fileApi.createFile(eq(avatarFileBytes))).thenReturn(avatar); + when(fileApi.createFile(eq( avatarFileBytes))).thenReturn(avatar); // 调用 userService.updateUserAvatar(userId, avatarFile); @@ -294,8 +295,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { reqVO.setUsername("tu"); reqVO.setMobile("1560"); reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setBeginTime(buildTime(2020, 12, 1)); - reqVO.setEndTime(buildTime(2020, 12, 24)); + reqVO.setCreateTime((new Date[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)})); reqVO.setDeptId(1L); // 其中,1L 是 2L 的父部门 // mock 方法 List deptList = newArrayList(randomPojo(DeptDO.class, o -> o.setId(2L))); @@ -318,8 +318,7 @@ public class AdminUserServiceImplTest extends BaseDbUnitTest { reqVO.setUsername("tu"); reqVO.setMobile("1560"); reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setBeginTime(buildTime(2020, 12, 1)); - reqVO.setEndTime(buildTime(2020, 12, 24)); + reqVO.setCreateTime((new Date[]{buildTime(2020, 12, 1),buildTime(2020, 12, 24)})); reqVO.setDeptId(1L); // 其中,1L 是 2L 的父部门 // mock 方法 List deptList = newArrayList(randomPojo(DeptDO.class, o -> o.setId(2L)));