zishan-an 11 months ago
parent
commit
80f0477021

+ 2 - 2
src/main/java/com/kexun/constant/BaseConsts.java

@@ -128,12 +128,12 @@ public class BaseConsts {
     /**
      * 字段模板关闭状态
      */
-    public final static String STATUS_OFF = "1";
+    public final static String STATUS_OFF = "0";
 
     /**
      * 字段模板开启
      */
-    public final static String STATUS_ON = "0";
+    public final static String STATUS_ON = "1";
 
     /**
      * 衍生字段参数列表

+ 17 - 10
src/main/java/com/kexun/service/impl/FieldTemplateServiceImpl.java

@@ -9,6 +9,7 @@ import com.kexun.entity.*;
 import com.kexun.exception.RRException;
 import com.kexun.hander.PageBean;
 import com.kexun.mapper.CooperatorMapper;
+import com.kexun.mapper.FieldDefineMapper;
 import com.kexun.mapper.FieldTemplateMapper;
 import com.kexun.model.ro.*;
 import com.kexun.model.vo.FieldVO;
@@ -36,6 +37,9 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
     FieldDefineService fieldDefineService;
     @Autowired
     FieldTemplateMapper fieldTemplateMapper;
+
+    @Autowired
+    FieldDefineMapper fieldDefineMapper;
     @Autowired
     FieldTemplateRefService fieldTemplateRefService;
 
@@ -104,15 +108,18 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
             List <String> fieldSelected2 = filedTemplateCreateRO.getFieldSelected2();
             List<FieldTemplateRefEntity> fieldTemplateRefList = new ArrayList<>();
 
+            List<FieldDefineEntity> fieldBaseDefineList = fieldDefineMapper.selectBatchIds(fieldSelected);
+            List<FieldDefineEntity> fieldDeriveDefineList = fieldDefineMapper.selectBatchIds(fieldSelected2);
+
             for (int i=0;i<fieldSelected.size();i++){
                 Long fid = Long.parseLong(fieldSelected.get(i));
-                FieldDefineEntity fieldDefine = fieldDefineService.findByID(fid);
+//                FieldDefineEntity fieldDefine = fieldDefineService.findByID(fid);
                 FieldTemplateRefEntity fieldTemplateRefEntity = new FieldTemplateRefEntity();
                 fieldTemplateRefEntity.setIsDeleted(false);
-                fieldTemplateRefEntity.setFieldDefineId(fieldDefine.getId());
-                fieldTemplateRefEntity.setFieldNo(fieldDefine.getFieldNo());
-                fieldTemplateRefEntity.setName(fieldDefine.getName());
-                fieldTemplateRefEntity.setType(fieldDefine.getCategory());
+                fieldTemplateRefEntity.setFieldDefineId(fieldBaseDefineList.get(i).getId());
+                fieldTemplateRefEntity.setFieldNo(fieldBaseDefineList.get(i).getFieldNo());
+                fieldTemplateRefEntity.setName(fieldBaseDefineList.get(i).getName());
+                fieldTemplateRefEntity.setType(fieldBaseDefineList.get(i).getCategory());
                 fieldTemplateRefEntity.setFieldTemplateId(id);
 //                fieldTemplateRefEntity.setType("1");
                 fieldTemplateRefEntity.setTemplateNo(fieldTemplateEntity.getTemplateNo());
@@ -120,14 +127,14 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
             }
             for (int i=0;i<fieldSelected2.size();i++){
                 Long fid = Long.parseLong(fieldSelected2.get(i));
-                FieldDefineEntity fieldDefine = fieldDefineService.findByID(fid);
+//                FieldDefineEntity fieldDefine = fieldDefineService.findByID(fid);
                 FieldTemplateRefEntity fieldTemplateRefEntity = new FieldTemplateRefEntity();
                 fieldTemplateRefEntity.setIsDeleted(false);
-                fieldTemplateRefEntity.setFieldDefineId(fieldDefine.getId());
-                fieldTemplateRefEntity.setFieldNo(fieldDefine.getFieldNo());
-                fieldTemplateRefEntity.setType(fieldDefine.getCategory());
+                fieldTemplateRefEntity.setFieldDefineId(fieldDeriveDefineList.get(i).getId());
+                fieldTemplateRefEntity.setFieldNo(fieldDeriveDefineList.get(i).getFieldNo());
+                fieldTemplateRefEntity.setType(fieldDeriveDefineList.get(i).getCategory());
 
-                fieldTemplateRefEntity.setName(fieldDefine.getName());
+                fieldTemplateRefEntity.setName(fieldDeriveDefineList.get(i).getName());
                 fieldTemplateRefEntity.setFieldTemplateId(id);
 //                fieldTemplateRefEntity.setType("2");