From be895c76637a86f6d05739bda32e2b72f174e7a9 Mon Sep 17 00:00:00 2001
From: chenrui <1187576398@qq.com>
Date: 星期一, 31 三月 2025 17:50:15 +0800
Subject: [PATCH] 标准库功能开发
---
basic-server/src/main/java/com/ruoyi/basic/mapper/StructureItemParameterMapper.java | 3
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java | 101 ++++++++++--
basic-server/src/main/resources/mapper/StandardProductListMapper.xml | 2
basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodListService.java | 2
basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml | 46 +++++
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java | 2
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java | 305 ++++++++++++++-----------------------
7 files changed, 249 insertions(+), 212 deletions(-)
diff --git a/basic-server/src/main/java/com/ruoyi/basic/mapper/StructureItemParameterMapper.java b/basic-server/src/main/java/com/ruoyi/basic/mapper/StructureItemParameterMapper.java
index 654741a..b7e7074 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/mapper/StructureItemParameterMapper.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/mapper/StructureItemParameterMapper.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.dto.TestItemDto;
+import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.basic.pojo.StructureItemParameter;
import org.apache.ibatis.annotations.Param;
@@ -26,5 +27,7 @@
List<TestItemDto> getItemTree();
int removeNoSample(@Param("sample") String sample);
+
+ List<StructureItemParameter> selectItemParameterBySample(@Param("sample") String sample);
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodListService.java b/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodListService.java
index 2f6a810..24e75db 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodListService.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodListService.java
@@ -20,4 +20,6 @@
Integer getStandardMethodId(String code);
+ boolean existWorkShop(String tree);
+
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java
index aa95f5d..004efe5 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java
@@ -1,13 +1,17 @@
package com.ruoyi.basic.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.mapper.StandardMethodListMapper;
import com.ruoyi.basic.mapper.StandardProductListMapper;
+import com.ruoyi.basic.mapper.WorkShopMapper;
import com.ruoyi.basic.pojo.StandardMethodList;
import com.ruoyi.basic.pojo.StandardProductList;
+import com.ruoyi.basic.pojo.WorkShop;
import com.ruoyi.basic.service.StandardMethodListService;
import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@@ -29,34 +33,66 @@
private StandardProductListMapper standardProductListMapper;
+ @Autowired
+ private WorkShopMapper workShopMapper;
+
@Override
public Map<String, List<?>> selectsStandardMethodByFLSSM(String tree) {
- String[] trees = tree.split(" - ");
+ // 鍒ゆ柇鏄惁鍖呭惈杞﹂棿
+ boolean workshopExist = existWorkShop(tree);
Map<String, List<?>> map = new HashMap<>();
String str = "";
List<StandardMethodList> standardMethodLists = new ArrayList<>();
- switch (trees.length){
- case 5:
- str += "\"" + trees[2] + "\",\"" + trees[3] + "\",\"" + trees[4] + "\"";
- standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str));
- standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\",\"" + trees[3] + "\""));
- standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\""));
- break;
- case 4:
- str += "\"" + trees[2] + "\",\"" + trees[3] + "\"";
- standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str));
- standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\""));
- break;
- case 3:
- str += "\"" + trees[2] + "\"";
- standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists3(str));
- break;
- default:
- map.put("standardMethodList", null);
- return map;
+ String[] trees = tree.split(" - ");
+ if(trees != null && trees.length >= 4){
+ // 鍒ゆ柇鏄惁鏈夎溅闂�
+ if(workshopExist){
+ switch (trees.length - 4){
+ case 3:
+ str += "\"" + trees[4] + "\",\"" + trees[5] + "\",\"" + trees[6] + "\"";
+ standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str));
+ standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[4] + "\",\"" + trees[5] + "\""));
+ standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[4] + "\""));
+ break;
+ case 2:
+ str += "\"" + trees[4] + "\",\"" + trees[5] + "\"";
+ standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str));
+ standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[4] + "\""));
+ break;
+ case 1:
+ str += "\"" + trees[4] + "\"";
+ standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists3(str));
+ break;
+ default:
+ map.put("standardMethodList", null);
+ return map;
+ }
+ }else {
+ switch (trees.length - 4){
+ case 2:
+ str += "\"" + trees[3] + "\",\"" + trees[4] + "\",\"" + trees[5] + "\"";
+ standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str));
+ standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[3] + "\",\"" + trees[4] + "\""));
+ standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[3] + "\""));
+ break;
+ case 1:
+ str += "\"" + trees[3] + "\",\"" + trees[5] + "\"";
+ standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str));
+ standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[3] + "\""));
+ break;
+ case 0:
+ str += "\"" + trees[3] + "\"";
+ standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists3(str));
+ break;
+ default:
+ map.put("standardMethodList", null);
+ return map;
+ }
+ }
+ }else {
+ standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodListsByNull(str));
}
- standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodListsByNull(str));
map.put("standardMethodList", standardMethodLists);
return map;
}
@@ -70,6 +106,29 @@
public Integer getStandardMethodId(String code) {
return baseMapper.getStandardMethodId(code);
}
+
+ /**
+ * 鍒ゆ柇鏄惁鍖呭惈杞﹂棿
+ *
+ * @param tree
+ * @return
+ */
+ @Override
+ public boolean existWorkShop(String tree){
+ QueryWrapper<WorkShop> queryWrapper = new QueryWrapper<>();
+ List<WorkShop> workShopList = workShopMapper.selectList(queryWrapper);
+ String[] trees = tree.split(" - ");
+ if(trees != null && trees.length > 0){
+ for (int i = 0; i < trees.length; i++) {
+ for (WorkShop workShop : workShopList) {
+ if(workShop.getName().equals(trees[i].trim())){
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
index 0c9167c..e0a265f 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
@@ -9,6 +9,8 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.mapper.*;
import com.ruoyi.basic.pojo.*;
+import com.ruoyi.basic.service.StandardMethodListService;
+import com.ruoyi.basic.service.StandardMethodService;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.basic.dto.CopyStandardProductListDto;
@@ -17,6 +19,9 @@
import com.ruoyi.basic.dto.ResetTreeDragDTO;
import com.ruoyi.basic.service.StandardProductListService;
import lombok.AllArgsConstructor;
+import org.apache.catalina.security.SecurityUtil;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -47,6 +52,12 @@
private ProductPartMapper productPartMapper;
private StructureTestObjectPartMapper structureTestObjectPartMapper;
+
+ @Autowired
+ private StandardMethodListService standardMethodListService;
+
+ @Autowired
+ private StructureItemParameterMapper structureItemParameterMapper;
@Override
@@ -276,210 +287,126 @@
@Override
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> selectStandardProductListByMethodId(Integer id, String tree) {
+ String sampleType = "";
+ String sample = "";
+ String model = "";
+
+ // 杩斿洖缁撴灉
+ Map<String, Object> map = new HashMap<>();
+ map.put("productList", null);
+ map.put("total", 0);
+
+ // 鍒ゆ柇鏄惁鍖呭惈杞﹂棿
+ boolean existWorkShopFlag = standardMethodListService.existWorkShop(tree);
+ // 鎷兼帴鏍�
String[] trees = tree.split(" - ");
- // 鍒ゆ柇鏄惁鎷栨嫿
- boolean isDrag = false;
- List<StandardProductList> list = new ArrayList<>();
- if (trees.length == 3) {
- List<StandardTree> treeList = new ArrayList<>();
- StandardTree standardTree = new StandardTree();
- standardTree.setFactory(trees[0]);
- standardTree.setLaboratory(trees[1]);
- standardTree.setSampleType(trees[2]);
- List<ProductDto> pList = standardTreeMapper.selectPList(trees[2]);
- if (pList.size() == 0 || pList.get(0) == null) {
- List<StandardTree> treeList1 = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]));
- if (treeList1.size() == 0) {
- treeList.add(standardTree);
- } else {
- treeList.addAll(treeList1);
- }
- } else {
- for (ProductDto p : pList) {
- standardTree.setSample(p.getName());
- List<StandardTree> treeList1 = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, p.getName()));
- if (treeList1.size() == 0) {
- treeList.add(JSON.parseObject(JSON.toJSONString(standardTree), StandardTree.class));
- } else {
- treeList.addAll(treeList1);
- }
- }
- }
- for (StandardTree standardTree2 : treeList) {
- String tree2 = trees[0] + " - " + trees[1] + " - " + trees[2] + " - " + standardTree2.getSample() + " - " + standardTree2.getModel();
- list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree2.getSample(), standardTree2.getModel(), tree2, trees[1]));
- list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + standardTree2.getSample() + "\"", standardTree2.getSample(), standardTree2.getModel(), tree2, trees[1]));
- }
- } else if (trees.length == 4) {
- // 鍒ゆ柇绗洓灞傛槸鍚︽湁鍨嬪彿
- Long count = standardProductListMapper.selectCount(Wrappers.<StandardProductList>lambdaQuery()
- .eq(StandardProductList::getStandardMethodListId, id)
- .isNull(StandardProductList::getModel)
- .like(StandardProductList::getTree, tree));
- if (count == 0) {
- isDrag = true;
- }
-
- isDrag = true;
- List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
- if (treeList.size() == 0) {
- StandardTree standardTree = new StandardTree();
- standardTree.setFactory(trees[0]);
- standardTree.setLaboratory(trees[1]);
- standardTree.setSampleType(trees[2]);
- standardTree.setSample(trees[3]);
- treeList.add(standardTree);
- }
- for (StandardTree standardTree : treeList) {
- String str = tree + " - " + standardTree.getModel();
- list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str, trees[1]));
- list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", standardTree.getSample(), standardTree.getModel(), str, trees[1]));
- }
- } else {
- isDrag = true;
- list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", trees[3].equals("null") ? null : trees[3], trees[4], tree, trees[1]));
- list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", trees[3].equals("null") ? null : trees[3], trees[4], tree, trees[1]));
+ if(trees == null && trees.length < 4){
+ return map;
}
- for (StandardProductList productList : list) {
- productList.setId(IdWorker.getId());
+ StringBuilder queryTreeBuilder = new StringBuilder();
+ // 杞﹂棿灞傜骇澶氫竴灞傜骇
+ if(existWorkShopFlag){
+ switch (trees.length) {
+ case 7:
+ queryTreeBuilder.append("[").append("\"").append(trees[4]).append("\",\"").append(trees[5]).append("\",\"").append(trees[6]).append("\"").append("]");
+ sampleType = trees[4];
+ sample = trees[5];
+ model = trees[6];
+ break;
+ case 6:
+ queryTreeBuilder.append("[").append("\"").append(trees[4]).append("\",\"").append(trees[5]).append("\"").append("]");
+ sampleType = trees[4];
+ sample = trees[5];
+ break;
+ case 5:
+ queryTreeBuilder.append("[").append("\"").append(trees[4]).append("\"").append("]");
+ sampleType = trees[4];
+ break;
+ }
+ }else {
+ switch (trees.length) {
+ case 6:
+ queryTreeBuilder.append("[").append("\"").append(trees[3]).append("\",\"").append(trees[4]).append("\",\"").append(trees[5]).append("\"").append("]");
+ sampleType = trees[3];
+ sample = trees[4];
+ model = trees[5];
+ break;
+ case 5:
+ queryTreeBuilder.append("[").append("\"").append(trees[3]).append("\",\"").append(trees[4]).append("\"").append("]");
+ sampleType = trees[3];
+ sample = trees[4];
+ break;
+ case 4:
+ queryTreeBuilder.append("[").append("\"").append(trees[3]).append("\"").append("]");
+ sampleType = trees[3];
+ break;
+ }
}
- List<StandardProductList> standardProductLists;
-
- if (isDrag) {
- standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
- .eq(StandardProductList::getStandardMethodListId, id)
- .like(StandardProductList::getTree, tree)
- .orderByAsc(StandardProductList::getSort));
- // 鍒ゆ柇鏄惁鏈夋病鏈夊簭鍙风殑, 娌℃湁搴忓彿閲嶇疆
- boolean b = standardProductLists.stream().anyMatch(standardProductList -> standardProductList.getSort() == null);
- } else {
- standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
- .eq(StandardProductList::getStandardMethodListId, id)
- .like(StandardProductList::getTree, tree));
+ if(StringUtils.isEmpty(queryTreeBuilder.toString())){
+ return map;
}
+ // 鏍规嵁妫�楠屽璞�/浜у搧/鍨嬪彿鏌ヨ妫�楠岄」
+ List<StructureItemParameter> structureItemParameterList = structureItemParameterMapper.selectItemParameterBySample(queryTreeBuilder.toString());
- for (StandardProductList sp : standardProductLists) {
- for (StandardProductList pl : list) {
- // 鍒ゆ柇鏉′欢鏄惁鍙湁涓�涓�, 鏈変竴涓殑璇濋粯璁ょ涓�涓�
- String radiusList = pl.getRadiusList();
- if (StringUtils.isNotBlank(radiusList) && !radiusList.equals("null") && !radiusList.equals("\"\"")) {
- JSONArray jsonArray = JSON.parseArray(radiusList);
- List<String> radius = jsonArray.toJavaList(String.class);
- if (CollectionUtils.isNotEmpty(radius) && radius.size() == 1) {
- pl.setRadius(radius.get(0));
- }
- }
- if (Objects.equals(sp.getInspectionItem(), pl.getInspectionItem())
- && Objects.equals((sp.getInspectionItemSubclass() == null) ? "" : sp.getInspectionItemSubclass(), pl.getInspectionItemSubclass() == null ? "" : pl.getInspectionItemSubclass())
-// && Objects.equals(sp.getSample(), pl.getSample())
- && Objects.equals(sp.getModel(), pl.getModel())
- && sp.getTree().indexOf(pl.getSample() == null ? "null" : pl.getSample()) > -1
- && Objects.equals(sp.getStructureItemParameterId(), pl.getStructureItemParameterId())) {
- pl.setId(sp.getId());
- // 娣诲姞鎺掑簭瀛楁
- pl.setSort(sp.getSort());
- if (sp.getState() != null && !sp.getState().equals("")) {
- pl.setState(sp.getState());
- } else {
- pl.setState(id == 0 ? 1 : 0);
- }
- if (sp.getMethodS() != null && !sp.getMethodS().equals("")) {
- pl.setMethod(sp.getMethodS());
- }
- if (sp.getRadius() != null && !sp.getRadius().equals("")) {
- pl.setRadius(sp.getRadius());
- }
- if (sp.getRates() != null && !sp.getRates().equals("")) {
- pl.setRates(sp.getRates());
- }
- if (sp.getAsk() != null && !sp.getAsk().equals("")) {
- pl.setAsk(sp.getAsk());
- }
- if (sp.getTell() != null && !sp.getTell().equals("")) {
- pl.setTell(sp.getTell());
- }
- if (sp.getPrice() != null && !sp.getPrice().equals("")) {
- pl.setPrice(sp.getPrice());
- }
- if (sp.getManHour() != null && !sp.getManHour().equals("")) {
- pl.setManHour(sp.getManHour());
- }
- if (sp.getSection() != null && !sp.getSection().equals("")) {
- pl.setSection(sp.getSection());
- }
- if (sp.getCores() != null && !sp.getCores().equals("")) {
- pl.setCores(sp.getCores());
- }
- if (sp.getConductorMaterial() != null && !sp.getConductorMaterial().equals("")) {
- pl.setConductorMaterial(sp.getConductorMaterial());
- }
- if (sp.getConductorType() != null && !sp.getConductorType().equals("")) {
- pl.setConductorType(sp.getConductorType());
- }
- if (sp.getTemplateId() != null && !sp.getTemplateId().equals("")) {
- pl.setTemplateId(sp.getTemplateId());
- }
+ // 鏌ヨ鏍囧噯搴撳凡缁戝畾妫�鏌ラ」鐩�
+ List<StandardProductList> standardProductList = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
+ .eq(StandardProductList::getStandardMethodListId, id)
+ .like(StandardProductList::getTree, tree)
+ .orderByAsc(StandardProductList::getSort));
+
+
+ // 灏佽鍙傛暟
+ List<StandardProductList> batchInsertStandardProductListArray = new ArrayList<>();
+ for (StructureItemParameter structureItemParameter : structureItemParameterList) {
+ StandardProductList addStandProductList = new StandardProductList();
+ boolean existFlag = false;
+ // 鍒ゆ柇鏄惁宸茬粦瀹�
+ for (StandardProductList productList : standardProductList) {
+ if(structureItemParameter.getId().equals(productList.getStructureItemParameterId())) {
+ BeanUtils.copyProperties(productList, addStandProductList);
+ existFlag = true;
break;
}
}
+ // 濡傛灉鏈粦瀹�
+ if(!existFlag){
+ BeanUtils.copyProperties(structureItemParameter, addStandProductList);
+ addStandProductList.setStructureItemParameterId(structureItemParameter.getId());
+
+ }
+ addStandProductList.setId(null);
+ batchInsertStandardProductListArray.add(addStandProductList);
+
}
- Integer userId = SecurityUtils.getUserId().intValue();
- if (trees.length == 5) {
- standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate()
+ // 鎺掑簭澶勭悊 宸叉湁椤哄簭鎸夌収鍘熼『搴� 娌℃湁椤哄簭鐨勬寜鐓ф楠岄」鐨刬d鍗囧簭锛岄粯璁ゆ帓鍦ㄦ渶鍚�
+ batchInsertStandardProductListArray.sort(Comparator.comparing((StandardProductList item) -> item.getSort() != null ? item.getSort() : Integer.MAX_VALUE)
+ .thenComparing(StandardProductList::getStructureItemParameterId));
+
+ // 鍒犻櫎鍘熺粦瀹氭暟鎹�
+ standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate()
.eq(StandardProductList::getStandardMethodListId, id)
.eq(StandardProductList::getTree, tree));
- } else {
- standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate()
- .eq(StandardProductList::getStandardMethodListId, id)
- .like(StandardProductList::getTree, tree));
+
+ for (int i = 0; i < batchInsertStandardProductListArray.size(); i++) {
+ StandardProductList productList = batchInsertStandardProductListArray.get(i);
+ productList.setTree(tree);
+ productList.setFactory(trees[0]);
+ productList.setLaboratory(trees[1]);
+ productList.setSampleType(sampleType);
+ productList.setSample(sample);
+ productList.setModel(model);
+ productList.setCreateUser(SecurityUtils.getUserId().intValue());
+ productList.setUpdateUser(SecurityUtils.getUserId().intValue());
+ productList.setStandardMethodListId(id);
+ productList.setSort(i);
}
-
-
- List<StandardProductList> productLists = list.stream().map(a -> {
- a.setFactory(trees[0]);
- a.setLaboratory(trees[1]);
- a.setSampleType(trees[2]);
- a.setCreateUser(userId);
- a.setUpdateUser(userId);
- a.setStandardMethodListId(id);
- return a;
- }).collect(Collectors.toList());
-// this.saveBatch(productLists);
// 鎵归噺娣诲姞鏍囧噯
- if (CollectionUtils.isNotEmpty(productLists)) {
- baseMapper.saveBatchProductLists(productLists);
+ if (CollectionUtils.isNotEmpty(batchInsertStandardProductListArray)) {
+ baseMapper.saveBatchProductLists(batchInsertStandardProductListArray);
}
-
-
- Collections.sort(list, (o1, o2) -> {
- String field1 = o1.getManHourGroup();
- String field2 = o2.getManHourGroup();
-
- boolean isEmpty1 = field1 == null || field1.isEmpty();
- boolean isEmpty2 = field2 == null || field2.isEmpty();
-
- if (isEmpty1 && isEmpty2) {
- return 0;
- } else if (isEmpty1) {
- return 1;
- } else if (isEmpty2) {
- return -1;
- } else {
- int num1 = extractNumber(field1);
- int num2 = extractNumber(field2);
- return Integer.compare(num1, num2);
- }
- });
- // 鎸夌収绱㈠紩鎺掑簭
- if (isDrag) {
- list.sort((o1, o2) -> (o1.getSort() == null ? 0 : o1.getSort())
- - (o2.getSort() == null ? 0 : o2.getSort()));
- }
-
- Map<String, Object> map = new HashMap<>();
- map.put("productList", list);
- map.put("total", list.size());
+ map.put("productList", batchInsertStandardProductListArray);
+ map.put("total", batchInsertStandardProductListArray.size());
return map;
}
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java
index 6ae6729..6c18db1 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java
@@ -202,7 +202,7 @@
}).collect(Collectors.toList());
List<BasicTreeDto> factoryList = new ArrayList<>();
factoryList.add(new BasicTreeDto(BasicTreeEnums.FACTORY_TYPE.getCode(),"涓ぉ绉戞妧","1",laboratoryTreeDtoList));
- return laboratoryTreeDtoList;
+ return factoryList;
}
diff --git a/basic-server/src/main/resources/mapper/StandardProductListMapper.xml b/basic-server/src/main/resources/mapper/StandardProductListMapper.xml
index cd27a11..0760977 100644
--- a/basic-server/src/main/resources/mapper/StandardProductListMapper.xml
+++ b/basic-server/src/main/resources/mapper/StandardProductListMapper.xml
@@ -29,7 +29,7 @@
</resultMap>
<!-- 鎵归噺娣诲姞妫�娴嬫爣鍑� -->
- <insert id="saveBatchProductLists">
+ <insert id="saveBatchProductLists" keyProperty="id" useGeneratedKeys="true">
INSERT INTO standard_product_list (id, inspection_item, inspection_item_en, inspection_item_subclass, inspection_item_subclass_en, factory, laboratory, sample_type, sample, model, son_laboratory, unit, price, man_hour, man_hour_group, inspection_item_type, inspection_value_type, checkout_number, section, cores, method, method_s, man_day, bsm, ask, tell, standard_method_list_id, template_id, state, dic, tree, structure_item_parameter_id, inspection_item_class, inspection_item_class_en, radius, radius_list, rates, sort, conductor_material, conductor_type)
VALUES
<foreach item="item" collection="productLists" open="(" separator="),(" close=")">
diff --git a/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml b/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml
index fd67dfc..117b826 100644
--- a/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml
+++ b/basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml
@@ -3,6 +3,40 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.StructureItemParameterMapper">
+ <sql id="selectStandardTree">
+ sample sample2,
+ inspection_item,
+ inspection_item_en,
+ inspection_item_subclass,
+ inspection_item_subclass_en,
+ inspection_item_class,
+ inspection_item_class_en,
+ method,
+ son_laboratory,
+ unit,
+ ask_tell tell,
+ ask,
+ price,
+ man_hour,
+ man_hour_group,
+ man_day,
+ inspection_item_type,
+ inspection_value_type,
+ bsm,
+ template_id,
+ laboratory,
+ checkout_number,
+ section,
+ dic,
+ 0 state,
+ #{trees}
+ tree,
+ id
+ structure_item_parameter_id,
+ radius_list,
+ rates
+ </sql>
+
<delete id="removeNoSample">
delete
from structure_item_parameter
@@ -118,4 +152,16 @@
<result column="pId" property="id"/>
<result column="pName" property="name"/>
</resultMap>
+
+ <select id="selectItemParameterBySample" resultType="com.ruoyi.basic.pojo.StructureItemParameter">
+ select *
+ from structure_item_parameter
+ where (
+ sample is NULL
+ OR sample = ''
+ or sample = '[]'
+ OR sample LIKE CONCAT('%', #{sample}, '%')
+ )
+ order by id asc
+ </select>
</mapper>
--
Gitblit v1.9.3