refactor: 时间区间查询传入数组
parent
55adb8efa9
commit
f1cf5f9f88
|
@ -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` 交易服务
|
||||
|
||||
启动文档,可见 <https://cloud.iocoder.cn/quick-start/> 地址。
|
||||
|
||||
----
|
||||
|
||||
# 前言
|
||||
|
||||
基于微服务的思想,构建在 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)
|
||||
|
||||
* 前端项目地址:<https://github.com/YunaiV/onemall-web>
|
||||
|
||||
# 演示
|
||||
|
||||
> 艿艿:目前的开发者,都是后端出身。所以,一帮没有审美自觉的人,撸出来的前端界面,可能是东半球倒数第二难看。
|
||||
>
|
||||
> 迫切希望,有前端能力不错的小伙伴,加入我们,一起来完善「芋道商城」。
|
||||
|
||||
## 管理后台
|
||||
|
||||
体验传送门:<http://dashboard.shop.iocoder.cn>
|
||||
|
||||
![GIF 图-耐心等待](https://raw.githubusercontent.com/YunaiV/Blog/master/Mall/onemall-admin-min.gif)
|
||||
|
||||
## H5 商城
|
||||
|
||||
体验传送门:<http://h5.shop.iocoder.cn>
|
||||
|
||||
*2M 带宽小水管,访问略微有点慢*
|
||||
|
||||
![GIF 图-耐心等待](https://raw.githubusercontent.com/YunaiV/Blog/master/Mall/onemall-h5-min.gif)
|
||||
|
||||
## 其它演示
|
||||
|
||||
下面,我们会提供目前用到的中间件的管理平台。
|
||||
|
||||
> 艿艿:考虑到大家可以看到更全的功能,所以一般提供 admin 账号。所以,大家素质使用哟。
|
||||
|
||||
**SkyWalking UI**
|
||||
|
||||
* 地址:<http://skywalking.shop.iocoder.cn>
|
||||
|
||||
> 教程:[《芋道 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**
|
||||
|
||||
* 地址:<http://rocketmq.shop.iocoder.cn>
|
||||
|
||||
> 教程:[《芋道 RocketMQ 安装部署》](http://www.iocoder.cn/RocketMQ/install/?onemall)
|
||||
|
||||
**XXL-Job Console**
|
||||
|
||||
* 地址:<http://xxl-job.shop.iocoder.cn>
|
||||
* 管理员账号:admin / 123456
|
||||
|
||||
> 教程:[《芋道 XXL-Job 安装部署》](http://www.iocoder.cn/XXL-JOB/install/?onemall)
|
||||
|
||||
**Sentinel Console**
|
||||
|
||||
* 地址:<http://sentinel.shop.iocoder.cn>
|
||||
* 账号: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
|
||||
|
||||
# 某种结尾
|
||||
|
||||
目前成员
|
||||
|
||||
* 小范
|
||||
* 芋艿
|
|
@ -2,14 +2,8 @@ package cn.iocoder.yudao.framework.common.util.collection;
|
|||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.TypeUtil;
|
||||
import org.springframework.cglib.core.TypeUtils;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
|
@ -53,4 +47,11 @@ public class ArrayUtils {
|
|||
return ArrayUtil.toArray(from, (Class<T>) CollectionUtil.getElementType(from.iterator()));
|
||||
}
|
||||
|
||||
public static <T> T get(T[] array, int index) {
|
||||
if (null == array || index >= array.length) {
|
||||
return null;
|
||||
}
|
||||
return array[index];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package cn.iocoder.yudao.framework.mybatis.core.query;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ArrayUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
@ -33,7 +33,7 @@ public class LambdaQueryWrapperX<T> extends LambdaQueryWrapper<T> {
|
|||
}
|
||||
|
||||
public LambdaQueryWrapperX<T> inIfPresent(SFunction<T, ?> column, Object... values) {
|
||||
if (!ArrayUtils.isEmpty(values)) {
|
||||
if (!ArrayUtil.isEmpty(values)) {
|
||||
return (LambdaQueryWrapperX<T>) super.in(column, values);
|
||||
}
|
||||
return this;
|
||||
|
@ -94,6 +94,12 @@ public class LambdaQueryWrapperX<T> extends LambdaQueryWrapper<T> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public LambdaQueryWrapperX<T> betweenIfPresent(SFunction<T, ?> column, Object[] values) {
|
||||
Object val1 = ArrayUtils.get(values, 0);
|
||||
Object val2 = ArrayUtils.get(values, 1);
|
||||
return betweenIfPresent(column, val1, val2);
|
||||
}
|
||||
|
||||
// ========== 重写父类方法,方便链式调用 ==========
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public interface CodegenTableMapper extends BaseMapperX<CodegenTableDO> {
|
|||
return selectPage(pageReqVO, new LambdaQueryWrapperX<CodegenTableDO>()
|
||||
.likeIfPresent(CodegenTableDO::getTableName, pageReqVO.getTableName())
|
||||
.likeIfPresent(CodegenTableDO::getTableComment, pageReqVO.getTableComment())
|
||||
.betweenIfPresent(CodegenTableDO::getCreateTime, pageReqVO.getBeginCreateTime(), pageReqVO.getEndCreateTime()));
|
||||
.betweenIfPresent(CodegenTableDO::getCreateTime, pageReqVO.getCreateTime()));
|
||||
}
|
||||
|
||||
default List<CodegenTableDO> selectListByDataSourceConfigId(Long dataSourceConfigId) {
|
||||
|
|
|
@ -22,7 +22,7 @@ public interface FileConfigMapper extends BaseMapperX<FileConfigDO> {
|
|||
return selectPage(reqVO, new LambdaQueryWrapperX<FileConfigDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ public interface FileMapper extends BaseMapperX<FileDO> {
|
|||
return selectPage(reqVO, new LambdaQueryWrapperX<FileDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package cn.iocoder.yudao.module.infra.dal.mysql.logger;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
@ -19,28 +19,28 @@ import java.util.List;
|
|||
public interface ApiAccessLogMapper extends BaseMapperX<ApiAccessLogDO> {
|
||||
|
||||
default PageResult<ApiAccessLogDO> selectPage(ApiAccessLogPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<ApiAccessLogDO>()
|
||||
.eqIfPresent("user_id", reqVO.getUserId())
|
||||
.eqIfPresent("user_type", reqVO.getUserType())
|
||||
.eqIfPresent("application_name", reqVO.getApplicationName())
|
||||
.likeIfPresent("request_url", reqVO.getRequestUrl())
|
||||
.betweenIfPresent("begin_time", reqVO.getBeginBeginTime(), reqVO.getEndBeginTime())
|
||||
.geIfPresent("duration", reqVO.getDuration())
|
||||
.eqIfPresent("result_code", reqVO.getResultCode())
|
||||
.orderByDesc("id")
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ApiAccessLogDO>()
|
||||
.eqIfPresent(ApiAccessLogDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(ApiAccessLogDO::getUserType, reqVO.getUserType())
|
||||
.eqIfPresent(ApiAccessLogDO::getApplicationName, reqVO.getApplicationName())
|
||||
.likeIfPresent(ApiAccessLogDO::getRequestUrl, reqVO.getRequestUrl())
|
||||
.betweenIfPresent(ApiAccessLogDO::getBeginTime, reqVO.getBeginTime())
|
||||
.geIfPresent(ApiAccessLogDO::getDuration, reqVO.getDuration())
|
||||
.eqIfPresent(ApiAccessLogDO::getResultCode, reqVO.getResultCode())
|
||||
.orderByDesc(ApiAccessLogDO::getId)
|
||||
);
|
||||
}
|
||||
|
||||
default List<ApiAccessLogDO> selectList(ApiAccessLogExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<ApiAccessLogDO>()
|
||||
.eqIfPresent("user_id", reqVO.getUserId())
|
||||
.eqIfPresent("user_type", reqVO.getUserType())
|
||||
.eqIfPresent("application_name", reqVO.getApplicationName())
|
||||
.likeIfPresent("request_url", reqVO.getRequestUrl())
|
||||
.betweenIfPresent("begin_time", reqVO.getBeginBeginTime(), reqVO.getEndBeginTime())
|
||||
.geIfPresent("duration", reqVO.getDuration())
|
||||
.eqIfPresent("result_code", reqVO.getResultCode())
|
||||
.orderByDesc("id")
|
||||
return selectList(new LambdaQueryWrapperX<ApiAccessLogDO>()
|
||||
.eqIfPresent(ApiAccessLogDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(ApiAccessLogDO::getUserType, reqVO.getUserType())
|
||||
.eqIfPresent(ApiAccessLogDO::getApplicationName, reqVO.getApplicationName())
|
||||
.likeIfPresent(ApiAccessLogDO::getRequestUrl, reqVO.getRequestUrl())
|
||||
.betweenIfPresent(ApiAccessLogDO::getBeginTime, reqVO.getBeginTime())
|
||||
.geIfPresent(ApiAccessLogDO::getDuration, reqVO.getDuration())
|
||||
.eqIfPresent(ApiAccessLogDO::getResultCode, reqVO.getResultCode())
|
||||
.orderByDesc(ApiAccessLogDO::getId)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.mysql.logger;
|
|||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO;
|
||||
|
@ -19,26 +19,26 @@ import java.util.List;
|
|||
public interface ApiErrorLogMapper extends BaseMapperX<ApiErrorLogDO> {
|
||||
|
||||
default PageResult<ApiErrorLogDO> selectPage(ApiErrorLogPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<ApiErrorLogDO>()
|
||||
.eqIfPresent("user_id", reqVO.getUserId())
|
||||
.eqIfPresent("user_type", reqVO.getUserType())
|
||||
.eqIfPresent("application_name", reqVO.getApplicationName())
|
||||
.likeIfPresent("request_url", reqVO.getRequestUrl())
|
||||
.betweenIfPresent("exception_time", reqVO.getBeginExceptionTime(), reqVO.getEndExceptionTime())
|
||||
.eqIfPresent("process_status", reqVO.getProcessStatus())
|
||||
.orderByDesc("id")
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ApiErrorLogDO>()
|
||||
.eqIfPresent(ApiErrorLogDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(ApiErrorLogDO::getUserType, reqVO.getUserType())
|
||||
.eqIfPresent(ApiErrorLogDO::getApplicationName, reqVO.getApplicationName())
|
||||
.likeIfPresent(ApiErrorLogDO::getRequestUrl, reqVO.getRequestUrl())
|
||||
.betweenIfPresent(ApiErrorLogDO::getExceptionTime, reqVO.getExceptionTime())
|
||||
.eqIfPresent(ApiErrorLogDO::getProcessStatus, reqVO.getProcessStatus())
|
||||
.orderByDesc(ApiErrorLogDO::getId)
|
||||
);
|
||||
}
|
||||
|
||||
default List<ApiErrorLogDO> selectList(ApiErrorLogExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<ApiErrorLogDO>()
|
||||
.eqIfPresent("user_id", reqVO.getUserId())
|
||||
.eqIfPresent("user_type", reqVO.getUserType())
|
||||
.eqIfPresent("application_name", reqVO.getApplicationName())
|
||||
.likeIfPresent("request_url", reqVO.getRequestUrl())
|
||||
.betweenIfPresent("exception_time", reqVO.getBeginExceptionTime(), reqVO.getEndExceptionTime())
|
||||
.eqIfPresent("process_status", reqVO.getProcessStatus())
|
||||
.orderByDesc("id")
|
||||
return selectList(new LambdaQueryWrapperX<ApiErrorLogDO>()
|
||||
.eqIfPresent(ApiErrorLogDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(ApiErrorLogDO::getUserType, reqVO.getUserType())
|
||||
.eqIfPresent(ApiErrorLogDO::getApplicationName, reqVO.getApplicationName())
|
||||
.likeIfPresent(ApiErrorLogDO::getRequestUrl, reqVO.getRequestUrl())
|
||||
.betweenIfPresent(ApiErrorLogDO::getExceptionTime, reqVO.getExceptionTime())
|
||||
.eqIfPresent(ApiErrorLogDO::getProcessStatus, reqVO.getProcessStatus())
|
||||
.orderByDesc(ApiErrorLogDO::getId)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public interface TestDemoMapper extends BaseMapperX<TestDemoDO> {
|
|||
.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<TestDemoDO> {
|
|||
.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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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<FileConfigDO> pageResult = fileConfigService.getFileConfigPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbFileConfig, pageResult.getList().get(0));
|
||||
// 调用
|
||||
PageResult<FileConfigDO> pageResult = fileConfigService.getFileConfigPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbFileConfig, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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<FileDO> pageResult = fileService.getFilePage(reqVO);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -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<TestDemoDO> 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<TestDemoDO> list = testDemoService.getTestDemoList(reqVO);
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<DictTypeDO> {
|
|||
.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<DictTypeDO> {
|
|||
.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) {
|
||||
|
|
|
@ -2,11 +2,10 @@ package cn.iocoder.yudao.module.system.dal.mysql.errorcode;
|
|||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.errorcode.vo.ErrorCodeExportReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.errorcode.vo.ErrorCodePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.errorcode.ErrorCodeDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -17,36 +16,36 @@ import java.util.List;
|
|||
public interface ErrorCodeMapper extends BaseMapperX<ErrorCodeDO> {
|
||||
|
||||
default PageResult<ErrorCodeDO> selectPage(ErrorCodePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<ErrorCodeDO>()
|
||||
.eqIfPresent("type", reqVO.getType())
|
||||
.likeIfPresent("application_name", reqVO.getApplicationName())
|
||||
.eqIfPresent("code", reqVO.getCode())
|
||||
.likeIfPresent("message", reqVO.getMessage())
|
||||
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||
.orderByDesc("code"));
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ErrorCodeDO>()
|
||||
.eqIfPresent(ErrorCodeDO::getType, reqVO.getType())
|
||||
.likeIfPresent(ErrorCodeDO::getApplicationName, reqVO.getApplicationName())
|
||||
.eqIfPresent(ErrorCodeDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(ErrorCodeDO::getMessage, reqVO.getMessage())
|
||||
.betweenIfPresent(ErrorCodeDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ErrorCodeDO::getCode));
|
||||
}
|
||||
|
||||
default List<ErrorCodeDO> selectList(ErrorCodeExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<ErrorCodeDO>()
|
||||
.eqIfPresent("type", reqVO.getType())
|
||||
.likeIfPresent("application_name", reqVO.getApplicationName())
|
||||
.eqIfPresent("code", reqVO.getCode())
|
||||
.likeIfPresent("message", reqVO.getMessage())
|
||||
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||
.orderByAsc("application_name", "code"));
|
||||
return selectList(new LambdaQueryWrapperX<ErrorCodeDO>()
|
||||
.eqIfPresent(ErrorCodeDO::getType, reqVO.getType())
|
||||
.likeIfPresent(ErrorCodeDO::getApplicationName, reqVO.getApplicationName())
|
||||
.eqIfPresent(ErrorCodeDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(ErrorCodeDO::getMessage, reqVO.getMessage())
|
||||
.betweenIfPresent(ErrorCodeDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ErrorCodeDO::getCode));
|
||||
}
|
||||
|
||||
default List<ErrorCodeDO> selectListByCodes(Collection<Integer> codes) {
|
||||
return selectList(new QueryWrapper<ErrorCodeDO>().in("code", codes));
|
||||
return selectList(new LambdaQueryWrapperX<ErrorCodeDO>().in(ErrorCodeDO::getCode, codes));
|
||||
}
|
||||
|
||||
default ErrorCodeDO selectByCode(Integer code) {
|
||||
return selectOne(new QueryWrapper<ErrorCodeDO>().eq("code", code));
|
||||
return selectOne(new LambdaQueryWrapperX<ErrorCodeDO>().eq(ErrorCodeDO::getCode, code));
|
||||
}
|
||||
|
||||
default List<ErrorCodeDO> selectListByApplicationNameAndUpdateTimeGt(String applicationName, Date minUpdateTime) {
|
||||
return selectList(new QueryWrapperX<ErrorCodeDO>().eq("application_name", applicationName)
|
||||
.gtIfPresent("update_time", minUpdateTime));
|
||||
return selectList(new LambdaQueryWrapperX<ErrorCodeDO>().eq(ErrorCodeDO::getApplicationName, applicationName)
|
||||
.gtIfPresent(ErrorCodeDO::getUpdateTime, minUpdateTime));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package cn.iocoder.yudao.module.system.dal.mysql.logger;
|
||||
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.logger.LoginLogDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.logger.LoginLogDO;
|
||||
import cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
@ -15,30 +15,30 @@ import java.util.List;
|
|||
public interface LoginLogMapper extends BaseMapperX<LoginLogDO> {
|
||||
|
||||
default PageResult<LoginLogDO> selectPage(LoginLogPageReqVO reqVO) {
|
||||
QueryWrapperX<LoginLogDO> query = new QueryWrapperX<LoginLogDO>()
|
||||
.likeIfPresent("user_ip", reqVO.getUserIp())
|
||||
.likeIfPresent("username", reqVO.getUsername())
|
||||
.betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime());
|
||||
LambdaQueryWrapperX<LoginLogDO> query = new LambdaQueryWrapperX<LoginLogDO>()
|
||||
.likeIfPresent(LoginLogDO::getUserIp, reqVO.getUserIp())
|
||||
.likeIfPresent(LoginLogDO::getUsername, reqVO.getUsername())
|
||||
.betweenIfPresent(LoginLogDO::getCreateTime, reqVO.getCreateTime());
|
||||
if (Boolean.TRUE.equals(reqVO.getStatus())) {
|
||||
query.eq("result", LoginResultEnum.SUCCESS.getResult());
|
||||
query.eq(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult());
|
||||
} else if (Boolean.FALSE.equals(reqVO.getStatus())) {
|
||||
query.gt("result", LoginResultEnum.SUCCESS.getResult());
|
||||
query.gt(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult());
|
||||
}
|
||||
query.orderByDesc("id"); // 降序
|
||||
query.orderByDesc(LoginLogDO::getId); // 降序
|
||||
return selectPage(reqVO, query);
|
||||
}
|
||||
|
||||
default List<LoginLogDO> selectList(LoginLogExportReqVO reqVO) {
|
||||
QueryWrapperX<LoginLogDO> query = new QueryWrapperX<LoginLogDO>()
|
||||
.likeIfPresent("user_ip", reqVO.getUserIp())
|
||||
.likeIfPresent("username", reqVO.getUsername())
|
||||
.betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime());
|
||||
LambdaQueryWrapperX<LoginLogDO> query = new LambdaQueryWrapperX<LoginLogDO>()
|
||||
.likeIfPresent(LoginLogDO::getUserIp, reqVO.getUserIp())
|
||||
.likeIfPresent(LoginLogDO::getUsername, reqVO.getUsername())
|
||||
.betweenIfPresent(LoginLogDO::getCreateTime, reqVO.getCreateTime());
|
||||
if (Boolean.TRUE.equals(reqVO.getStatus())) {
|
||||
query.eq("result", LoginResultEnum.SUCCESS.getResult());
|
||||
query.eq(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult());
|
||||
} else if (Boolean.FALSE.equals(reqVO.getStatus())) {
|
||||
query.gt("result", LoginResultEnum.SUCCESS.getResult());
|
||||
query.gt(LoginLogDO::getResult, LoginResultEnum.SUCCESS.getResult());
|
||||
}
|
||||
query.orderByDesc("id"); // 降序
|
||||
query.orderByDesc(LoginLogDO::getId); // 降序
|
||||
return selectList(query);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public interface OperateLogMapper extends BaseMapperX<OperateLogDO> {
|
|||
.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<OperateLogDO> {
|
|||
.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())) {
|
||||
|
|
|
@ -23,7 +23,7 @@ public interface RoleMapper extends BaseMapperX<RoleDO> {
|
|||
.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<RoleDO> {
|
|||
.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) {
|
||||
|
|
|
@ -25,7 +25,7 @@ public interface SensitiveWordMapper extends BaseMapperX<SensitiveWordDO> {
|
|||
.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<SensitiveWordDO> {
|
|||
.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));
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ public interface SmsChannelMapper extends BaseMapperX<SmsChannelDO> {
|
|||
return selectPage(reqVO, new LambdaQueryWrapperX<SmsChannelDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package cn.iocoder.yudao.module.system.dal.mysql.sms;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsLogDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -14,27 +14,27 @@ import java.util.List;
|
|||
public interface SmsLogMapper extends BaseMapperX<SmsLogDO> {
|
||||
|
||||
default PageResult<SmsLogDO> selectPage(SmsLogPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new QueryWrapperX<SmsLogDO>()
|
||||
.eqIfPresent("channel_id", reqVO.getChannelId())
|
||||
.eqIfPresent("template_id", reqVO.getTemplateId())
|
||||
.likeIfPresent("mobile", reqVO.getMobile())
|
||||
.eqIfPresent("send_status", reqVO.getSendStatus())
|
||||
.betweenIfPresent("send_time", reqVO.getBeginSendTime(), reqVO.getEndSendTime())
|
||||
.eqIfPresent("receive_status", reqVO.getReceiveStatus())
|
||||
.betweenIfPresent("receive_time", reqVO.getBeginReceiveTime(), reqVO.getEndReceiveTime())
|
||||
.orderByDesc("id"));
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<SmsLogDO>()
|
||||
.eqIfPresent(SmsLogDO::getChannelId, reqVO.getChannelId())
|
||||
.eqIfPresent(SmsLogDO::getTemplateId, reqVO.getTemplateId())
|
||||
.likeIfPresent(SmsLogDO::getMobile, reqVO.getMobile())
|
||||
.eqIfPresent(SmsLogDO::getSendStatus, reqVO.getSendStatus())
|
||||
.betweenIfPresent(SmsLogDO::getSendTime, reqVO.getSendTime())
|
||||
.eqIfPresent(SmsLogDO::getSendStatus, reqVO.getReceiveStatus())
|
||||
.betweenIfPresent(SmsLogDO::getReceiveTime, reqVO.getReceiveTime())
|
||||
.orderByDesc(SmsLogDO::getId));
|
||||
}
|
||||
|
||||
default List<SmsLogDO> selectList(SmsLogExportReqVO reqVO) {
|
||||
return selectList(new QueryWrapperX<SmsLogDO>()
|
||||
.eqIfPresent("channel_id", reqVO.getChannelId())
|
||||
.eqIfPresent("template_id", reqVO.getTemplateId())
|
||||
.likeIfPresent("mobile", reqVO.getMobile())
|
||||
.eqIfPresent("send_status", reqVO.getSendStatus())
|
||||
.betweenIfPresent("send_time", reqVO.getBeginSendTime(), reqVO.getEndSendTime())
|
||||
.eqIfPresent("receive_status", reqVO.getReceiveStatus())
|
||||
.betweenIfPresent("receive_time", reqVO.getBeginReceiveTime(), reqVO.getEndReceiveTime())
|
||||
.orderByDesc("id"));
|
||||
return selectList(new LambdaQueryWrapperX<SmsLogDO>()
|
||||
.eqIfPresent(SmsLogDO::getChannelId, reqVO.getChannelId())
|
||||
.eqIfPresent(SmsLogDO::getTemplateId, reqVO.getTemplateId())
|
||||
.likeIfPresent(SmsLogDO::getMobile, reqVO.getMobile())
|
||||
.eqIfPresent(SmsLogDO::getSendStatus, reqVO.getSendStatus())
|
||||
.betweenIfPresent(SmsLogDO::getSendTime, reqVO.getSendTime())
|
||||
.eqIfPresent(SmsLogDO::getSendStatus, reqVO.getReceiveStatus())
|
||||
.betweenIfPresent(SmsLogDO::getReceiveTime, reqVO.getReceiveTime())
|
||||
.orderByDesc(SmsLogDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public interface SmsTemplateMapper extends BaseMapperX<SmsTemplateDO> {
|
|||
.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<SmsTemplateDO> {
|
|||
.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));
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public interface TenantMapper extends BaseMapperX<TenantDO> {
|
|||
.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<TenantDO> {
|
|||
.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));
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public interface TenantPackageMapper extends BaseMapperX<TenantPackageDO> {
|
|||
.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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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<AdminUserDO> {
|
|||
.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<AdminUserDO> selectList(UserExportReqVO reqVO, Collection<Long> deptIds) {
|
||||
|
@ -44,7 +42,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
|||
.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<AdminUserDO> {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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<DictTypeDO> pageResult = dictTypeService.getDictTypePage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbDictType, pageResult.getList().get(0));
|
||||
// 调用
|
||||
PageResult<DictTypeDO> 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<DictTypeDO> list = dictTypeService.getDictTypeList(reqVO);
|
||||
|
|
|
@ -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<ErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbErrorCode, pageResult.getList().get(0));
|
||||
// 调用
|
||||
PageResult<ErrorCodeDO> 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<ErrorCodeDO> 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 方法
|
||||
|
||||
// 调用
|
||||
|
|
|
@ -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<LoginLogDO> 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<LoginLogDO> loginLogList = loginLogService.getLoginLogList(reqVO);
|
||||
|
|
|
@ -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 方法
|
||||
|
|
|
@ -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<RoleDO> 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<RoleDO> pageResult = roleService.getRolePage(reqVO);
|
||||
|
|
|
@ -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<SensitiveWordDO> 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<SensitiveWordDO> list = sensitiveWordService.getSensitiveWordList(reqVO);
|
||||
|
|
|
@ -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<SmsChannelDO> pageResult = smsChannelService.getSmsChannelPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbSmsChannel, pageResult.getList().get(0));
|
||||
// 调用
|
||||
PageResult<SmsChannelDO> pageResult = smsChannelService.getSmsChannelPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbSmsChannel, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
// ========== 随机对象 ==========
|
||||
|
|
|
@ -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<SmsLogDO> pageResult = smsLogService.getSmsLogPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbSmsLog, pageResult.getList().get(0));
|
||||
// 调用
|
||||
PageResult<SmsLogDO> 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<SmsLogDO> list = smsLogService.getSmsLogList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbSmsLog, list.get(0));
|
||||
// 调用
|
||||
List<SmsLogDO> list = smsLogService.getSmsLogList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbSmsLog, list.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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<SmsTemplateDO> pageResult = smsTemplateService.getSmsTemplatePage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbSmsTemplate, pageResult.getList().get(0));
|
||||
// 调用
|
||||
PageResult<SmsTemplateDO> 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<SmsTemplateDO> list = smsTemplateService.getSmsTemplateList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbSmsTemplate, list.get(0));
|
||||
// 调用
|
||||
List<SmsTemplateDO> list = smsTemplateService.getSmsTemplateList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbSmsTemplate, list.get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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<TenantPackageDO> pageResult = tenantPackageService.getTenantPackagePage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbTenantPackage, pageResult.getList().get(0));
|
||||
// 调用
|
||||
PageResult<TenantPackageDO> pageResult = tenantPackageService.getTenantPackagePage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbTenantPackage, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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<TenantDO> 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<TenantDO> 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);
|
||||
|
|
|
@ -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<DeptDO> 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<DeptDO> deptList = newArrayList(randomPojo(DeptDO.class, o -> o.setId(2L)));
|
||||
|
|
Loading…
Reference in New Issue