This commit is contained in:
2026-08-14 09:04:58 +08:00
parent 863c4f5c13
commit ea13c4ea7c
16 changed files with 74 additions and 69 deletions
@@ -80,7 +80,7 @@ public class SchDicCampusService implements ISchDicCampusService {
boolean isNew=entity.getId() == null || entity.getId() == 0;
// 参数校验
if (entity.getName() == null || entity.getName().trim().isEmpty())
throw new IllegalArgumentException("校区名称不能为空");
throw new DException("校区名称不能为空");
boolean nameExists;
SchDicCampus oldEntity=null;
@@ -89,7 +89,7 @@ public class SchDicCampusService implements ISchDicCampusService {
// 新增:检查同名校区
nameExists = schDicCampusRepository.existsBySchIdAndName(schId, entity.getName());
if (nameExists) {
throw new IllegalArgumentException("校区名称已存在:" + entity.getName());
throw new DException("校区名称已存在:" + entity.getName());
}
OtherUtil.setBaseEntityValue(user, entity);
@@ -98,11 +98,11 @@ public class SchDicCampusService implements ISchDicCampusService {
// 更新:排除自身,检查其他校区同名
nameExists = schDicCampusRepository.existsBySchIdAndNameAndIdNot(schId, entity.getName(), entity.getId());
if (nameExists) {
throw new IllegalArgumentException("校区名称已存在:" + entity.getName());
throw new DException("校区名称已存在:" + entity.getName());
}
Integer entityId=entity.getId();
SchDicCampus existing = schDicCampusRepository.findById(entityId)
.orElseThrow(() -> new IllegalArgumentException("校区不存在,ID=" + entityId));
.orElseThrow(() -> new DException("校区不存在,ID=" + entityId));
oldEntity=OtherUtil.deepCopy(existing,SchDicCampus.class);