From b65f3d9074baa2ce32e07af720cc1cfd88e096f9 Mon Sep 17 00:00:00 2001 From: liulin <lin.liu@aliyun.com> Date: 星期一, 05 八月 2024 14:25:24 +0800 Subject: [PATCH] demo代码修改 --- src/main/java/com/lunhan/xxx/service/TestInfoService.java | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/lunhan/xxx/service/TestInfoService.java b/src/main/java/com/lunhan/xxx/service/TestInfoService.java index 62b7a33..e05a50c 100644 --- a/src/main/java/com/lunhan/xxx/service/TestInfoService.java +++ b/src/main/java/com/lunhan/xxx/service/TestInfoService.java @@ -2,6 +2,7 @@ import com.lunhan.xxx.common.ExecutedResult; import com.lunhan.xxx.common.PagerResult; +import com.lunhan.xxx.common.enums.EYesOrNo; import com.lunhan.xxx.common.model.Tuple; import com.lunhan.xxx.common.util.*; import com.lunhan.xxx.entity.dto.search.SearchTestInfo; @@ -10,7 +11,7 @@ import com.lunhan.xxx.entity.request.ReqSetSort; import com.lunhan.xxx.entity.request.test.ReqCreateTestInfo; import com.lunhan.xxx.entity.request.test.ReqModifyTestInfo; -import com.lunhan.xxx.repository.imapper.TestInfoMapper; +import com.lunhan.xxx.repository.impl.TestInfoMapperImpl; import com.lunhan.xxx.repository.po.TestInfoPO; import com.lunhan.xxx.repository.vo.TestInfoVO; import com.lunhan.xxx.service.convert.TestInfoConvert; @@ -27,16 +28,17 @@ @Service public class TestInfoService extends BaseService { @Autowired - private TestInfoMapper mapper; + private TestInfoMapperImpl mapper; public ExecutedResult<Long> create(ReqCreateTestInfo request) { // 转换po TestInfoPO item = TestInfoConvert.INSTANCE.toCreate(request); - item.setId(SnowFlakeUtil.getId()); // 设置状态 item.setStatus(EState.NORMAL.getValue()); // 设置记录创建时间 item.setCreateTime(LocalDateTimeUtil.nowTimeStamp()); + // 非逻辑删除 + item.setIsDelete(EYesOrNo.NO.getValue()); int rowCount = mapper.insert(item); if (rowCount != 1) { @@ -127,7 +129,7 @@ } public ExecutedResult<String> listSetSort(ReqListSetSort request) { - // 类别id列表 + // id列表 List<Long> listId = request.getList().stream().map(ReqSetSort::getId).collect(Collectors.toList()); // 验证记录是否存在 ExecutedResult<List<TestInfoPO>> checkExists = this.check4Id(listId); @@ -219,16 +221,16 @@ return ExecutedResult.success(exists); } protected ExecutedResult<List<TestInfoPO>> check4Id(List<Long> listId) { - // 从数据库查找类别 + // 从数据库查找测试信息 List<TestInfoPO> list = mapper.getList(listId); if (ListUtil.isNullOrEmpty(list)) { return ExecutedResult.failed("[测试信息]不存在." + listId); } - // 数据库找到的类别id列表 + // 数据库找到的id列表 List<Long> listIdFind = list.stream().map(TestInfoPO::getId).collect(Collectors.toList()); // 数量不一致 if (listId.size() != listIdFind.size()) { - // 筛选数据库不存在的类别 + // 筛选数据库不存在的测试信息 List<Long> listIdNotFound = listId.stream().filter(c -> !listIdFind.contains(c)).collect(Collectors.toList()); if (ListUtil.isNullOrEmpty(list)) { return ExecutedResult.failed("[测试信息]不存在." + listIdNotFound); -- Gitblit v1.9.3