Browse Source

考试名称重复校验

master
luogw 6 days ago
parent
commit
fd58b17dfe
  1. 6
      src/main/java/com/project/task/domain/service/impl/SaveOrUpdateTaskDomainServiceImpl.java

6
src/main/java/com/project/task/domain/service/impl/SaveOrUpdateTaskDomainServiceImpl.java

@ -126,6 +126,12 @@ public class SaveOrUpdateTaskDomainServiceImpl implements SaveOrUpdateTaskDomain
if (StrUtil.isBlank(dto.getName())) {
throw new BusinessErrorException("考试任务名称不能为空");
}
//校验考试名称是否存在
long count = taskBaseService.count(new LambdaQueryWrapper<TaskEntity>().eq(TaskEntity::getName, dto.getName()));
if (count > 0){
throw new BusinessErrorException("考试任务名称已存在");
}
if (StrUtil.length(dto.getName()) > 10) {
throw new BusinessErrorException("考试任务名称过长");
}

Loading…
Cancel
Save