浏览代码

更新表单允许重新修改获取目标并保存

陈长荣 3 月之前
父节点
当前提交
fd78d09d96

+ 6 - 14
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/service/impl/FlowInfoServiceImpl.java

@@ -179,28 +179,20 @@ public class FlowInfoServiceImpl extends ServiceImpl<FlowInfoMapper, FlowInfo> i
         Assert.notNull(flowInfo, "基因定制流程不存在");
         BeanUtil.copyProperties(vo, flowInfo);
 
-        StringBuilder target = new StringBuilder();
-        if (vo.getCustom() == null) {
-            customInfoService.remove(new LambdaQueryWrapper<>(StrainCustomInfo.class).eq(StrainCustomInfo::getFlowId, id));
-        } else {
+        if (vo.getTarget().contains(GeneTargetEnum.CUSTOM.getCode())) {
             vo.getCustom().setFlowId(id);
             customInfoService.updateForm(vo.getCustom());
-            target.append(GeneTargetEnum.CUSTOM);
+        } else {
+            customInfoService.remove(new LambdaQueryWrapper<>(StrainCustomInfo.class).eq(StrainCustomInfo::getFlowId, id));
         }
 
-        if (vo.getPurification() == null) {
-            purificationInfoService.remove(new LambdaQueryWrapper<>(StrainPurificationInfo.class).eq(StrainPurificationInfo::getFlowId, id));
-        } else {
+        if (vo.getTarget().contains(GeneTargetEnum.PURIFICATION.getCode())) {
             vo.getPurification().setFlowId(id);
             purificationInfoService.updateForm(vo.getPurification());
-
-            if (target.length() > 0) {
-                target.append(",");
-            }
-            target.append(GeneTargetEnum.PURIFICATION);
+        } else {
+            purificationInfoService.remove(new LambdaQueryWrapper<>(StrainPurificationInfo.class).eq(StrainPurificationInfo::getFlowId, id));
         }
 
-        flowInfo.setTarget(target.toString());
         flowInfo.updateById();
 
         geneWord(flowInfo.getId());

+ 1 - 0
jfcloud-gene-biz/src/main/java/com/github/jfcloud/gene/flow/vo/FlowDetailVo.java

@@ -12,6 +12,7 @@ import javax.validation.constraints.NotNull;
 public class FlowDetailVo {
 
     @Schema(description = "基因定制获得目标")
+    @NotEmpty(message = "获得目标不能为空")
     private String target;
 
     /**