|  | @@ -32,6 +32,7 @@ public class SubjectServiceImpl extends BaseServiceImpl<Long, Subject> implement
 | 
											
												
													
														|  |      public List<Subject> findBySubjectByIdList(List<Long> subjectIdList) {
 |  |      public List<Subject> findBySubjectByIdList(List<Long> subjectIdList) {
 | 
											
												
													
														|  |          return subjectDao.findBySubjectIds(subjectIdList);
 |  |          return subjectDao.findBySubjectIds(subjectIdList);
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  |      public List<Subject> findBySubjectByIdList(String subjectIdList) {
 |  |      public List<Subject> findBySubjectByIdList(String subjectIdList) {
 | 
											
												
													
														|  |          return subjectDao.findBySubjectByIdList(subjectIdList);
 |  |          return subjectDao.findBySubjectByIdList(subjectIdList);
 | 
											
										
											
												
													
														|  | @@ -47,26 +48,27 @@ public class SubjectServiceImpl extends BaseServiceImpl<Long, Subject> implement
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      @Override
 |  |      @Override
 | 
											
												
													
														|  | -	public int deleteById(Long id) {
 |  | 
 | 
											
												
													
														|  | -    	List<Subject> subjectList = subjectDao.findByParentId(id);
 |  | 
 | 
											
												
													
														|  | -    	if(subjectList != null && subjectList.size() > 0){
 |  | 
 | 
											
												
													
														|  | -			throw new BizException("该分类下已创建下级,无法删除");
 |  | 
 | 
											
												
													
														|  | -    	}
 |  | 
 | 
											
												
													
														|  | -		return subjectDao.deleteById(id);
 |  | 
 | 
											
												
													
														|  | -	}
 |  | 
 | 
											
												
													
														|  | -
 |  | 
 | 
											
												
													
														|  | -	@Override
 |  | 
 | 
											
												
													
														|  | 
 |  | +    public int deleteById(Long id) {
 | 
											
												
													
														|  | 
 |  | +        List<Subject> subjectList = subjectDao.findByParentId(id);
 | 
											
												
													
														|  | 
 |  | +        if (subjectList != null && subjectList.size() > 0) {
 | 
											
												
													
														|  | 
 |  | +            throw new BizException("该分类下已创建下级,无法删除");
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        return subjectDao.deleteById(id);
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    @Override
 | 
											
												
													
														|  |      public void upSetSubject(Subject subject) {
 |  |      public void upSetSubject(Subject subject) {
 | 
											
												
													
														|  | -		
 |  | 
 | 
											
												
													
														|  | -		Subject orginSubject = subjectDao.queryByName(subject.getName());
 |  | 
 | 
											
												
													
														|  | -		
 |  | 
 | 
											
												
													
														|  | -		if(orginSubject != null){
 |  | 
 | 
											
												
													
														|  | -			if(orginSubject.getId() != subject.getId()){
 |  | 
 | 
											
												
													
														|  | -				throw new BizException("名称已存在,请修改名称");
 |  | 
 | 
											
												
													
														|  | -			}
 |  | 
 | 
											
												
													
														|  | -		}
 |  | 
 | 
											
												
													
														|  | -		
 |  | 
 | 
											
												
													
														|  | -		if (subject.getId() != null) {
 |  | 
 | 
											
												
													
														|  | 
 |  | +        Subject subjectByCode = subjectDao.queryByCode(subject.getCode());
 | 
											
												
													
														|  | 
 |  | +        if (subjectByCode != null && subjectByCode.getId() != subject.getId()) {
 | 
											
												
													
														|  | 
 |  | +            throw new BizException("声部编码已存在,请修改编码");
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        Subject subjectByName = subjectDao.queryByName(subject.getName());
 | 
											
												
													
														|  | 
 |  | +        if (subjectByName != null && subjectByName.getId() != subject.getId()) {
 | 
											
												
													
														|  | 
 |  | +            throw new BizException("名称已存在,请修改名称");
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        if (subject.getId() != null) {
 | 
											
												
													
														|  |              subject.setUpdateTime(new Date());
 |  |              subject.setUpdateTime(new Date());
 | 
											
												
													
														|  |              subjectDao.update(subject);
 |  |              subjectDao.update(subject);
 | 
											
												
													
														|  |          } else {
 |  |          } else {
 | 
											
										
											
												
													
														|  | @@ -79,7 +81,7 @@ public class SubjectServiceImpl extends BaseServiceImpl<Long, Subject> implement
 | 
											
												
													
														|  |          List<Subject> allList = subjectDao.findAll(new HashMap<>());
 |  |          List<Subject> allList = subjectDao.findAll(new HashMap<>());
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          List<Subject> parents = allList.stream()
 |  |          List<Subject> parents = allList.stream()
 | 
											
												
													
														|  | -                .filter(o -> (null == o.getParentSubjectId() || o.getParentSubjectId().equals(0L) ))
 |  | 
 | 
											
												
													
														|  | 
 |  | +                .filter(o -> (null == o.getParentSubjectId() || o.getParentSubjectId().equals(0L)))
 | 
											
												
													
														|  |                  .collect(Collectors.toList());
 |  |                  .collect(Collectors.toList());
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          List<Subject> subjects = allList.stream()
 |  |          List<Subject> subjects = allList.stream()
 | 
											
										
											
												
													
														|  | @@ -96,7 +98,7 @@ public class SubjectServiceImpl extends BaseServiceImpl<Long, Subject> implement
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |                  if (subject.getParentSubjectId().equals(parent.getId())) {
 |  |                  if (subject.getParentSubjectId().equals(parent.getId())) {
 | 
											
												
													
														|  |                      List<Subject> children = parent.getSubjects();
 |  |                      List<Subject> children = parent.getSubjects();
 | 
											
												
													
														|  | -                    if(CollectionUtils.isEmpty(children)){
 |  | 
 | 
											
												
													
														|  | 
 |  | +                    if (CollectionUtils.isEmpty(children)) {
 | 
											
												
													
														|  |                          children = new ArrayList<>();
 |  |                          children = new ArrayList<>();
 | 
											
												
													
														|  |                      }
 |  |                      }
 | 
											
												
													
														|  |                      children.add(subject);
 |  |                      children.add(subject);
 |