|
@@ -13,6 +13,7 @@ import com.kexun.model.ro.*;
|
|
|
import com.kexun.model.vo.FieldVO;
|
|
|
import com.kexun.model.vo.FiledTemplateVO;
|
|
|
import com.kexun.service.CooperatorService;
|
|
|
+import com.kexun.service.FieldDefineService;
|
|
|
import com.kexun.service.FieldTemplateRefService;
|
|
|
import com.kexun.service.FieldTemplateService;
|
|
|
import com.kexun.utils.PageUtils;
|
|
@@ -33,7 +34,8 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
@Service
|
|
|
public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, FieldTemplateEntity> implements FieldTemplateService {
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ FieldDefineService fieldDefineService;
|
|
|
@Autowired
|
|
|
FieldTemplateMapper fieldTemplateMapper;
|
|
|
@Autowired
|
|
@@ -80,11 +82,38 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
|
|
|
|
|
|
|
|
|
//模板字段关系表
|
|
|
- List<FiledUpdateRO> filedList = filedTemplateCreateRO.getFiledList();
|
|
|
-
|
|
|
+ List <String> fieldSelected = filedTemplateCreateRO.getFieldSelected();
|
|
|
+ List <String> fieldSelected2 = filedTemplateCreateRO.getFieldSelected2();
|
|
|
List<FieldTemplateRefEntity> fieldTemplateRefList = new ArrayList<>();
|
|
|
|
|
|
- //因字段表模型新增缺少选择字段的步骤,所以此部分暂时注掉,保证新增字段表模板部分功能实现
|
|
|
+ for (int i=0;i<fieldSelected.size();i++){
|
|
|
+ Long fid = Long.parseLong(fieldSelected.get(i));
|
|
|
+ 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.setFieldTemplateId(id);
|
|
|
+ fieldTemplateRefEntity.setTemplateNo(fieldTemplateEntity.getTemplateNo());
|
|
|
+ fieldTemplateRefList.add(fieldTemplateRefEntity);
|
|
|
+ }
|
|
|
+ for (int i=0;i<fieldSelected2.size();i++){
|
|
|
+ Long fid = Long.parseLong(fieldSelected.get(i));
|
|
|
+ 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.setFieldTemplateId(id);
|
|
|
+ fieldTemplateRefEntity.setTemplateNo(fieldTemplateEntity.getTemplateNo());
|
|
|
+ fieldTemplateRefList.add(fieldTemplateRefEntity);
|
|
|
+ }
|
|
|
+ fieldTemplateRefService.saveBatch(fieldTemplateRefList);
|
|
|
+
|
|
|
+// List<FieldTemplateRefEntity> fieldTemplateRefList = new ArrayList<>();
|
|
|
+
|
|
|
// for (FiledUpdateRO filedUpdateRO : filedList) {
|
|
|
// FieldTemplateRefEntity fieldTemplateRefEntity = new FieldTemplateRefEntity();
|
|
|
// fieldTemplateRefEntity.setFieldTemplateId(id);
|
|
@@ -95,7 +124,7 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
|
|
|
// fieldTemplateRefEntity.setType(filedUpdateRO.getType());
|
|
|
// fieldTemplateRefList.add(fieldTemplateRefEntity);
|
|
|
// }
|
|
|
- fieldTemplateRefService.saveBatch(fieldTemplateRefList);
|
|
|
+// fieldTemplateRefService.saveBatch(fieldTemplateRefList);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -108,7 +137,8 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
|
|
|
Long id = filedTemplateUpdateRO.getId();
|
|
|
FieldTemplateEntity templateEntity = getById(id);
|
|
|
FieldTemplateEntity FieldTemplateEntity = new FieldTemplateEntity();
|
|
|
-
|
|
|
+ List<FiledUpdateRO> filedList = filedTemplateUpdateRO.getFieldSelected();
|
|
|
+ System.out.println(filedList);
|
|
|
if (null != templateEntity) {
|
|
|
BeanUtils.copyProperties(filedTemplateUpdateRO,FieldTemplateEntity);
|
|
|
|
|
@@ -131,7 +161,7 @@ public class FieldTemplateServiceImpl extends ServiceImpl<FieldTemplateMapper, F
|
|
|
Long id = filedTemplateUpdateRO.getId();
|
|
|
FieldTemplateEntity fieldTemplateSelect = fieldTemplateMapper.selectById(id);
|
|
|
if (null != fieldTemplateSelect) {
|
|
|
- List<FiledUpdateRO> filedList = filedTemplateUpdateRO.getFiledList();
|
|
|
+ List<FiledUpdateRO> filedList = filedTemplateUpdateRO.getFieldSelected();
|
|
|
//先删除,后insert
|
|
|
List<FieldTemplateRefEntity> filedTemplateList = new ArrayList<>();
|
|
|
for (FiledUpdateRO filedUpdateRO : filedList) {
|