Преглед изворни кода

Merge branch 'master' into prod

allen пре 2 година
родитељ
комит
d50584f0ef
19 измењених фајлова са 271 додато и 82 уклоњено
  1. 5 0
      kgraph-graph/src/main/java/com/kgraph/graph/neo4j/controller/KgController.java
  2. 2 0
      kgraph-graph/src/main/java/com/kgraph/graph/neo4j/domain/Entity.java
  3. 2 0
      kgraph-graph/src/main/java/com/kgraph/graph/neo4j/mapper/EntityRepository.java
  4. 3 0
      kgraph-graph/src/main/java/com/kgraph/graph/neo4j/mapper/RelationRepository.java
  5. 2 0
      kgraph-graph/src/main/java/com/kgraph/graph/neo4j/service/IKgService.java
  6. 2 0
      kgraph-graph/src/main/java/com/kgraph/graph/neo4j/service/INeo4jEntityService.java
  7. 5 0
      kgraph-graph/src/main/java/com/kgraph/graph/neo4j/service/impl/KgServiceImpl.java
  8. 5 0
      kgraph-graph/src/main/java/com/kgraph/graph/neo4j/service/impl/Neo4JNeo4jEntityServiceImpl.java
  9. 29 1
      kgraph-graph/src/main/java/com/kgraph/graph/suport/controller/TBuildFlowController.java
  10. 21 1
      kgraph-graph/src/main/java/com/kgraph/graph/suport/controller/TCheckPiontController.java
  11. 21 51
      kgraph-graph/src/main/java/com/kgraph/graph/suport/domain/TBuildFlow.java
  12. 14 0
      kgraph-graph/src/main/java/com/kgraph/graph/suport/domain/TCheckPiont.java
  13. 4 0
      kgraph-graph/src/main/java/com/kgraph/graph/suport/mapper/TBuildFlowMapper.java
  14. 6 0
      kgraph-graph/src/main/java/com/kgraph/graph/suport/service/ITBuildFlowService.java
  15. 2 0
      kgraph-graph/src/main/java/com/kgraph/graph/suport/service/ITCheckPiontService.java
  16. 38 1
      kgraph-graph/src/main/java/com/kgraph/graph/suport/service/impl/TBuildFlowServiceImpl.java
  17. 65 15
      kgraph-graph/src/main/java/com/kgraph/graph/suport/service/impl/TCheckPiontServiceImpl.java
  18. 22 2
      kgraph-graph/src/main/resources/mapper/suport/TBuildFlowMapper.xml
  19. 23 11
      sql/update20230529.sql

+ 5 - 0
kgraph-graph/src/main/java/com/kgraph/graph/neo4j/controller/KgController.java

@@ -103,4 +103,9 @@ public class KgController extends BaseController {
         questionRecordService.insertQuestionRecord(questionRecord);
         return AjaxResult.success("success", result);
     }
+
+    @GetMapping("/getRelationByEntityId/{id}")
+    public AjaxResult getRelationByEntityId(@PathVariable("id") Long id) {
+        return AjaxResult.success(Neo4j2VOUtils.relation2GraphVO(kgService.getRelationByEntityId(id)));
+    }
 }

+ 2 - 0
kgraph-graph/src/main/java/com/kgraph/graph/neo4j/domain/Entity.java

@@ -13,6 +13,8 @@ public class Entity {
     @Id
     @GeneratedValue
     private Long id;
+    @Property("foreignId")
+    private String foreignId;
     @Property("code")
     private String code;
     @Property("name")

+ 2 - 0
kgraph-graph/src/main/java/com/kgraph/graph/neo4j/mapper/EntityRepository.java

@@ -33,4 +33,6 @@ public interface EntityRepository extends Neo4jRepository<Entity, Long> {
 
     @Query(value = "match (e:Entity{name: $0.name}) return e", countQuery = "match (e:Entity{name: $0.name}) return count(e)")
     Page<Entity> getPageListByName(EntityDTO dto, PageRequest page);
+
+    Entity findByForeignId(String foreignId);
 }

+ 3 - 0
kgraph-graph/src/main/java/com/kgraph/graph/neo4j/mapper/RelationRepository.java

@@ -44,4 +44,7 @@ public interface RelationRepository extends Neo4jRepository<Neo4jRelation, Long>
 
     @Query("match data=(e1:Entity)-[r:Relation]-(e2:Entity) where e1.name =~ $name return data")
     List<Neo4jRelation> getRelationByLikeName2(@Param("name") String name);
+
+    @Query("match data=(e1:Entity)-[r:Relation]-(e2:Entity) where id(e1) = $id return data")
+    List<Neo4jRelation> getRelationByEntityId(@Param("id") Long id);
 }

+ 2 - 0
kgraph-graph/src/main/java/com/kgraph/graph/neo4j/service/IKgService.java

@@ -27,4 +27,6 @@ public interface IKgService {
     void buildEntityByClass(List<BuildEntityRelationDTO> bu1ildEntityRelationDTOList);
 
     void addEntityRelation(BuildEntityRelation buildEntityRelation);
+
+    List<Neo4jRelation> getRelationByEntityId(Long id);
 }

+ 2 - 0
kgraph-graph/src/main/java/com/kgraph/graph/neo4j/service/INeo4jEntityService.java

@@ -10,4 +10,6 @@ public interface INeo4jEntityService {
     Entity save(Entity entity);
     void delete(Long[] ids);
     Page<Entity> getPageList(EntityDTO dto);
+
+    Entity getByForeignId(String foreignId);
 }

+ 5 - 0
kgraph-graph/src/main/java/com/kgraph/graph/neo4j/service/impl/KgServiceImpl.java

@@ -321,4 +321,9 @@ public class KgServiceImpl implements IKgService {
         }
     }
 
+    @Override
+    public List<Neo4jRelation> getRelationByEntityId(Long id) {
+        return relationRepository.getRelationByEntityId(id);
+    }
+
 }

+ 5 - 0
kgraph-graph/src/main/java/com/kgraph/graph/neo4j/service/impl/Neo4JNeo4jEntityServiceImpl.java

@@ -47,4 +47,9 @@ public class Neo4JNeo4jEntityServiceImpl implements INeo4jEntityService {
             return repository.getPageList(PageRequest.of(dto.getPageNum() - 1, dto.getPageSize()));
         }
     }
+
+    @Override
+    public Entity getByForeignId(String foreignId) {
+        return repository.findByForeignId(foreignId);
+    }
 }

+ 29 - 1
kgraph-graph/src/main/java/com/kgraph/graph/suport/controller/TBuildFlowController.java

@@ -19,7 +19,8 @@ import com.kgraph.common.enums.BusinessType;;
 import com.kgraph.graph.suport.domain.TBuildFlow;
 import com.kgraph.graph.suport.service.ITBuildFlowService;
 import com.kgraph.common.utils.poi.ExcelUtil;;
-import com.kgraph.common.core.page.TableDataInfo;;
+import com.kgraph.common.core.page.TableDataInfo;
+import org.springframework.web.multipart.MultipartFile;;
 
 /**
  * 构建流程Controller
@@ -101,4 +102,31 @@ public class TBuildFlowController extends BaseController
     {
         return toAjax(tBuildFlowService.deleteTBuildFlowByIds(ids));
     }
+
+    /**
+     * 查看构建结果
+     */
+    @GetMapping("/getFlow/{subTaskId}")
+    public AjaxResult getFlow(@PathVariable("subTaskId") Long subtaskId)
+    {
+        return success(tBuildFlowService.getFlow(subtaskId));
+    }
+
+    @Log(title = "排故流程导入", businessType = BusinessType.IMPORT)
+    @PreAuthorize("@ss.hasPermi('showInfo:breakdown:add')")
+    @PostMapping("/importData")
+    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
+    {
+        ExcelUtil<TBuildFlow> util = new ExcelUtil<>(TBuildFlow.class);
+        List<TBuildFlow> TBuildFlowList = util.importExcel(file.getInputStream());
+        String message = tBuildFlowService.excelImport(TBuildFlowList);
+        return AjaxResult.success(message);
+    }
+
+    @PostMapping("/importTemplate")
+    public void importTemplate(HttpServletResponse response)
+    {
+        ExcelUtil<TBuildFlow> util = new ExcelUtil<>(TBuildFlow.class);
+        util.importTemplateExcel(response, "排故流程");
+    }
 }

+ 21 - 1
kgraph-graph/src/main/java/com/kgraph/graph/suport/controller/TCheckPiontController.java

@@ -2,6 +2,7 @@ package com.kgraph.graph.suport.controller;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -19,7 +20,8 @@ import com.kgraph.common.enums.BusinessType;;
 import com.kgraph.graph.suport.domain.TCheckPiont;
 import com.kgraph.graph.suport.service.ITCheckPiontService;
 import com.kgraph.common.utils.poi.ExcelUtil;;
-import com.kgraph.common.core.page.TableDataInfo;;
+import com.kgraph.common.core.page.TableDataInfo;
+import org.springframework.web.multipart.MultipartFile;;
 
 /**
  * 检查点管理Controller
@@ -101,4 +103,22 @@ public class TCheckPiontController extends BaseController
     {
         return toAjax(tCheckPiontService.deleteTCheckPiontByIds(ids));
     }
+
+    @Log(title = "排故流程导入", businessType = BusinessType.IMPORT)
+    @PreAuthorize("@ss.hasPermi('showInfo:breakdown:add')")
+    @PostMapping("/importData")
+    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
+    {
+        ExcelUtil<TCheckPiont> util = new ExcelUtil<>(TCheckPiont.class);
+        List<TCheckPiont> TCheckPiontList = util.importExcel(file.getInputStream());
+        String message = tCheckPiontService.excelImport(TCheckPiontList);
+        return AjaxResult.success(message);
+    }
+
+    @PostMapping("/importTemplate")
+    public void importTemplate(HttpServletResponse response)
+    {
+        ExcelUtil<TCheckPiont> util = new ExcelUtil<>(TCheckPiont.class);
+        util.importTemplateExcel(response, "检查点管理");
+    }
 }

+ 21 - 51
kgraph-graph/src/main/java/com/kgraph/graph/suport/domain/TBuildFlow.java

@@ -1,5 +1,6 @@
 package com.kgraph.graph.suport.domain;
 
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.kgraph.common.annotation.Excel;
@@ -11,15 +12,27 @@ import com.kgraph.common.core.domain.BaseEntity;;
  * @author kgraph
  * @date 2023-05-28
  */
+@Data
 public class TBuildFlow extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
+    public static final String FID_KEY = "check_flow";
+    public static final String NAME_ENTITY_LABEL = "故障名称";
+    public static final String FLOW_ENTITY_LABEL = "故障流程";
 
     /** 序号 */
     private Long id;
 
+    /** 子任务id */
+    @Excel(name = "子任务id")
+    private Long subTaskId;
+
+    /** 故障编码 */
+    @Excel(name = "故障名称")
+    private String errorAppearance;
+
     /** 故障编码 */
-    @Excel(name = "故障编码")
+    /*@Excel(name = "故障编码")*/
     private String errorCode;
 
     /** 流程数据 */
@@ -27,57 +40,14 @@ public class TBuildFlow extends BaseEntity
     private String flowEncode;
 
     /** 流程树json */
-    @Excel(name = "流程树json")
+    /*@Excel(name = "流程树json")*/
     private String flowTreeJson;
 
-    public void setId(Long id) 
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
-        return id;
-    }
-    public void setErrorCode(String errorCode) 
-    {
-        this.errorCode = errorCode;
-    }
-
-    public String getErrorCode() 
-    {
-        return errorCode;
-    }
-    public void setFlowEncode(String flowEncode) 
-    {
-        this.flowEncode = flowEncode;
-    }
-
-    public String getFlowEncode() 
-    {
-        return flowEncode;
-    }
-    public void setFlowTreeJson(String flowTreeJson) 
-    {
-        this.flowTreeJson = flowTreeJson;
-    }
-
-    public String getFlowTreeJson() 
-    {
-        return flowTreeJson;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("errorCode", getErrorCode())
-            .append("flowEncode", getFlowEncode())
-            .append("flowTreeJson", getFlowTreeJson())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .toString();
+    public String getForeignId() {
+        if (id != null) {
+            return FID_KEY + id;
+        } else {
+            return null;
+        }
     }
 }

+ 14 - 0
kgraph-graph/src/main/java/com/kgraph/graph/suport/domain/TCheckPiont.java

@@ -14,6 +14,8 @@ import com.kgraph.common.core.domain.BaseEntity;;
 public class TCheckPiont extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
+    public static final String FID_KEY = "check_point";
+    public static final String ENTITY_LABEL = "检查点";
 
     /** 序号 */
     private Long id;
@@ -26,6 +28,14 @@ public class TCheckPiont extends BaseEntity
     @Excel(name = "检查点")
     private String checkPiont;
 
+    public String getForeignId() {
+        if (id != null) {
+            return FID_KEY + id;
+        } else {
+            return null;
+        }
+    }
+
     public void setId(Long id) 
     {
         this.id = id;
@@ -66,4 +76,8 @@ public class TCheckPiont extends BaseEntity
             .append("updateTime", getUpdateTime())
             .toString();
     }
+
+    public static String getForeignIdById(Long id){
+        return FID_KEY + id;
+    }
 }

+ 4 - 0
kgraph-graph/src/main/java/com/kgraph/graph/suport/mapper/TBuildFlowMapper.java

@@ -1,6 +1,8 @@
 package com.kgraph.graph.suport.mapper;
 
 import java.util.List;
+import java.util.Map;
+
 import com.kgraph.graph.suport.domain.TBuildFlow;
 
 /**
@@ -58,4 +60,6 @@ public interface TBuildFlowMapper
      * @return 结果
      */
     public int deleteTBuildFlowByIds(Long[] ids);
+
+    public Map getFlow(Long subtaskId);
 }

+ 6 - 0
kgraph-graph/src/main/java/com/kgraph/graph/suport/service/ITBuildFlowService.java

@@ -1,6 +1,8 @@
 package com.kgraph.graph.suport.service;
 
 import java.util.List;
+import java.util.Map;
+
 import com.kgraph.graph.suport.domain.TBuildFlow;
 
 /**
@@ -58,4 +60,8 @@ public interface ITBuildFlowService
      * @return 结果
      */
     public int deleteTBuildFlowById(Long id);
+
+    Map getFlow(Long subtaskId);
+
+    String excelImport(List<TBuildFlow> tBuildFlowList);
 }

+ 2 - 0
kgraph-graph/src/main/java/com/kgraph/graph/suport/service/ITCheckPiontService.java

@@ -58,4 +58,6 @@ public interface ITCheckPiontService
      * @return 结果
      */
     public int deleteTCheckPiontById(Long id);
+
+    String excelImport(List<TCheckPiont> tCheckPiontList);
 }

+ 38 - 1
kgraph-graph/src/main/java/com/kgraph/graph/suport/service/impl/TBuildFlowServiceImpl.java

@@ -1,12 +1,17 @@
 package com.kgraph.graph.suport.service.impl;
 
+import java.util.Date;
 import java.util.List;
-import com.kgraph.common.utils.DateUtils;;
+import java.util.Map;
+
+import com.kgraph.common.utils.DateUtils;
+import com.kgraph.graph.suport.mapper.BuildEntityRelationMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.kgraph.graph.suport.mapper.TBuildFlowMapper;
 import com.kgraph.graph.suport.domain.TBuildFlow;
 import com.kgraph.graph.suport.service.ITBuildFlowService;
+import com.kgraph.graph.suport.mapper.ExtractKnowledgeSubTaskMapper;
 
 /**
  * 构建流程Service业务层处理
@@ -20,6 +25,9 @@ public class TBuildFlowServiceImpl implements ITBuildFlowService
     @Autowired
     private TBuildFlowMapper tBuildFlowMapper;
 
+    @Autowired
+    private ExtractKnowledgeSubTaskMapper extractKnowledgeSubTaskMapper;
+
     /**
      * 查询构建流程
      * 
@@ -54,6 +62,12 @@ public class TBuildFlowServiceImpl implements ITBuildFlowService
     public int insertTBuildFlow(TBuildFlow tBuildFlow)
     {
         tBuildFlow.setCreateTime(DateUtils.getNowDate());
+        if(tBuildFlow.getSubTaskId() != null) {
+            // 更新子任务状态
+            extractKnowledgeSubTaskMapper.updateSubTaskStatusById(tBuildFlow.getSubTaskId(), "3", null, new Date());
+            // 更新任务状态
+            extractKnowledgeSubTaskMapper.updateTaskStatusBySubTaskId(tBuildFlow.getSubTaskId());
+        }
         return tBuildFlowMapper.insertTBuildFlow(tBuildFlow);
     }
 
@@ -67,6 +81,12 @@ public class TBuildFlowServiceImpl implements ITBuildFlowService
     public int updateTBuildFlow(TBuildFlow tBuildFlow)
     {
         tBuildFlow.setUpdateTime(DateUtils.getNowDate());
+        if(tBuildFlow.getSubTaskId() != null) {
+            // 更新子任务状态
+            extractKnowledgeSubTaskMapper.updateSubTaskStatusById(tBuildFlow.getSubTaskId(), "3", null, new Date());
+            // 更新任务状态
+            extractKnowledgeSubTaskMapper.updateTaskStatusBySubTaskId(tBuildFlow.getSubTaskId());
+        }
         return tBuildFlowMapper.updateTBuildFlow(tBuildFlow);
     }
 
@@ -93,4 +113,21 @@ public class TBuildFlowServiceImpl implements ITBuildFlowService
     {
         return tBuildFlowMapper.deleteTBuildFlowById(id);
     }
+
+    @Override
+    public Map getFlow(Long subtaskId) {
+        return tBuildFlowMapper.getFlow(subtaskId);
+    }
+
+    @Override
+    public String excelImport(List<TBuildFlow> TBuildFlowList) {
+        for (TBuildFlow tbuildflow : TBuildFlowList) {
+            if (tbuildflow.getId() == null) {
+                tBuildFlowMapper.insertTBuildFlow(tbuildflow);
+            } else {
+                tBuildFlowMapper.updateTBuildFlow(tbuildflow);
+            }
+        }
+        return "上传成功";
+    }
 }

+ 65 - 15
kgraph-graph/src/main/java/com/kgraph/graph/suport/service/impl/TCheckPiontServiceImpl.java

@@ -1,12 +1,17 @@
 package com.kgraph.graph.suport.service.impl;
 
-import java.util.List;
-import com.kgraph.common.utils.DateUtils;;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.kgraph.graph.suport.mapper.TCheckPiontMapper;
+import com.kgraph.common.utils.DateUtils;
+import com.kgraph.graph.neo4j.domain.Entity;
+import com.kgraph.graph.neo4j.service.INeo4jEntityService;
 import com.kgraph.graph.suport.domain.TCheckPiont;
+import com.kgraph.graph.suport.mapper.TCheckPiontMapper;
 import com.kgraph.graph.suport.service.ITCheckPiontService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+;
 
 /**
  * 检查点管理Service业务层处理
@@ -20,6 +25,9 @@ public class TCheckPiontServiceImpl implements ITCheckPiontService
     @Autowired
     private TCheckPiontMapper tCheckPiontMapper;
 
+    @Autowired
+    private INeo4jEntityService neo4jEntityService;
+
     /**
      * 查询检查点管理
      * 
@@ -47,27 +55,46 @@ public class TCheckPiontServiceImpl implements ITCheckPiontService
     /**
      * 新增检查点管理
      * 
-     * @param tCheckPiont 检查点管理
+     * @param checkPoint 检查点管理
      * @return 结果
      */
     @Override
-    public int insertTCheckPiont(TCheckPiont tCheckPiont)
+    public int insertTCheckPiont(TCheckPiont checkPoint)
     {
-        tCheckPiont.setCreateTime(DateUtils.getNowDate());
-        return tCheckPiontMapper.insertTCheckPiont(tCheckPiont);
+        checkPoint.setCreateTime(DateUtils.getNowDate());
+        int i = tCheckPiontMapper.insertTCheckPiont(checkPoint);
+//        saveEntity(checkPoint);
+        return i;
     }
 
     /**
      * 修改检查点管理
      * 
-     * @param tCheckPiont 检查点管理
+     * @param checkPoint 检查点管理
      * @return 结果
      */
     @Override
-    public int updateTCheckPiont(TCheckPiont tCheckPiont)
+    public int updateTCheckPiont(TCheckPiont checkPoint)
     {
-        tCheckPiont.setUpdateTime(DateUtils.getNowDate());
-        return tCheckPiontMapper.updateTCheckPiont(tCheckPiont);
+        checkPoint.setUpdateTime(DateUtils.getNowDate());
+        int i = tCheckPiontMapper.updateTCheckPiont(checkPoint);
+//        saveEntity(checkPoint);
+        return i;
+    }
+
+    private void saveEntity(TCheckPiont checkPoint) {
+        Entity entity = neo4jEntityService.getByForeignId(checkPoint.getForeignId());
+        if (entity == null) {
+            entity = new Entity();
+            entity.setForeignId(checkPoint.getForeignId());
+        }
+        List<String> labels = entity.getLabels();
+        if(!labels.contains(TCheckPiont.ENTITY_LABEL)){
+            entity.getLabels().add(TCheckPiont.ENTITY_LABEL);
+        }
+        entity.setCode(checkPoint.getCode());
+        entity.setName(checkPoint.getCheckPiont());
+        neo4jEntityService.save(entity);
     }
 
     /**
@@ -79,7 +106,14 @@ public class TCheckPiontServiceImpl implements ITCheckPiontService
     @Override
     public int deleteTCheckPiontByIds(Long[] ids)
     {
-        return tCheckPiontMapper.deleteTCheckPiontByIds(ids);
+        int i = tCheckPiontMapper.deleteTCheckPiontByIds(ids);
+//        List<Long> entityIdList = new ArrayList<>(ids.length);
+//        for(Long id : ids) {
+//            Entity entity = neo4jEntityService.getByForeignId(TCheckPiont.getForeignIdById(id));
+//            entityIdList.add(entity.getId());
+//        }
+//        neo4jEntityService.delete(entityIdList.toArray(new Long[]{}));
+        return i;
     }
 
     /**
@@ -91,6 +125,22 @@ public class TCheckPiontServiceImpl implements ITCheckPiontService
     @Override
     public int deleteTCheckPiontById(Long id)
     {
-        return tCheckPiontMapper.deleteTCheckPiontById(id);
+        int i = tCheckPiontMapper.deleteTCheckPiontById(id);
+//        Entity entity = neo4jEntityService.getByForeignId(TCheckPiont.getForeignIdById(id));
+//        Long entityId = entity.getId();
+//        neo4jEntityService.delete(new Long[]{entityId});
+        return i;
+    }
+
+    @Override
+    public String excelImport(List<TCheckPiont> TCheckPiontList) {
+        for (TCheckPiont tcheckpiont : TCheckPiontList) {
+            if (tcheckpiont.getId() == null) {
+                tCheckPiontMapper.insertTCheckPiont(tcheckpiont);
+            } else {
+                tCheckPiontMapper.updateTCheckPiont(tcheckpiont);
+            }
+        }
+        return "上传成功";
     }
 }

+ 22 - 2
kgraph-graph/src/main/resources/mapper/suport/TBuildFlowMapper.xml

@@ -6,6 +6,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     
     <resultMap type="TBuildFlow" id="TBuildFlowResult">
         <result property="id"    column="id"    />
+        <result property="subTaskId"    column="sub_task_id"    />
+        <result property="errorAppearance"    column="error_appearance"    />
         <result property="errorCode"    column="error_code"    />
         <result property="flowEncode"    column="flow_encode"    />
         <result property="flowTreeJson"    column="flow_tree_json"    />
@@ -16,13 +18,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectTBuildFlowVo">
-        select id, error_code, flow_encode, flow_tree_json, create_by, create_time, update_by, update_time from t_build_flow
+        select id, sub_task_id, error_appearance, error_code, flow_encode, flow_tree_json, create_by, create_time, update_by, update_time from t_build_flow
     </sql>
 
     <select id="selectTBuildFlowList" parameterType="TBuildFlow" resultMap="TBuildFlowResult">
         <include refid="selectTBuildFlowVo"/>
         <where>  
-            <if test="errorCode != null  and errorCode != ''"> and error_code = #{errorCode}</if>
+            <if test="errorAppearance != null  and errorAppearance != ''"> and error_appearance = #{errorAppearance}</if>
             <if test="flowEncode != null  and flowEncode != ''"> and flow_encode = #{flowEncode}</if>
             <if test="flowTreeJson != null  and flowTreeJson != ''"> and flow_tree_json = #{flowTreeJson}</if>
         </where>
@@ -36,6 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <insert id="insertTBuildFlow" parameterType="TBuildFlow" useGeneratedKeys="true" keyProperty="id">
         insert into t_build_flow
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="subTaskId != null">sub_task_id,</if>
+            <if test="errorAppearance != null">error_appearance,</if>
             <if test="errorCode != null">error_code,</if>
             <if test="flowEncode != null">flow_encode,</if>
             <if test="flowTreeJson != null">flow_tree_json,</if>
@@ -45,6 +49,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateTime != null">update_time,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="subTaskId != null">#{subTaskId},</if>
+            <if test="errorAppearance != null">#{errorAppearance},</if>
             <if test="errorCode != null">#{errorCode},</if>
             <if test="flowEncode != null">#{flowEncode},</if>
             <if test="flowTreeJson != null">#{flowTreeJson},</if>
@@ -58,6 +64,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="updateTBuildFlow" parameterType="TBuildFlow">
         update t_build_flow
         <trim prefix="SET" suffixOverrides=",">
+            <if test="subTaskId != null">sub_task_id = #{subTaskId},</if>
+            <if test="errorAppearance != null">error_appearance = #{errorAppearance},</if>
             <if test="errorCode != null">error_code = #{errorCode},</if>
             <if test="flowEncode != null">flow_encode = #{flowEncode},</if>
             <if test="flowTreeJson != null">flow_tree_json = #{flowTreeJson},</if>
@@ -79,4 +87,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <select id="getFlow" resultType="Map">
+        select
+            id,
+            sub_task_id subTaskId,
+            error_appearance errorAppearance,
+            error_code errorCode,
+            flow_encode flowEncode,
+            flow_tree_json flowTreeJson
+        from
+            t_build_flow tbf where tbf.sub_task_id = #{subTaskId}
+    </select>
 </mapper>

+ 23 - 11
sql/update20230529.sql

@@ -1,18 +1,30 @@
 use kgraph;
----- 按钮 SQL
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('构建流程查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'suport:flow:query',        '#', 'admin', sysdate(), '', null, '');
 
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('构建流程新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'suport:flow:add',          '#', 'admin', sysdate(), '', null, '');
+delete FROM `sys_menu` where menu_name like '%构建流程%';
+delete FROM `sys_menu` where menu_name like '%检查点管理%';
+delete FROM `sys_menu` where menu_name like '%排故流程%';
 
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('构建流程修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'suport:flow:edit',         '#', 'admin', sysdate(), '', null, '');
 
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('构建流程删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'suport:flow:remove',       '#', 'admin', sysdate(), '', null, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('检查点管理', 2066, 0, 'piont', 'suport/piont/index', NULL, 1, 0, 'C', '0', '0', 'suport:piont:list', '#', 'admin', '2023-05-28 03:15:20', 'admin', '2023-05-31 03:07:30', '检查点管理菜单');
 
-insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
-values('构建流程导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'suport:flow:export',       '#', 'admin', sysdate(), '', null, '');
+-- 按钮父菜单ID
+SELECT @parentId := LAST_INSERT_ID();
+
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '检查点管理查询', @parentId, 1, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:piont:query', '#', 'admin', '2023-05-28 03:15:20', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '检查点管理新增', @parentId, 2, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:piont:add', '#', 'admin', '2023-05-28 03:15:20', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '检查点管理修改', @parentId, 3, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:piont:edit', '#', 'admin', '2023-05-28 03:15:20', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '检查点管理删除', @parentId, 4, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:piont:remove', '#', 'admin', '2023-05-28 03:15:20', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '检查点管理导出', @parentId, 5, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:piont:export', '#', 'admin', '2023-05-28 03:15:20', '', NULL, '');
+
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('排故流程', 2066, 1, 'flow', 'suport/flow/index', NULL, 1, 0, 'C', '0', '0', 'suport:flow:list', '#', 'admin', '2023-05-28 03:15:47', 'admin', '2023-05-29 08:29:50', '构建流程菜单');
+
+-- 按钮父菜单ID
+SELECT @parentId := LAST_INSERT_ID();
+
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '构建流程查询', @parentId, 1, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:flow:query', '#', 'admin', '2023-05-28 03:15:47', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '构建流程新增', @parentId, 2, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:flow:add', '#', 'admin', '2023-05-28 03:15:47', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '构建流程修改', @parentId, 3, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:flow:edit', '#', 'admin', '2023-05-28 03:15:47', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '构建流程删除', @parentId, 4, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:flow:remove', '#', 'admin', '2023-05-28 03:15:47', '', NULL, '');
+INSERT INTO `sys_menu` (`menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `icon`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '构建流程导出', @parentId, 5, '#', '', NULL, 1, 0, 'F', '0', '0', 'suport:flow:export', '#', 'admin', '2023-05-28 03:15:47', '', NULL, '');
 
 commit;