|  | @@ -27,6 +27,7 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.collection.MapUtil;
 | 
	
		
			
				|  |  |  import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | +import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  import org.springframework.util.CollectionUtils;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import javax.annotation.Resource;
 | 
	
	
		
			
				|  | @@ -100,9 +101,11 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> implem
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | +    @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |      public void upSetSubject(Subject subject) {
 | 
	
		
			
				|  |  |          if (subject.getDelFlag() == YesOrNoEnum.YES) {
 | 
	
		
			
				|  |  |              subjectDao.delete(subject.getId());
 | 
	
		
			
				|  |  | +            instrumentService.lambdaUpdate().eq(Instrument::getSubjectId, subject.getId()).remove();
 | 
	
		
			
				|  |  |              return;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          Integer parentId = upset(subject, null);
 | 
	
	
		
			
				|  | @@ -124,9 +127,28 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> implem
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              subjectDao.insert(subject);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        //保存乐器关联
 | 
	
		
			
				|  |  | +        this.saveInstrument(subject);
 | 
	
		
			
				|  |  |          return subject.getId();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    private void saveInstrument(Subject subject) {
 | 
	
		
			
				|  |  | +        if (StringUtils.isNotEmpty(subject.getInstrumentIds())) {
 | 
	
		
			
				|  |  | +            instrumentService.lambdaUpdate().eq(Instrument::getSubjectId, subject.getId()).remove();
 | 
	
		
			
				|  |  | +            List<Instrument> instruments = new ArrayList<>();
 | 
	
		
			
				|  |  | +            String[] split = subject.getInstrumentIds().split(",");
 | 
	
		
			
				|  |  | +            for (String s : split) {
 | 
	
		
			
				|  |  | +                Instrument instrument = new Instrument();
 | 
	
		
			
				|  |  | +                instrument.setSubjectId(subject.getId());
 | 
	
		
			
				|  |  | +                instrument.setId(Integer.valueOf(s));
 | 
	
		
			
				|  |  | +                instrument.setEnableFlag(true);
 | 
	
		
			
				|  |  | +                instrument.setDelFlag(false);
 | 
	
		
			
				|  |  | +                instruments.add(instrument);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            instrumentService.saveBatch(instruments);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public void markGoods(List<SubjectGoodsMapper> subjectGoodsMappers) {
 | 
	
		
			
				|  |  |          subjectGoodsMappers.forEach(e -> {
 | 
	
	
		
			
				|  | @@ -242,7 +264,7 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> implem
 | 
	
		
			
				|  |  |              for (Subject subject : dataList) {
 | 
	
		
			
				|  |  |                  CbsMusicalInstrumentWrapper.MusicalInstrumentQueryDto dto = map.get(subject.getCbsSubjectId());
 | 
	
		
			
				|  |  |                  if (dto != null) {
 | 
	
		
			
				|  |  | -                    subject.setInstitutionName(dto.getName());
 | 
	
		
			
				|  |  | +                    subject.setInstrumentName(dto.getName());
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -295,13 +317,13 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> implem
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          PageInfo<SubjectWrapper.Subject> subjectIPage = this.selectPage(query);
 | 
	
		
			
				|  |  |          List<SubjectWrapper.Subject> records = subjectIPage.getRows();
 | 
	
		
			
				|  |  | -        if (org.apache.commons.collections.CollectionUtils.isEmpty(records)) {
 | 
	
		
			
				|  |  | +        if (CollectionUtils.isEmpty(records)) {
 | 
	
		
			
				|  |  |              return records;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          String instrumentIds = query.getInstrumentIds();
 | 
	
		
			
				|  |  | -        List<Long> instrumentIdList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        List<Integer> instrumentIdList = new ArrayList<>();
 | 
	
		
			
				|  |  |          if (StringUtils.isNotEmpty(instrumentIds)) {
 | 
	
		
			
				|  |  | -            List<Long> collect = Arrays.stream(instrumentIds.split(",")).map(Long::valueOf).distinct().collect(Collectors.toList());
 | 
	
		
			
				|  |  | +            List<Integer> collect = Arrays.stream(instrumentIds.split(",")).map(Integer::valueOf).distinct().collect(Collectors.toList());
 | 
	
		
			
				|  |  |              instrumentIdList.addAll(collect);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          if (!instrumentIdList.isEmpty()) {
 |