|
@@ -4,10 +4,14 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.diagbot.entity.IntroduceDetail;
|
|
|
import com.diagbot.entity.IntroduceInfo;
|
|
|
+import com.diagbot.entity.IntroduceMap;
|
|
|
import com.diagbot.service.impl.IntroduceDetailServiceImpl;
|
|
|
import com.diagbot.service.impl.IntroduceInfoServiceImpl;
|
|
|
+import com.diagbot.service.impl.IntroduceMapServiceImpl;
|
|
|
+import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
import com.diagbot.vo.IntroduceDetailVO;
|
|
|
+import com.diagbot.vo.IntroduceMapVO;
|
|
|
import com.diagbot.vo.IntroducePageVO;
|
|
|
import com.diagbot.vo.IntroduceVO;
|
|
|
import com.google.common.collect.Lists;
|
|
@@ -32,6 +36,8 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
|
IntroduceDetailFacade introduceDetailFacade;
|
|
|
@Autowired
|
|
|
IntroduceDetailServiceImpl introduceDetailServiceImpl;
|
|
|
+ @Autowired
|
|
|
+ IntroduceMapServiceImpl introduceMapServiceImpl;
|
|
|
|
|
|
/**
|
|
|
* 保存提示信息(新增or修改)
|
|
@@ -78,6 +84,21 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
|
}
|
|
|
//插入新的明细记录
|
|
|
introduceDetailServiceImpl.saveBatch(introduceDetailList);
|
|
|
+
|
|
|
+ //更新映射关系
|
|
|
+ //删除已有映射关系
|
|
|
+ QueryWrapper<IntroduceMap> introduceMapQueryWrapper = new QueryWrapper<>();
|
|
|
+ introduceMapQueryWrapper.eq("introduce_id", introduceInfo.getId());
|
|
|
+ introduceMapFacade.remove(introduceMapQueryWrapper);
|
|
|
+ //插入新的映射关系
|
|
|
+ List<IntroduceMap> introduceMapList = Lists.newLinkedList();
|
|
|
+ for (IntroduceMapVO introduceMapVO : introduceVO.getMapVOList()) {
|
|
|
+ IntroduceMap introduceMap = new IntroduceMap();
|
|
|
+ BeanUtil.copyProperties(introduceMapVO, introduceMap);
|
|
|
+ introduceMap.setIntroduceId(introduceInfo.getId());
|
|
|
+ introduceMapList.add(introduceMap);
|
|
|
+ }
|
|
|
+ introduceMapServiceImpl.saveBatch(introduceMapList);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -88,6 +109,10 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public Boolean deleteRecord(Long id) {
|
|
|
+ //删除已有映射关系
|
|
|
+ QueryWrapper<IntroduceMap> introduceMapQueryWrapper = new QueryWrapper<>();
|
|
|
+ introduceMapQueryWrapper.eq("introduce_id", id);
|
|
|
+ introduceMapFacade.remove(introduceMapQueryWrapper);
|
|
|
//删除明细
|
|
|
QueryWrapper<IntroduceDetail> introduceDetailQueryWrapper = new QueryWrapper<>();
|
|
|
introduceDetailQueryWrapper.eq("introduce_id", id);
|
|
@@ -104,6 +129,10 @@ public class IntroduceInfoFacade extends IntroduceInfoServiceImpl {
|
|
|
* @return
|
|
|
*/
|
|
|
public Boolean deleteRecords(Long[] ids) {
|
|
|
+ //删除已有映射关系
|
|
|
+ QueryWrapper<IntroduceMap> introduceMapQueryWrapper = new QueryWrapper<>();
|
|
|
+ introduceMapQueryWrapper.in("introduce_id", ids);
|
|
|
+ introduceMapFacade.remove(introduceMapQueryWrapper);
|
|
|
//删除明细
|
|
|
QueryWrapper<IntroduceDetail> introduceDetailQueryWrapper = new QueryWrapper<>();
|
|
|
introduceDetailQueryWrapper.in("introduce_id", ids);
|