111
This commit is contained in:
@@ -128,11 +128,11 @@ public class SchDicCourseService implements ISchDicCourseService {
|
||||
|
||||
// 1. 基础校验
|
||||
if (dto == null) {
|
||||
throw new IllegalArgumentException("课程数据不能为空");
|
||||
throw new DException("课程数据不能为空");
|
||||
}
|
||||
|
||||
if (StringUtils.isBlank(dto.getName())) {
|
||||
throw new IllegalArgumentException("课程名称不能为空");
|
||||
throw new DException("课程名称不能为空");
|
||||
}
|
||||
|
||||
// 2. VO → Entity 映射
|
||||
@@ -144,7 +144,7 @@ public class SchDicCourseService implements ISchDicCourseService {
|
||||
schDicCourseRepository.existsBySchIdAndName(schId, entity.getName()) :
|
||||
schDicCourseRepository.existsBySchIdAndNameAndIdNot(schId, entity.getName(), entity.getId());
|
||||
if (nameExists) {
|
||||
throw new IllegalArgumentException("课程名称已存在:" + entity.getName());
|
||||
throw new DException("课程名称已存在:" + entity.getName());
|
||||
}
|
||||
SchDicCourse oldEntity = null;
|
||||
Set<Integer> oldMajors = null;
|
||||
@@ -155,7 +155,7 @@ public class SchDicCourseService implements ISchDicCourseService {
|
||||
entity = schDicCourseRepository.save(entity);
|
||||
} else {
|
||||
SchDicCourse existing = schDicCourseRepository.findById(dto.getId())
|
||||
.orElseThrow(() -> new IllegalArgumentException("课程不存在,ID=" + dto.getId()));
|
||||
.orElseThrow(() -> new DException("课程不存在,ID=" + dto.getId()));
|
||||
|
||||
oldEntity=OtherUtil.deepCopy(existing,SchDicCourse.class);
|
||||
oldMajors = loadMajorsIdSet(dto.getId(),user.getSchId());
|
||||
|
||||
Reference in New Issue
Block a user