| | |
| | | import com.smartor.domain.HeLibrary; |
| | | import com.smartor.domain.HeLibraryTag; |
| | | import com.smartor.domain.HeLibraryVO; |
| | | import com.smartor.domain.TempDetpRelevance; |
| | | import com.smartor.mapper.HeLibraryMapper; |
| | | import com.smartor.mapper.HeLibraryTagMapper; |
| | | import com.smartor.mapper.TempDetpRelevanceMapper; |
| | | import com.smartor.service.IHeLibraryService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | |
| | | |
| | | @Autowired |
| | | private HeLibraryTagMapper heLibraryTagMapper; |
| | | |
| | | @Autowired |
| | | private TempDetpRelevanceMapper tempDetpRelevanceMapper; |
| | | |
| | | /** |
| | | * 查询宣教资料库 |
| | |
| | | */ |
| | | @Override |
| | | public int deleteHeLibraryByIds(Long[] ids) { |
| | | return heLibraryMapper.deleteHeLibraryByIds(ids); |
| | | Integer i = null; |
| | | for (Long id : ids) { |
| | | i = heLibraryMapper.deleteHeLibraryById(id); |
| | | } |
| | | return i; |
| | | } |
| | | |
| | | /** |
| | | * 删除宣教资料库信息 |
| | | * |
| | | * @param id 宣教资料库主键 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteHeLibraryById(Long id) { |
| | | return heLibraryMapper.deleteHeLibraryById(id); |
| | | } |
| | | |
| | | /** |
| | | * 新增或修改宣教详情 |
| | |
| | | } |
| | | } |
| | | |
| | | //对科室进行处理 |
| | | for (TempDetpRelevance tempDetpRelevance : heLibraryVO.getTempDetpRelevances()) { |
| | | if (tempDetpRelevance.getId() == null) { |
| | | //新增 |
| | | tempDetpRelevance.setTempid(heLibrary.getId()); |
| | | tempDetpRelevance.setType(3L); |
| | | tempDetpRelevanceMapper.insertTempDetpRelevance(tempDetpRelevance); |
| | | } else { |
| | | tempDetpRelevanceMapper.updateTempDetpRelevance(tempDetpRelevance); |
| | | } |
| | | } |
| | | |
| | | return i; |
| | | } |
| | | |
| | | @Override |
| | | public HeLibraryVO selectInfoByCondition(HeLibrary heLibrary) { |
| | | public List<HeLibraryVO> selectInfoByCondition(HeLibrary heLibrary) { |
| | | log.info("查询模板详情根据条件的入参为:{}", heLibrary); |
| | | List<HeLibrary> heLibraries = selectHeLibraryList(heLibrary); |
| | | if (CollectionUtils.isEmpty(heLibraries)) { |
| | | log.info("提供的条件,查询宣教数据为空:{}", heLibraries); |
| | | throw new BaseException("提供的条件,查询宣教数据为空"); |
| | | } |
| | | |
| | | //用于返参 |
| | | HeLibraryVO heLibraryVO = DtoConversionUtils.sourceToTarget(heLibraries.get(0), HeLibraryVO.class); |
| | | List<HeLibraryVO> heLibraryVOS = DtoConversionUtils.sourceToTarget(heLibraries, HeLibraryVO.class); |
| | | if (CollectionUtils.isNotEmpty(heLibraryVOS) && heLibraryVOS.size() == 1) { |
| | | //根据宣教ID查询宣教指标集合 |
| | | HeLibraryTag heLibraryTag = new HeLibraryTag(); |
| | | heLibraryTag.setHeid(heLibraryVO.getId()); |
| | | heLibraryTag.setHeid(heLibraryVOS.get(0).getId()); |
| | | List<HeLibraryTag> heLibraryTags = heLibraryTagMapper.selectHeLibraryTagList(heLibraryTag); |
| | | heLibraryVO.setHeLibraryTagList(heLibraryTags); |
| | | |
| | | return heLibraryVO; |
| | | heLibraryVOS.get(0).setHeLibraryTagList(heLibraryTags); |
| | | } |
| | | return heLibraryVOS; |
| | | } |
| | | } |