检测项目新增时增加验证

This commit is contained in:
许允枞 2024-10-30 18:06:35 +08:00
parent 301b797a85
commit 6583cb87ed
2 changed files with 7 additions and 0 deletions

View File

@ -31,6 +31,12 @@ public class DlInspectionProjectServiceImpl extends ServiceImpl<DlInspectionProj
@Override
public String createDlInspectionProject(DlInspectionProjectSaveReqVO createReqVO) {
//查询项目名称是否存在
DlInspectionProject dlInspectionProject1 = baseMapper.selectOne(new LambdaQueryWrapper<DlInspectionProject>()
.eq(DlInspectionProject::getProjectName, createReqVO.getProjectName()));
if (ObjectUtil.isNotNull(dlInspectionProject1)) {
throw new RuntimeException("检测项目已存在");
}
// 插入
DlInspectionProject dlInspectionProject = BeanUtils.toBean(createReqVO, DlInspectionProject.class);
dlInspectionProject.setDeleted(false);

View File

@ -23,5 +23,6 @@
AND role_id = #{entity.roleId}
</if>
</where>
ORDER BY create_time DESC
</select>
</mapper>