From 05374216552e0178ebb04f6ce37e49aae42bddf8 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 1 Feb 2023 07:34:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=20DictDataServiceImpl=20?= =?UTF-8?q?=E5=8D=95=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BpmTaskAssignRuleServiceImpl.java | 2 +- .../module/system/api/dict/DictDataApi.java | 2 +- .../system/api/dict/DictDataApiImpl.java | 4 +- .../admin/dict/DictDataController.java | 4 +- .../system/service/dict/DictDataService.java | 6 +- .../service/dict/DictDataServiceImpl.java | 27 ++- ...Test.java => DictDataServiceImplTest.java} | 170 +++++++++++++++--- 7 files changed, 166 insertions(+), 49 deletions(-) rename yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/dict/{DictDataServiceTest.java => DictDataServiceImplTest.java} (55%) diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmTaskAssignRuleServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmTaskAssignRuleServiceImpl.java index bc8cd3151..742489e41 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmTaskAssignRuleServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmTaskAssignRuleServiceImpl.java @@ -224,7 +224,7 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService { } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.USER_GROUP.getType())) { userGroupService.validUserGroups(options); } else if (Objects.equals(type, BpmTaskAssignRuleTypeEnum.SCRIPT.getType())) { - dictDataApi.validDictDatas(DictTypeConstants.TASK_ASSIGN_SCRIPT, + dictDataApi.validateDictDataList(DictTypeConstants.TASK_ASSIGN_SCRIPT, CollectionUtils.convertSet(options, String::valueOf)); } else { throw new IllegalArgumentException(format("未知的规则类型({})", type)); diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApi.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApi.java index 5ba3dfd75..3bc28c89e 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApi.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApi.java @@ -19,7 +19,7 @@ public interface DictDataApi { * @param dictType 字典类型 * @param values 字典数据值的数组 */ - void validDictDatas(String dictType, Collection values); + void validateDictDataList(String dictType, Collection values); /** * 获得指定的字典数据,从缓存中 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java index 7de1a43b3..e88771fa7 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dict/DictDataApiImpl.java @@ -21,8 +21,8 @@ public class DictDataApiImpl implements DictDataApi { private DictDataService dictDataService; @Override - public void validDictDatas(String dictType, Collection values) { - dictDataService.validDictDatas(dictType, values); + public void validateDictDataList(String dictType, Collection values) { + dictDataService.validateDictDataList(dictType, values); } @Override diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java index 124e5fd05..4b14be80e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java @@ -62,7 +62,7 @@ public class DictDataController { @ApiOperation(value = "获得全部字典数据列表", notes = "一般用于管理后台缓存字典数据在本地") // 无需添加权限认证,因为前端全局都需要 public CommonResult> getSimpleDictDatas() { - List list = dictDataService.getDictDatas(); + List list = dictDataService.getDictDataList(); return success(DictDataConvert.INSTANCE.convertList(list)); } @@ -86,7 +86,7 @@ public class DictDataController { @PreAuthorize("@ss.hasPermission('system:dict:export')") @OperateLog(type = EXPORT) public void export(HttpServletResponse response, @Valid DictDataExportReqVO reqVO) throws IOException { - List list = dictDataService.getDictDatas(reqVO); + List list = dictDataService.getDictDataList(reqVO); List data = DictDataConvert.INSTANCE.convertList02(list); // 输出 ExcelUtils.write(response, "字典数据.xls", "数据列表", DictDataExcelVO.class, data); diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java index 610fe2a33..d2eb8c519 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java @@ -44,7 +44,7 @@ public interface DictDataService { * * @return 字典数据全列表 */ - List getDictDatas(); + List getDictDataList(); /** * 获得字典数据分页列表 @@ -60,7 +60,7 @@ public interface DictDataService { * @param reqVO 列表请求 * @return 字典数据列表 */ - List getDictDatas(DictDataExportReqVO reqVO); + List getDictDataList(DictDataExportReqVO reqVO); /** * 获得字典数据详情 @@ -86,7 +86,7 @@ public interface DictDataService { * @param dictType 字典类型 * @param values 字典数据值的数组 */ - void validDictDatas(String dictType, Collection values); + void validateDictDataList(String dictType, Collection values); /** * 获得指定的字典数据 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java index 0cfdb2b99..eccd2c219 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java @@ -48,7 +48,7 @@ public class DictDataServiceImpl implements DictDataService { private DictDataMapper dictDataMapper; @Override - public List getDictDatas() { + public List getDictDataList() { List list = dictDataMapper.selectList(); list.sort(COMPARATOR_TYPE_AND_SORT); return list; @@ -60,7 +60,7 @@ public class DictDataServiceImpl implements DictDataService { } @Override - public List getDictDatas(DictDataExportReqVO reqVO) { + public List getDictDataList(DictDataExportReqVO reqVO) { List list = dictDataMapper.selectList(reqVO); list.sort(COMPARATOR_TYPE_AND_SORT); return list; @@ -74,7 +74,7 @@ public class DictDataServiceImpl implements DictDataService { @Override public Long createDictData(DictDataCreateReqVO reqVO) { // 校验正确性 - checkCreateOrUpdate(null, reqVO.getValue(), reqVO.getDictType()); + validateDictDataForCreateOrUpdate(null, reqVO.getValue(), reqVO.getDictType()); // 插入字典类型 DictDataDO dictData = DictDataConvert.INSTANCE.convert(reqVO); @@ -85,7 +85,7 @@ public class DictDataServiceImpl implements DictDataService { @Override public void updateDictData(DictDataUpdateReqVO reqVO) { // 校验正确性 - checkCreateOrUpdate(reqVO.getId(), reqVO.getValue(), reqVO.getDictType()); + validateDictDataForCreateOrUpdate(reqVO.getId(), reqVO.getValue(), reqVO.getDictType()); // 更新字典类型 DictDataDO updateObj = DictDataConvert.INSTANCE.convert(reqVO); @@ -95,7 +95,7 @@ public class DictDataServiceImpl implements DictDataService { @Override public void deleteDictData(Long id) { // 校验是否存在 - checkDictDataExists(id); + validateDictDataExists(id); // 删除字典数据 dictDataMapper.deleteById(id); @@ -106,18 +106,17 @@ public class DictDataServiceImpl implements DictDataService { return dictDataMapper.selectCountByDictType(dictType); } - - private void checkCreateOrUpdate(Long id, String value, String dictType) { + private void validateDictDataForCreateOrUpdate(Long id, String value, String dictType) { // 校验自己存在 - checkDictDataExists(id); + validateDictDataExists(id); // 校验字典类型有效 - checkDictTypeValid(dictType); + validateDictTypeExists(dictType); // 校验字典数据的值的唯一性 - checkDictDataValueUnique(id, dictType, value); + validateDictDataValueUnique(id, dictType, value); } @VisibleForTesting - public void checkDictDataValueUnique(Long id, String dictType, String value) { + public void validateDictDataValueUnique(Long id, String dictType, String value) { DictDataDO dictData = dictDataMapper.selectByDictTypeAndValue(dictType, value); if (dictData == null) { return; @@ -132,7 +131,7 @@ public class DictDataServiceImpl implements DictDataService { } @VisibleForTesting - public void checkDictDataExists(Long id) { + public void validateDictDataExists(Long id) { if (id == null) { return; } @@ -143,7 +142,7 @@ public class DictDataServiceImpl implements DictDataService { } @VisibleForTesting - public void checkDictTypeValid(String type) { + public void validateDictTypeExists(String type) { DictTypeDO dictType = dictTypeService.getDictType(type); if (dictType == null) { throw exception(DICT_TYPE_NOT_EXISTS); @@ -154,7 +153,7 @@ public class DictDataServiceImpl implements DictDataService { } @Override - public void validDictDatas(String dictType, Collection values) { + public void validateDictDataList(String dictType, Collection values) { if (CollUtil.isEmpty(values)) { return; } diff --git a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceTest.java b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImplTest.java similarity index 55% rename from yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceTest.java rename to yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImplTest.java index 02fba6c21..1e4dc9f90 100644 --- a/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceTest.java +++ b/yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImplTest.java @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.service.dict; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; 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.controller.admin.dict.vo.data.DictDataCreateReqVO; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataExportReqVO; @@ -20,16 +19,18 @@ import javax.annotation.Resource; import java.util.List; import java.util.function.Consumer; +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; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; +import static java.util.Collections.singletonList; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; @Import(DictDataServiceImpl.class) -public class DictDataServiceTest extends BaseDbUnitTest { +public class DictDataServiceImplTest extends BaseDbUnitTest { @Resource private DictDataServiceImpl dictDataService; @@ -39,6 +40,23 @@ public class DictDataServiceTest extends BaseDbUnitTest { @MockBean private DictTypeService dictTypeService; + @Test + public void testGetDictDataList() { + // mock 数据 + DictDataDO dictDataDO01 = randomDictDataDO().setDictType("yunai").setSort(2); + dictDataMapper.insert(dictDataDO01); + DictDataDO dictDataDO02 = randomDictDataDO().setDictType("yunai").setSort(1); + dictDataMapper.insert(dictDataDO02); + // 准备参数 + + // 调用 + List dictDataDOList = dictDataService.getDictDataList(); + // 断言 + assertEquals(2, dictDataDOList.size()); + assertPojoEquals(dictDataDO02, dictDataDOList.get(0)); + assertPojoEquals(dictDataDO01, dictDataDOList.get(1)); + } + @Test public void testGetDictDataPage() { // mock 数据 @@ -49,11 +67,11 @@ public class DictDataServiceTest extends BaseDbUnitTest { }); dictDataMapper.insert(dbDictData); // 测试 label 不匹配 - dictDataMapper.insert(ObjectUtils.cloneIgnoreId(dbDictData, o -> o.setLabel("艿"))); + dictDataMapper.insert(cloneIgnoreId(dbDictData, o -> o.setLabel("艿"))); // 测试 dictType 不匹配 - dictDataMapper.insert(ObjectUtils.cloneIgnoreId(dbDictData, o -> o.setDictType("nai"))); + dictDataMapper.insert(cloneIgnoreId(dbDictData, o -> o.setDictType("nai"))); // 测试 status 不匹配 - dictDataMapper.insert(ObjectUtils.cloneIgnoreId(dbDictData, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); + dictDataMapper.insert(cloneIgnoreId(dbDictData, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); // 准备参数 DictDataPageReqVO reqVO = new DictDataPageReqVO(); reqVO.setLabel("芋"); @@ -69,7 +87,7 @@ public class DictDataServiceTest extends BaseDbUnitTest { } @Test - public void testGetDictDataList() { + public void testGetDictDataList_export() { // mock 数据 DictDataDO dbDictData = randomPojo(DictDataDO.class, o -> { // 等会查询到 o.setLabel("芋艿"); @@ -78,11 +96,11 @@ public class DictDataServiceTest extends BaseDbUnitTest { }); dictDataMapper.insert(dbDictData); // 测试 label 不匹配 - dictDataMapper.insert(ObjectUtils.cloneIgnoreId(dbDictData, o -> o.setLabel("艿"))); + dictDataMapper.insert(cloneIgnoreId(dbDictData, o -> o.setLabel("艿"))); // 测试 dictType 不匹配 - dictDataMapper.insert(ObjectUtils.cloneIgnoreId(dbDictData, o -> o.setDictType("nai"))); + dictDataMapper.insert(cloneIgnoreId(dbDictData, o -> o.setDictType("nai"))); // 测试 status 不匹配 - dictDataMapper.insert(ObjectUtils.cloneIgnoreId(dbDictData, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); + dictDataMapper.insert(cloneIgnoreId(dbDictData, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); // 准备参数 DictDataExportReqVO reqVO = new DictDataExportReqVO(); reqVO.setLabel("芋"); @@ -90,12 +108,26 @@ public class DictDataServiceTest extends BaseDbUnitTest { reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 调用 - List list = dictDataService.getDictDatas(reqVO); + List list = dictDataService.getDictDataList(reqVO); // 断言 assertEquals(1, list.size()); assertPojoEquals(dbDictData, list.get(0)); } + @Test + public void testGetDictData() { + // mock 数据 + DictDataDO dbDictData = randomDictDataDO(); + dictDataMapper.insert(dbDictData); + // 准备参数 + Long id = dbDictData.getId(); + + // 调用 + DictDataDO dictData = dictDataService.getDictData(id); + // 断言 + assertPojoEquals(dbDictData, dictData); + } + @Test public void testCreateDictData_success() { // 准备参数 @@ -148,54 +180,54 @@ public class DictDataServiceTest extends BaseDbUnitTest { } @Test - public void testCheckDictDataExists_success() { + public void testValidateDictDataExists_success() { // mock 数据 DictDataDO dbDictData = randomDictDataDO(); dictDataMapper.insert(dbDictData);// @Sql: 先插入出一条存在的数据 // 调用成功 - dictDataService.checkDictDataExists(dbDictData.getId()); + dictDataService.validateDictDataExists(dbDictData.getId()); } @Test - public void testCheckDictDataExists_notExists() { - assertServiceException(() -> dictDataService.checkDictDataExists(randomLongId()), DICT_DATA_NOT_EXISTS); + public void testValidateDictDataExists_notExists() { + assertServiceException(() -> dictDataService.validateDictDataExists(randomLongId()), DICT_DATA_NOT_EXISTS); } @Test - public void testCheckDictTypeValid_success() { + public void testValidateDictTypeExists_success() { // mock 方法,数据类型被禁用 String type = randomString(); when(dictTypeService.getDictType(eq(type))).thenReturn(randomDictTypeDO(type)); // 调用, 成功 - dictDataService.checkDictTypeValid(type); + dictDataService.validateDictTypeExists(type); } @Test - public void testCheckDictTypeValid_notExists() { - assertServiceException(() -> dictDataService.checkDictTypeValid(randomString()), DICT_TYPE_NOT_EXISTS); + public void testValidateDictTypeExists_notExists() { + assertServiceException(() -> dictDataService.validateDictTypeExists(randomString()), DICT_TYPE_NOT_EXISTS); } @Test - public void testCheckDictTypeValid_notEnable() { + public void testValidateDictTypeExists_notEnable() { // mock 方法,数据类型被禁用 String dictType = randomString(); when(dictTypeService.getDictType(eq(dictType))).thenReturn( randomPojo(DictTypeDO.class, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); // 调用, 并断言异常 - assertServiceException(() -> dictDataService.checkDictTypeValid(dictType), DICT_TYPE_NOT_ENABLE); + assertServiceException(() -> dictDataService.validateDictTypeExists(dictType), DICT_TYPE_NOT_ENABLE); } @Test - public void testCheckDictDataValueUnique_success() { + public void testValidateDictDataValueUnique_success() { // 调用,成功 - dictDataService.checkDictDataValueUnique(randomLongId(), randomString(), randomString()); + dictDataService.validateDictDataValueUnique(randomLongId(), randomString(), randomString()); } @Test - public void testCheckDictDataValueUnique_valueDuplicateForCreate() { + public void testValidateDictDataValueUnique_valueDuplicateForCreate() { // 准备参数 String dictType = randomString(); String value = randomString(); @@ -206,12 +238,12 @@ public class DictDataServiceTest extends BaseDbUnitTest { })); // 调用,校验异常 - assertServiceException(() -> dictDataService.checkDictDataValueUnique(null, dictType, value), + assertServiceException(() -> dictDataService.validateDictDataValueUnique(null, dictType, value), DICT_DATA_VALUE_DUPLICATE); } @Test - public void testCheckDictDataValueUnique_valueDuplicateForUpdate() { + public void testValidateDictDataValueUnique_valueDuplicateForUpdate() { // 准备参数 Long id = randomLongId(); String dictType = randomString(); @@ -223,10 +255,96 @@ public class DictDataServiceTest extends BaseDbUnitTest { })); // 调用,校验异常 - assertServiceException(() -> dictDataService.checkDictDataValueUnique(id, dictType, value), + assertServiceException(() -> dictDataService.validateDictDataValueUnique(id, dictType, value), DICT_DATA_VALUE_DUPLICATE); } + @Test + public void testCountByDictType() { + // mock 数据 + dictDataMapper.insert(randomDictDataDO(o -> o.setDictType("yunai"))); + dictDataMapper.insert(randomDictDataDO(o -> o.setDictType("tudou"))); + dictDataMapper.insert(randomDictDataDO(o -> o.setDictType("yunai"))); + // 准备参数 + String dictType = "yunai"; + + // 调用 + long count = dictDataService.countByDictType(dictType); + // 校验 + assertEquals(2L, count); + } + + @Test + public void testValidateDictDataList_success() { + // mock 数据 + DictDataDO dictDataDO = randomDictDataDO().setStatus(CommonStatusEnum.ENABLE.getStatus()); + dictDataMapper.insert(dictDataDO); + // 准备参数 + String dictType = dictDataDO.getDictType(); + List values = singletonList(dictDataDO.getValue()); + + // 调用,无需断言 + dictDataService.validateDictDataList(dictType, values); + } + + @Test + public void testValidateDictDataList_notFound() { + // 准备参数 + String dictType = randomString(); + List values = singletonList(randomString()); + + // 调用, 并断言异常 + assertServiceException(() -> dictDataService.validateDictDataList(dictType, values), DICT_DATA_NOT_EXISTS); + } + + @Test + public void testValidateDictDataList_notEnable() { + // mock 数据 + DictDataDO dictDataDO = randomDictDataDO().setStatus(CommonStatusEnum.DISABLE.getStatus()); + dictDataMapper.insert(dictDataDO); + // 准备参数 + String dictType = dictDataDO.getDictType(); + List values = singletonList(dictDataDO.getValue()); + + // 调用, 并断言异常 + assertServiceException(() -> dictDataService.validateDictDataList(dictType, values), + DICT_DATA_NOT_ENABLE, dictDataDO.getLabel()); + } + + @Test + public void testGetDictData_dictType() { + // mock 数据 + DictDataDO dictDataDO = randomDictDataDO().setDictType("yunai").setValue("1"); + dictDataMapper.insert(dictDataDO); + DictDataDO dictDataDO02 = randomDictDataDO().setDictType("yunai").setValue("2"); + dictDataMapper.insert(dictDataDO02); + // 准备参数 + String dictType = "yunai"; + String value = "1"; + + // 调用 + DictDataDO dbDictData = dictDataService.getDictData(dictType, value); + // 断言 + assertEquals(dictDataDO, dbDictData); + } + + @Test + public void testParseDictData() { + // mock 数据 + DictDataDO dictDataDO = randomDictDataDO().setDictType("yunai").setLabel("1"); + dictDataMapper.insert(dictDataDO); + DictDataDO dictDataDO02 = randomDictDataDO().setDictType("yunai").setLabel("2"); + dictDataMapper.insert(dictDataDO02); + // 准备参数 + String dictType = "yunai"; + String label = "1"; + + // 调用 + DictDataDO dbDictData = dictDataService.parseDictData(dictType, label); + // 断言 + assertEquals(dictDataDO, dbDictData); + } + // ========== 随机对象 ========== @SafeVarargs