From 04b2dab7ecdc9aefde84db18f3cf0029b1db7eb2 Mon Sep 17 00:00:00 2001
From: gaoaoy <1042166043@qq.com>
Date: 星期二, 05 三月 2024 17:59:16 +0800
Subject: [PATCH] 6 设备工具明细BUG修改
---
inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java | 83 +++++++++++++++++++++++++++++++++++++++--
1 files changed, 79 insertions(+), 4 deletions(-)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java
index 839d1ca..805c36f 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java
@@ -1,12 +1,19 @@
package com.yuanchu.mom.service.impl;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yuanchu.mom.mapper.StandardProductListMapper;
import com.yuanchu.mom.pojo.StandardMethodList;
+import com.yuanchu.mom.pojo.StandardProductList;
import com.yuanchu.mom.service.StandardMethodListService;
import com.yuanchu.mom.mapper.StandardMethodListMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
import java.util.Map;
/**
@@ -21,7 +28,10 @@
private StandardMethodListMapper standardMethodListMapper;
+ private StandardProductListMapper standardProductListMapper;
+
@Override
+ @Transactional(rollbackFor = Exception.class)
public int addStandardMethodList(Integer standardId, String tree) {
String[] trees = tree.split(" - ");
Map<String, String> map = standardMethodListMapper.selectStandardMethodById(standardId);
@@ -30,13 +40,78 @@
list.setName(map.get("name"));
list.setRemark(map.get("remark"));
list.setFactory(trees[0]);
- list.setLaboratory(trees[1]);
- list.setSample_type(trees[2]);
- list.setSample(trees[3]);
+ try {
+ list.setLaboratory(trees[1]);
+ }catch (Exception e){}
+ try {
+ list.setSampleType(trees[2]);
+ }catch (Exception e){}
+ try {
+ list.setSample(trees[3]);
+ }catch (Exception e){}
try {
list.setModel(trees[4]);
}catch (Exception e){}
- return standardMethodListMapper.insert(list);
+ standardMethodListMapper.insert(list);
+ List<StandardProductList> standardProductLists = standardMethodListMapper.selectParameterList(list.getCode());
+ for (StandardProductList standardProductList : standardProductLists) {
+ standardProductList.setStandardMethodListId(list.getId());
+ standardProductList.setFactory(trees[0]);
+ try {
+ standardProductList.setLaboratory(trees[1]);
+ }catch (Exception e){}
+ try {
+ standardProductList.setSampleType(trees[2]);
+ }catch (Exception e){}
+ try {
+ standardProductList.setSample(trees[3]);
+ }catch (Exception e){}
+ try {
+ standardProductList.setModel(trees[4]);
+ }catch (Exception e){}
+ standardProductListMapper.insert(standardProductList);
+ }
+ return 1;
+ }
+
+ @Override
+ public Map<String, List<?>> selectsStandardMethodByFLSSM(String tree) {
+ String[] trees = tree.split(" - ");
+ List<StandardMethodList> standardMethodLists = null;
+ List<StandardProductList> standardProductLists = null;
+ switch (trees.length){
+ case 5:
+ standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],trees[2],trees[3],trees[4]);
+ standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getFactory, trees[0]).eq(StandardProductList::getLaboratory, trees[1]).eq(StandardProductList::getSampleType, trees[2]).eq(StandardProductList::getSample, trees[3]).eq(StandardProductList::getModel, trees[4]));
+ break;
+ case 4:
+ standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],trees[2],trees[3],null);
+ standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getFactory, trees[0]).eq(StandardProductList::getLaboratory, trees[1]).eq(StandardProductList::getSampleType, trees[2]).eq(StandardProductList::getSample, trees[3]));
+ break;
+ case 3:
+ standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],trees[2],null,null);
+ standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getFactory, trees[0]).eq(StandardProductList::getLaboratory, trees[1]).eq(StandardProductList::getSampleType, trees[2]));
+ break;
+ case 2:
+ standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],trees[1],null,null,null);
+ standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getFactory, trees[0]).eq(StandardProductList::getLaboratory, trees[1]));
+ break;
+ case 1:
+ standardMethodLists = standardMethodListMapper.selectStandardMethodLists(trees[0],null,null,null,null);
+ standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery().eq(StandardProductList::getFactory, trees[0]));
+ break;
+ }
+ Map<String, List<?>> map = new HashMap<>();
+ map.put("standardMethodList", standardMethodLists);
+ map.put("standardProductList", standardProductLists);
+ return map;
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public int delStandardMethodByFLSSM(Integer id) {
+ standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id));
+ return standardMethodListMapper.deleteById(id);
}
}
--
Gitblit v1.9.3