refactor: 时间区间查询传入数组-测试模块

This commit is contained in:
xingyu 2022-07-22 10:24:59 +08:00
parent dad10d858a
commit f84f3a3631
31 changed files with 92 additions and 153 deletions

View File

@ -17,6 +17,9 @@ 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.module.bpm.enums.ErrorCodeConstants.USER_GROUP_NOT_EXISTS;
@ -116,8 +119,7 @@ public class BpmUserGroupServiceTest extends BaseDbUnitTest {
BpmUserGroupPageReqVO reqVO = new BpmUserGroupPageReqVO();
reqVO.setName("源码");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
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<BpmUserGroupDO> pageResult = userGroupService.getUserGroupPage(reqVO);

View File

@ -51,8 +51,7 @@ import static org.mockito.Mockito.*;
#if (${column.listOperation})
#set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
#if (${column.listOperationCondition} == "BETWEEN")## BETWEEN 的情况
reqVO.setBegin${JavaField}(null);
reqVO.setEnd${JavaField}(null);
reqVO.set${JavaField}((new Date[]{}));
#else
reqVO.set$JavaField(null);
#end

View File

@ -30,9 +30,9 @@
<el-date-picker clearable v-model="queryParams.${javaField}" type="date" value-format="yyyy-MM-dd" placeholder="选择${comment}" />
</el-form-item>
#else## 范围
<el-form-item label="${comment}">
<el-date-picker v-model="dateRange${AttrName}" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
<el-form-item label="${comment}" prop="${javaField}">
<el-date-picker v-model="queryParams.${javaField}" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
</el-form-item>
#end
#end
@ -234,6 +234,9 @@ export default {
#foreach ($column in $columns)
#if ($column.listOperation && $column.listOperationCondition != 'BETWEEN')
$column.javaField: null,
#else if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
$column.javaField: [],
#end
#end
#end
},
@ -257,18 +260,8 @@ export default {
/** 查询列表 */
getList() {
this.loading = true;
// 处理查询参数
let params = {...this.queryParams};
#foreach ($column in $columns)
#if ($column.listOperation)
#if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
#set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
this.addBeginAndEndTime(params, this.dateRange${AttrName}, '${column.javaField}');
#end
#end
#end
// 执行查询
get${simpleClassName}Page(params).then(response => {
get${simpleClassName}Page(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
@ -301,14 +294,6 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
#foreach ($column in $columns)
#if ($column.listOperation)
#if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
#set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
this.dateRange${AttrName} = [];
#end
#end
#end
this.resetForm("queryForm");
this.handleQuery();
},
@ -377,15 +362,6 @@ export default {
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
#foreach ($column in $columns)
#if ($column.listOperation)
#if ($column.htmlType == "datetime" && $column.listOperationCondition == "BETWEEN")
#set ($AttrName = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
this.addBeginAndEndTime(params, this.dateRange${AttrName}, '${column.javaField}');
#end
#end
#end
// 执行导出
this.#[[$modal]]#.confirm('是否确认导出所有${table.classComment}数据项?').then(() => {
this.exportLoading = true;
return export${simpleClassName}Excel(params);

View File

@ -19,6 +19,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;
@ -180,8 +181,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
reqVO.setName("");
reqVO.setKey("nai");
reqVO.setType(ConfigTypeEnum.SYSTEM.getType());
reqVO.setBeginTime(buildTime(2021, 1, 15));
reqVO.setEndTime(buildTime(2021, 2, 15));
reqVO.setCreateTime((new Date[]{buildTime(2021, 1, 15),buildTime(2021, 2, 15)}));
// 调用
PageResult<ConfigDO> pageResult = configService.getConfigPage(reqVO);
@ -214,8 +214,7 @@ public class ConfigServiceTest extends BaseDbUnitTest {
reqVO.setName("");
reqVO.setKey("nai");
reqVO.setType(ConfigTypeEnum.SYSTEM.getType());
reqVO.setBeginTime(buildTime(2021, 1, 15));
reqVO.setEndTime(buildTime(2021, 2, 15));
reqVO.setCreateTime((new Date[]{buildTime(2021, 1, 15),buildTime(2021, 2, 15)}));
// 调用
List<ConfigDO> list = configService.getConfigList(reqVO);

View File

@ -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;
@ -216,8 +217,7 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest {
FileConfigPageReqVO reqVO = new FileConfigPageReqVO();
reqVO.setName("芋道");
reqVO.setStorage(FileStorageEnum.LOCAL.getStorage());
reqVO.setBeginCreateTime(buildTime(2022, 11, 10));
reqVO.setEndCreateTime(buildTime(2022, 11, 12));
reqVO.setCreateTime((new Date[]{buildTime(2022, 11, 10),buildTime(2022, 11, 12)}));
// 调用
PageResult<FileConfigDO> pageResult = fileConfigService.getFileConfigPage(reqVO);

View File

@ -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);

View File

@ -77,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);
@ -135,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);

View File

@ -77,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方法
@ -130,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方法

View File

@ -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);

View File

@ -139,18 +139,13 @@ public class ActivityServiceImplTest extends BaseDbUnitTest {
reqVO.setTitle(null);
reqVO.setActivityType(null);
reqVO.setStatus(null);
reqVO.setBeginStartTime(null);
reqVO.setEndStartTime(null);
reqVO.setBeginEndTime(null);
reqVO.setEndEndTime(null);
reqVO.setBeginInvalidTime(null);
reqVO.setEndInvalidTime(null);
reqVO.setBeginDeleteTime(null);
reqVO.setEndDeleteTime(null);
reqVO.setStartTime(null);
reqVO.setEndTime(null);
reqVO.setInvalidTime(null);
reqVO.setDeleteTime(null);
reqVO.setTimeLimitedDiscount(null);
reqVO.setFullPrivilege(null);
reqVO.setBeginCreateTime(null);
reqVO.setEndCreateTime(null);
reqVO.setCreateTime(null);
// 调用
PageResult<ActivityDO> pageResult = activityService.getActivityPage(reqVO);

View File

@ -127,8 +127,7 @@ public class BrandServiceImplTest extends BaseDbUnitTest {
reqVO.setCategoryId(null);
reqVO.setName(null);
reqVO.setStatus(null);
reqVO.setBeginCreateTime(null);
reqVO.setEndCreateTime(null);
reqVO.setCreateTime((new Date[]{}));
// 调用
PageResult<BrandDO> pageResult = brandService.getBrandPage(reqVO);
@ -162,8 +161,7 @@ public class BrandServiceImplTest extends BaseDbUnitTest {
reqVO.setCategoryId(null);
reqVO.setName(null);
reqVO.setStatus(null);
reqVO.setBeginCreateTime(null);
reqVO.setEndCreateTime(null);
reqVO.setCreateTime((new Date[]{}));
// 调用
List<BrandDO> list = brandService.getBrandList(reqVO);

View File

@ -135,8 +135,7 @@ public class CategoryServiceImplTest extends BaseDbUnitTest {
CategoryPageReqVO reqVO = new CategoryPageReqVO();
reqVO.setName(null);
reqVO.setStatus(null);
reqVO.setBeginCreateTime(null);
reqVO.setEndCreateTime(null);
reqVO.setCreateTime(null);
// 调用
PageResult<CategoryDO> pageResult = categoryService.getCategoryPage(reqVO);
@ -181,8 +180,7 @@ public class CategoryServiceImplTest extends BaseDbUnitTest {
CategoryExportReqVO reqVO = new CategoryExportReqVO();
reqVO.setName(null);
reqVO.setStatus(null);
reqVO.setBeginCreateTime(null);
reqVO.setEndCreateTime(null);
reqVO.setCreateTime(null);
// 调用
List<CategoryDO> list = categoryService.getCategoryList(reqVO);

View File

@ -147,8 +147,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest {
reqVO.setBarCode(null);
reqVO.setPicUrl(null);
reqVO.setStatus(null);
reqVO.setBeginCreateTime(null);
reqVO.setEndCreateTime(null);
reqVO.setCreateTime(null);
// 调用
PageResult<ProductSkuDO> pageResult = ProductSkuService.getSkuPage(reqVO);
@ -202,8 +201,7 @@ public class SkuServiceImplTest extends BaseDbUnitTest {
reqVO.setBarCode(null);
reqVO.setPicUrl(null);
reqVO.setStatus(null);
reqVO.setBeginCreateTime(null);
reqVO.setEndCreateTime(null);
reqVO.setCreateTime(null);
// 调用
List<ProductSkuDO> list = ProductSkuService.getSkuList(reqVO);

View File

@ -155,8 +155,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
reqVO.setPrice(null);
reqVO.setQuantity(null);
reqVO.setStatus(null);
reqVO.setBeginCreateTime(null);
reqVO.setEndCreateTime(null);
reqVO.setCreateTime(null);
// 调用
PageResult<SpuRespVO> pageResult = spuService.getSpuPage(reqVO);
@ -218,8 +217,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
reqVO.setPrice(null);
reqVO.setQuantity(null);
reqVO.setStatus(null);
reqVO.setBeginCreateTime(null);
reqVO.setEndCreateTime(null);
reqVO.setCreateTime(null);
// 调用
List<ProductSpuDO> list = spuService.getSpuList(reqVO);

View File

@ -19,6 +19,7 @@ import org.springframework.context.annotation.Import;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime;
@ -162,8 +163,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
reqVO.setPayNotifyUrl("https://www.hc.com");
reqVO.setRefundNotifyUrl("https://www.xm.com");
reqVO.setMerchantName(dbMerchant.getName());
reqVO.setBeginCreateTime(buildTime(2021,11,19));
reqVO.setEndCreateTime(buildTime(2021,11,21));
reqVO.setCreateTime((new Date[]{buildTime(2021,11,19),buildTime(2021,11,21)}));
// 调用
PageResult<PayAppDO> pageResult = appService.getAppPage(reqVO);
@ -226,8 +226,7 @@ public class PayAppServiceTest extends BaseDbUnitTest {
reqVO.setPayNotifyUrl("https://www.hc.com");
reqVO.setRefundNotifyUrl("https://www.xm.com");
reqVO.setMerchantName(dbMerchant.getName());
reqVO.setBeginCreateTime(buildTime(2021,11,19));
reqVO.setEndCreateTime(buildTime(2021,11,21));
reqVO.setCreateTime((new Date[]{buildTime(2021,11,19),buildTime(2021,11,21)}));
// 调用
List<PayAppDO> list = appService.getAppList(reqVO);

View File

@ -20,6 +20,7 @@ import org.springframework.context.annotation.Import;
import javax.annotation.Resource;
import javax.validation.Validator;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime;
@ -263,8 +264,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
reqVO.setMerchantId(1L);
reqVO.setAppId(1L);
reqVO.setConfig(JSON.toJSONString(payClientConfig));
reqVO.setBeginCreateTime(buildTime(2021,11,19));
reqVO.setEndCreateTime(buildTime(2021,11,21));
reqVO.setCreateTime((new Date[]{buildTime(2021,11,19),buildTime(2021,11,21)}));
// 调用
PageResult<PayChannelDO> pageResult = channelService.getChannelPage(reqVO);
@ -337,8 +337,7 @@ public class PayChannelServiceTest extends BaseDbUnitTest {
reqVO.setMerchantId(1L);
reqVO.setAppId(1L);
reqVO.setConfig(JSON.toJSONString(payClientConfig));
reqVO.setBeginCreateTime(buildTime(2021,11,19));
reqVO.setEndCreateTime(buildTime(2021,11,21));
reqVO.setCreateTime((new Date[]{buildTime(2021,11,19),buildTime(2021,11,21)}));
// 调用
List<PayChannelDO> list = channelService.getChannelList(reqVO);

View File

@ -14,6 +14,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.iocoder.yudao.framework.common.util.date.DateUtils.buildTime;
@ -137,8 +138,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
reqVO.setShortName("灿灿子");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setRemark("灿哥的杂货铺");
reqVO.setBeginCreateTime(buildTime(2021,11,2));
reqVO.setEndCreateTime(buildTime(2021,11,4));
reqVO.setCreateTime((new Date[]{buildTime(2021,11,2),buildTime(2021,11,4)}));
// 调用
PageResult<PayMerchantDO> pageResult = merchantService.getMerchantPage(reqVO);
@ -179,8 +179,7 @@ public class PayMerchantServiceTest extends BaseDbUnitTest {
reqVO.setShortName("灿灿子");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setRemark("灿哥的杂货铺");
reqVO.setBeginCreateTime(buildTime(2021,11,2));
reqVO.setEndCreateTime(buildTime(2021,11,4));
reqVO.setCreateTime((new Date[]{buildTime(2021,11,2),buildTime(2021,11,4)}));
// 调用
List<PayMerchantDO> list = merchantService.getMerchantList(reqVO);

View File

@ -26,6 +26,7 @@ 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.RandomUtils.randomPojo;
@ -124,9 +125,7 @@ public class PayOrderServiceTest extends BaseDbUnitTest {
reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
reqVO.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
reqVO.setRefundStatus(PayRefundTypeEnum.NO.getStatus());
reqVO.setBeginCreateTime(DateUtils.buildTime(2018, 1, 1, 10, 1, 0));
reqVO.setEndCreateTime(DateUtils.buildTime(2018, 1, 1, 10, 1, 0));
reqVO.setCreateTime((new Date[]{buildTime(2018, 1, 1, 10, 1, 0),buildTime(2018, 1, 1, 10, 1, 0)}));
// 调用
PageResult<PayOrderDO> pageResult = orderService.getOrderPage(reqVO);
// 断言
@ -199,8 +198,7 @@ public class PayOrderServiceTest extends BaseDbUnitTest {
reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
reqVO.setStatus(PayOrderStatusEnum.SUCCESS.getStatus());
reqVO.setRefundStatus(PayRefundTypeEnum.NO.getStatus());
reqVO.setBeginCreateTime(DateUtils.buildTime(2018, 1, 1, 10, 1, 0));
reqVO.setEndCreateTime(DateUtils.buildTime(2018, 1, 1, 10, 1, 0));
reqVO.setCreateTime((new Date[]{buildTime(2018, 1, 1, 10, 1, 0),buildTime(2018, 1, 1, 10, 1, 0)}));
// 调用
List<PayOrderDO> list = orderService.getOrderList(reqVO);

View File

@ -22,8 +22,10 @@ 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 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.RandomUtils.randomPojo;
@ -110,9 +112,7 @@ public class PayRefundServiceTest extends BaseDbUnitTest {
reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
reqVO.setStatus(PayRefundStatusEnum.SUCCESS.getStatus());
reqVO.setType(PayRefundTypeEnum.SOME.getStatus());
reqVO.setBeginCreateTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 10));
reqVO.setEndCreateTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 12));
reqVO.setCreateTime((new Date[]{buildTime(2021, 1, 1, 10, 10, 10),buildTime(2021, 1, 1, 10, 10, 12)}));
// 调用
PageResult<PayRefundDO> pageResult = refundService.getRefundPage(reqVO);
@ -182,8 +182,7 @@ public class PayRefundServiceTest extends BaseDbUnitTest {
reqVO.setNotifyStatus(PayOrderNotifyStatusEnum.SUCCESS.getStatus());
reqVO.setStatus(PayRefundStatusEnum.SUCCESS.getStatus());
reqVO.setType(PayRefundTypeEnum.SOME.getStatus());
reqVO.setBeginCreateTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 10));
reqVO.setEndCreateTime(DateUtils.buildTime(2021, 1, 1, 10, 10, 12));
reqVO.setCreateTime((new Date[]{buildTime(2021, 1, 1, 10, 10, 10),buildTime(2021, 1, 1, 10, 10, 12)}));
// 调用
List<PayRefundDO> list = refundService.getRefundList(reqVO);

View File

@ -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;
@ -63,8 +64,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)}));
// 调用
PageResult<DictTypeDO> pageResult = dictTypeService.getDictTypePage(reqVO);
@ -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);

View File

@ -17,6 +17,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 java.util.function.Consumer;
@ -95,8 +96,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)}));
// 调用
PageResult<ErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(reqVO);
@ -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);

View File

@ -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);

View File

@ -24,6 +24,7 @@ import org.springframework.context.annotation.Import;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import static cn.hutool.core.util.RandomUtil.randomEle;
@ -103,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方法
@ -155,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 方法

View File

@ -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);

View File

@ -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);

View File

@ -172,8 +172,7 @@ public class SmsChannelServiceTest extends BaseDbUnitTest {
SmsChannelPageReqVO reqVO = new SmsChannelPageReqVO();
reqVO.setSignature("芋道");
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<SmsChannelDO> pageResult = smsChannelService.getSmsChannelPage(reqVO);

View File

@ -74,11 +74,9 @@ 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)}));
// 调用
PageResult<SmsLogDO> pageResult = smsLogService.getSmsLogPage(reqVO);
@ -121,11 +119,9 @@ 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);

View File

@ -230,8 +230,7 @@ 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)}));
// 调用
PageResult<SmsTemplateDO> pageResult = smsTemplateService.getSmsTemplatePage(reqVO);
@ -276,8 +275,7 @@ 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);

View File

@ -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;
@ -156,8 +158,7 @@ public class TenantPackageServiceImplTest extends BaseDbUnitTest {
reqVO.setName("芋道");
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
reqVO.setRemark("源码");
reqVO.setBeginCreateTime(buildTime(2022, 10, 9));
reqVO.setEndCreateTime(buildTime(2022, 10, 11));
reqVO.setCreateTime((new Date[]{buildTime(2022, 10, 9),buildTime(2022, 10, 11)}));
// 调用
PageResult<TenantPackageDO> pageResult = tenantPackageService.getTenantPackagePage(reqVO);

View File

@ -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);

View File

@ -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;
@ -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)));