Ver código fonte

删除tagType=10下的映射关系

zhoutg 5 anos atrás
pai
commit
9336781e82

+ 11 - 5
icssman-service/src/main/java/com/diagbot/facade/QuestionFacade.java

@@ -191,6 +191,17 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
         String person = param.getPerson();
         //先删除原明细,再插入新明细
         deleteMapping(questionInfo.getId(), param);//删除原映射关系
+        if (InsertOrUpdateEnum.Update.getKey() == param.getInsertOrUpdate()
+                && TagTypeEnum.T6.getKey() == questionWrapper.getTagType()) {
+            // 如果是既往史类型,考虑到整一列内容清空,原tagType=10下的映射关系就会遗留下来,
+            // 变成脏数据,导致删除标签时报错
+            // 将tagType=10下的所有映射关系删除
+            Map<String, Object> map = new HashMap();
+            map.put("id", questionInfo.getId());
+            map.put("date", param.getNow());
+            map.put("person", param.getPerson());
+            deleteTagType10Mapping(map);
+        }
         List<QuestionMappingWrapper> questionMappings = questionWrapper.getQuestionMappings();
         if (ListUtil.isNotEmpty(questionMappings)) {
             for (QuestionMappingWrapper bean : questionMappings) {
@@ -512,11 +523,6 @@ public class QuestionFacade extends QuestionInfoServiceImpl {
 
             // 映射关系删除校验,如果有父项关联,不能删除
             List<QuestionInfo> questionInfoList = getParentQuestion(Long.parseLong(id));
-            for (QuestionInfo questionInfo : questionInfoList) {
-                if (questionInfo.getTagType().equals(TagTypeEnum.T10.getKey())) {
-
-                }
-            }
             if (ListUtil.isNotEmpty(questionInfoList)) {
                 StringBuffer sb = new StringBuffer();
                 sb.append("请先删除上级关联:");

+ 8 - 0
icssman-service/src/main/java/com/diagbot/mapper/QuestionInfoMapper.java

@@ -107,4 +107,12 @@ public interface QuestionInfoMapper extends BaseMapper<QuestionInfo> {
      */
     public List<GetQuestionInfoDTO> getQuestionByModuleId(Long moduleId);
 
+
+    /**
+     * 删除tagType=10下映射关系
+     *
+     * @param map
+     */
+    public void deleteTagType10Mapping(Map map);
+
 }

+ 8 - 0
icssman-service/src/main/java/com/diagbot/service/QuestionInfoService.java

@@ -124,6 +124,14 @@ public interface QuestionInfoService extends IService<QuestionInfo> {
      * @return
      */
     public List<GetQuestionInfoDTO> getQuestionByModuleId(Long moduleId);
+
+
+    /**
+     * 删除tagType=10下映射关系
+     *
+     * @param map
+     */
+    public void deleteTagType10Mapping(Map map);
 }
 
 

+ 5 - 0
icssman-service/src/main/java/com/diagbot/service/impl/QuestionInfoServiceImpl.java

@@ -48,6 +48,11 @@ public class QuestionInfoServiceImpl extends ServiceImpl<QuestionInfoMapper, Que
         return baseMapper.getQuestionByModuleId(moduleId);
     }
 
+    @Override
+    public void deleteTagType10Mapping(Map map) {
+        baseMapper.deleteTagType10Mapping(map);
+    }
+
     @Override
     public List<GetQuestionInfoDTO> moduleGetQuestiongInfoByName(ModuleGetQuestionInfoVO moduleGetQuestionInfoVO) {
         return baseMapper.moduleGetQuestiongInfoByName(moduleGetQuestionInfoVO);

+ 9 - 0
icssman-service/src/main/resources/mapper/QuestionInfoMapper.xml

@@ -324,4 +324,13 @@
         LEFT JOIN icss_module_detail b ON a.id = b.question_id
         WHERE a.is_deleted = 'N' AND b.is_deleted = 'N' AND b.module_id = #{moduleId}
     </select>
+
+    <select id="deleteTagType10Mapping">
+        update icss_question_mapping
+        set is_deleted = 'Y', gmt_modified = #{date}, modifier = #{person}
+        where e.is_deleted = 'N' and parent_question in
+        (SELECT c.id FROM `icss_question_info` a, icss_question_mapping b, icss_question_info c
+        where a.is_deleted = 'N' and b.is_deleted = 'N' and c.is_deleted = 'N' and
+        a.id = b.parent_question and b.son_question = c.id and a.id = #{id} and c.tag_type = 10)
+    </select>
 </mapper>