|
@@ -7,6 +7,8 @@ import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.kexun.common.utils.Result;
|
|
import com.kexun.common.utils.Result;
|
|
import com.kexun.entity.*;
|
|
import com.kexun.entity.*;
|
|
|
|
+import com.kexun.mapper.CooperatorProductFieldMapper;
|
|
|
|
+import com.kexun.mapper.FieldDefineMapper;
|
|
import com.kexun.service.CooperatorProductFieldService;
|
|
import com.kexun.service.CooperatorProductFieldService;
|
|
import com.kexun.service.CooperatorProductService;
|
|
import com.kexun.service.CooperatorProductService;
|
|
import com.kexun.service.FieldDefineService;
|
|
import com.kexun.service.FieldDefineService;
|
|
@@ -31,6 +33,11 @@ public class CooperatorProductController {
|
|
@Autowired
|
|
@Autowired
|
|
private CooperatorProductService CooperatorProductService;
|
|
private CooperatorProductService CooperatorProductService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ CooperatorProductFieldMapper cooperatorProductFieldMapper;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ FieldDefineMapper fieldDefineMapper;
|
|
@Autowired
|
|
@Autowired
|
|
private com.kexun.service.CooperatorProductFieldService CooperatorProductFieldService;
|
|
private com.kexun.service.CooperatorProductFieldService CooperatorProductFieldService;
|
|
|
|
|
|
@@ -160,22 +167,22 @@ public class CooperatorProductController {
|
|
//合作方产品字段关系表
|
|
//合作方产品字段关系表
|
|
String fieldSelected = req.getString("fieldSelected");
|
|
String fieldSelected = req.getString("fieldSelected");
|
|
List<String> fieldSelectedList= JSONArray.parseArray(fieldSelected,String.class);
|
|
List<String> fieldSelectedList= JSONArray.parseArray(fieldSelected,String.class);
|
|
|
|
+
|
|
List<CooperatorProductField> cooperatorProductFieldList = new ArrayList<>();
|
|
List<CooperatorProductField> cooperatorProductFieldList = new ArrayList<>();
|
|
|
|
+ List<FieldDefineEntity> productFieldList = fieldDefineMapper.selectBatchIds(fieldSelectedList);
|
|
|
|
|
|
for (int i=0;i<fieldSelectedList.size();i++){
|
|
for (int i=0;i<fieldSelectedList.size();i++){
|
|
- Long fid = Long.parseLong(fieldSelectedList.get(i));
|
|
|
|
- FieldDefineEntity fieldDefine = fieldDefineService.findByID(fid);
|
|
|
|
CooperatorProductField cooperatorProductField = new CooperatorProductField();
|
|
CooperatorProductField cooperatorProductField = new CooperatorProductField();
|
|
cooperatorProductField.setIsDeleted(false);
|
|
cooperatorProductField.setIsDeleted(false);
|
|
- cooperatorProductField.setFieldId(fieldDefine.getId());
|
|
|
|
- cooperatorProductField.setFieldNo(fieldDefine.getFieldNo());
|
|
|
|
- cooperatorProductField.setName(fieldDefine.getName());
|
|
|
|
|
|
+ cooperatorProductField.setFieldId(productFieldList.get(i).getId());
|
|
|
|
+ cooperatorProductField.setFieldNo(productFieldList.get(i).getFieldNo());
|
|
|
|
+ cooperatorProductField.setName(productFieldList.get(i).getName());
|
|
cooperatorProductField.setProductId(id.toString());
|
|
cooperatorProductField.setProductId(id.toString());
|
|
cooperatorProductField.setProductNum(req.getString("product_num"));
|
|
cooperatorProductField.setProductNum(req.getString("product_num"));
|
|
cooperatorProductField.setProductName(req.getString("product_name"));
|
|
cooperatorProductField.setProductName(req.getString("product_name"));
|
|
- CooperatorProductFieldService.save(cooperatorProductField);
|
|
|
|
|
|
+ cooperatorProductFieldList.add(cooperatorProductField);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ CooperatorProductFieldService.saveBatch(cooperatorProductFieldList);
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -186,31 +193,31 @@ public class CooperatorProductController {
|
|
JSONObject req = JSON.parseObject(json);
|
|
JSONObject req = JSON.parseObject(json);
|
|
//原有合作方产品字段关系表
|
|
//原有合作方产品字段关系表
|
|
String fieldSelectedOld = req.getString("fieldSelectedOld");
|
|
String fieldSelectedOld = req.getString("fieldSelectedOld");
|
|
- List<String> fieldSelectedOldList= JSONArray.parseArray(fieldSelectedOld,String.class);
|
|
|
|
- for (int i=0;i<fieldSelectedOldList.size();i++){
|
|
|
|
- Long foid = Long.parseLong(fieldSelectedOldList.get(i));
|
|
|
|
- System.out.println("this id ");
|
|
|
|
- System.out.println(foid);
|
|
|
|
- CooperatorProductFieldService.removeById(foid);
|
|
|
|
- }
|
|
|
|
|
|
+ List<Long> fieldSelectedOldList= JSONArray.parseArray(fieldSelectedOld,Long.class);
|
|
|
|
+ CooperatorProductFieldService.removeByIds(fieldSelectedOldList);
|
|
|
|
+
|
|
|
|
|
|
//合作方产品字段关系表
|
|
//合作方产品字段关系表
|
|
String fieldSelected = req.getString("fieldSelected");
|
|
String fieldSelected = req.getString("fieldSelected");
|
|
- List<String> fieldSelectedList= JSONArray.parseArray(fieldSelected,String.class);
|
|
|
|
|
|
+ List<Long> fieldSelectedList= JSONArray.parseArray(fieldSelected,Long.class);
|
|
|
|
+
|
|
|
|
+ List<CooperatorProductField> cooperatorProductFieldList = new ArrayList<>();
|
|
|
|
+ List<FieldDefineEntity> productFieldList = fieldDefineMapper.selectBatchIds(fieldSelectedList);
|
|
|
|
+
|
|
|
|
|
|
for (int i=0;i<fieldSelectedList.size();i++){
|
|
for (int i=0;i<fieldSelectedList.size();i++){
|
|
- Long fid = Long.parseLong(fieldSelectedList.get(i));
|
|
|
|
- FieldDefineEntity fieldDefine = fieldDefineService.findByID(fid);
|
|
|
|
|
|
+
|
|
CooperatorProductField cooperatorProductField = new CooperatorProductField();
|
|
CooperatorProductField cooperatorProductField = new CooperatorProductField();
|
|
cooperatorProductField.setIsDeleted(false);
|
|
cooperatorProductField.setIsDeleted(false);
|
|
- cooperatorProductField.setFieldId(fieldDefine.getId());
|
|
|
|
- cooperatorProductField.setFieldNo(fieldDefine.getFieldNo());
|
|
|
|
- cooperatorProductField.setName(fieldDefine.getName());
|
|
|
|
|
|
+ cooperatorProductField.setFieldId(productFieldList.get(i).getId());
|
|
|
|
+ cooperatorProductField.setFieldNo(productFieldList.get(i).getFieldNo());
|
|
|
|
+ cooperatorProductField.setName(productFieldList.get(i).getName());
|
|
cooperatorProductField.setProductId(req.getString("productId"));
|
|
cooperatorProductField.setProductId(req.getString("productId"));
|
|
cooperatorProductField.setProductNum(req.getString("productNum"));
|
|
cooperatorProductField.setProductNum(req.getString("productNum"));
|
|
cooperatorProductField.setProductName(req.getString("productName"));
|
|
cooperatorProductField.setProductName(req.getString("productName"));
|
|
- CooperatorProductFieldService.save(cooperatorProductField);
|
|
|
|
|
|
+ cooperatorProductFieldList.add(cooperatorProductField);
|
|
}
|
|
}
|
|
|
|
+ CooperatorProductFieldService.saveBatch(cooperatorProductFieldList);
|
|
|
|
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|