diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/DlInspectionProjectServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/DlInspectionProjectServiceImpl.java index 9e460e00..51919d1c 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/DlInspectionProjectServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/DlInspectionProjectServiceImpl.java @@ -31,6 +31,12 @@ public class DlInspectionProjectServiceImpl extends ServiceImpl() + .eq(DlInspectionProject::getProjectName, createReqVO.getProjectName())); + if (ObjectUtil.isNotNull(dlInspectionProject1)) { + throw new RuntimeException("检测项目已存在"); + } // 插入 DlInspectionProject dlInspectionProject = BeanUtils.toBean(createReqVO, DlInspectionProject.class); dlInspectionProject.setDeleted(false); diff --git a/dl-module-inspection/src/main/resources/mapper/inspection/DlInspectionProjectMapper.xml b/dl-module-inspection/src/main/resources/mapper/inspection/DlInspectionProjectMapper.xml index 93c01800..5e3a7fc3 100644 --- a/dl-module-inspection/src/main/resources/mapper/inspection/DlInspectionProjectMapper.xml +++ b/dl-module-inspection/src/main/resources/mapper/inspection/DlInspectionProjectMapper.xml @@ -23,5 +23,6 @@ AND role_id = #{entity.roleId} + ORDER BY create_time DESC \ No newline at end of file