|
@@ -7,20 +7,20 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.kexun.common.utils.Result;
|
|
|
-import com.kexun.entity.BusInfoModifyHis;
|
|
|
-import com.kexun.entity.CooperatorInfo;
|
|
|
-import com.kexun.entity.FieldDefineEntity;
|
|
|
-import com.kexun.entity.FieldTemplateEntity;
|
|
|
+import com.kexun.entity.*;
|
|
|
import com.kexun.hander.PageBean;
|
|
|
import com.kexun.model.ro.FiledRO;
|
|
|
import com.kexun.model.ro.FiledUpdateRO;
|
|
|
+import com.kexun.service.CooperatorProductFieldService;
|
|
|
import com.kexun.service.CooperatorService;
|
|
|
import com.kexun.service.FieldDefineService;
|
|
|
+import com.kexun.service.FieldTemplateRefService;
|
|
|
import com.kexun.utils.PageUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
@@ -40,6 +40,14 @@ public class FieldDefineController {
|
|
|
|
|
|
@Autowired
|
|
|
private com.kexun.service.FieldDefineService fieldDefineService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private FieldTemplateRefService fieldTemplateRefService;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private com.kexun.service.CooperatorProductFieldService CooperatorProductFieldService;
|
|
|
+
|
|
|
/**
|
|
|
* 字段信息读取
|
|
|
*
|
|
@@ -199,7 +207,7 @@ public class FieldDefineController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 基础字段删除
|
|
|
+ * 衍生字段删除,需要删除相关的模板-字段关联表,产品-字段关联表,根据fieldNo删除
|
|
|
* @param id 主键ID
|
|
|
* @return
|
|
|
*/
|
|
@@ -208,7 +216,22 @@ public class FieldDefineController {
|
|
|
if (StringUtils.isEmpty(id)) {
|
|
|
return Result.error("-1", "字段定义的ID不能为空");
|
|
|
}
|
|
|
+
|
|
|
+ FieldDefineEntity fieldDefineEntity = fieldDefineService.findByID(id);
|
|
|
+ String fieldNo = fieldDefineEntity.getFieldNo();
|
|
|
+
|
|
|
+ List<FieldTemplateRefEntity> templateList = fieldTemplateRefService.findFieldByFieldNo(fieldNo);
|
|
|
+ List<CooperatorProductField> productList = CooperatorProductFieldService.findFieldByFieldNo(fieldNo);
|
|
|
+
|
|
|
+ List<Long> ids= templateList.stream().map(FieldTemplateRefEntity::getId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ List<Long> idProducts= productList.stream().map(CooperatorProductField::getId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ fieldTemplateRefService.removeByIds(ids);
|
|
|
+ CooperatorProductFieldService.removeByIds(idProducts);
|
|
|
fieldDefineService.removeById(id);
|
|
|
+
|
|
|
return Result.success();
|
|
|
}
|
|
|
|