From dd7cf6b7d8da76c7ceb0ae79fe57fb72ce1c3eb5 Mon Sep 17 00:00:00 2001
From: 李林 <z1292839451@163.com>
Date: 星期二, 05 三月 2024 17:57:15 +0800
Subject: [PATCH] 标准库开发完毕

---
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java        |   83 +++++++
 inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardProductList.java                    |  176 +++++++++++++++++
 inspect-server/src/main/java/com/yuanchu/mom/service/StandardProductListService.java          |   20 ++
 inspect-server/src/main/java/com/yuanchu/mom/service/StandardTreeService.java                 |    4 
 inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml                         |   23 ++
 inspect-server/src/main/resources/mapper/StandardProductListMapper.xml                        |   44 ++++
 inspect-server/src/main/resources/mapper/StandardTreeMapper.xml                               |   23 ++
 cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java                    |    2 
 inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java            |   18 +
 inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java             |    3 
 inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java                   |    3 
 inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardMethodList.java                     |    2 
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardMethodListServiceImpl.java  |   61 +++++
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java |   36 +++
 inspect-server/src/main/java/com/yuanchu/mom/service/StandardMethodListService.java           |    5 
 inspect-server/src/main/java/com/yuanchu/mom/controller/StandardTreeController.java           |   38 +++
 16 files changed, 525 insertions(+), 16 deletions(-)

diff --git a/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java b/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java
index 2a07001..8e4b1b1 100644
--- a/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java
+++ b/cnas-server/src/main/java/com/yuanchu/mom/pojo/StructureItemParameter.java
@@ -46,7 +46,7 @@
     private String unit;
 
     @ValueTableShow(5)
-    @ApiModelProperty(value = "璇曢獙鏂规硶")
+    @ApiModelProperty(value = "妫�楠屾爣鍑�")
     private String method;
 
     @ValueTableShow(6)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/controller/StandardTreeController.java b/inspect-server/src/main/java/com/yuanchu/mom/controller/StandardTreeController.java
index 48c9b10..c50d3a4 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/controller/StandardTreeController.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/controller/StandardTreeController.java
@@ -1,9 +1,12 @@
 package com.yuanchu.mom.controller;
 
-import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.yuanchu.mom.annotation.ValueAuth;
+import com.yuanchu.mom.pojo.StandardProductList;
 import com.yuanchu.mom.pojo.StandardTree;
 import com.yuanchu.mom.service.StandardMethodListService;
+import com.yuanchu.mom.service.StandardProductListService;
 import com.yuanchu.mom.service.StandardTreeService;
 import com.yuanchu.mom.vo.Result;
 import io.swagger.annotations.ApiOperation;
@@ -18,6 +21,8 @@
     private StandardTreeService standardTreeService;
 
     private StandardMethodListService standardMethodListService;
+
+    private StandardProductListService standardProductListService;
 
     @ApiOperation(value = "鑾峰彇鏍囧噯鏍�")
     @GetMapping("/selectStandardTreeList")
@@ -45,4 +50,35 @@
         return Result.success(standardMethodListService.selectsStandardMethodByFLSSM(tree));
     }
 
+    @ApiOperation(value = "淇敼鏍囧噯搴撲腑鐨勮姹傚��")
+    @PostMapping("/upStandardProductList")
+    public Result upStandardProductList(@RequestBody StandardProductList list){
+        return Result.success(standardProductListService.upStandardProductList(list));
+    }
+
+    @ApiOperation(value = "鍒犻櫎鏍囧噯鏍戜笅鐨勬楠屾爣鍑�")
+    @PostMapping("/delStandardMethodByFLSSM")
+    public Result delStandardMethodByFLSSM(Integer id){
+        return Result.success(standardMethodListService.delStandardMethodByFLSSM(id));
+    }
+
+    @ApiOperation(value = "鍒犻櫎鏍囧噯鏍戜笅鐨勬楠岄」鐩�")
+    @PostMapping("/delStandardProductByIds")
+    public Result delStandardProductByIds(String ids){
+        JSONArray lists = JSON.parseArray(ids);
+        return Result.success(standardProductListService.delStandardProduct(lists));
+    }
+
+    @ApiOperation(value = "鏂板鏍囧噯鏍戜笅鐨勬楠岄」鐩�")
+    @PostMapping("/addStandardProduct")
+    public Result addStandardProduct(String ids, String tree){
+        return Result.success(standardTreeService.addStandardProduct(ids, tree));
+    }
+
+    @ApiOperation(value = "鍒犻櫎鏍囧噯鏍戠殑灞傜骇")
+    @PostMapping("/delStandardTree")
+    public Result delStandardTree(String tree){
+        return Result.success(standardTreeService.delStandardTree(tree));
+    }
+
 }
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java
index 5f4e755..4ccc5db 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardMethodListMapper.java
@@ -2,6 +2,7 @@
 
 import com.yuanchu.mom.pojo.StandardMethodList;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.yuanchu.mom.pojo.StandardProductList;
 
 import java.util.List;
 import java.util.Map;
@@ -20,6 +21,8 @@
 
     List<StandardMethodList> selectStandardMethodLists(String data1,String data2,String data3,String data4, String data5);
 
+    List<StandardProductList> selectParameterList(String code);
+
 }
 
 
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java
new file mode 100644
index 0000000..5247bc5
--- /dev/null
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardProductListMapper.java
@@ -0,0 +1,18 @@
+package com.yuanchu.mom.mapper;
+
+import com.yuanchu.mom.pojo.StandardProductList;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恠tandard_product_list(鏍囧噯鏍戜笅鐨勬楠岄」鐩�)銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2024-03-05 10:33:29
+* @Entity com.yuanchu.mom.pojo.StandardProductList
+*/
+public interface StandardProductListMapper extends BaseMapper<StandardProductList> {
+
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
index 66cf8d6..41b3e83 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/mapper/StandardTreeMapper.java
@@ -1,6 +1,7 @@
 package com.yuanchu.mom.mapper;
 
 import com.yuanchu.mom.dto.FactoryDto;
+import com.yuanchu.mom.pojo.StandardProductList;
 import com.yuanchu.mom.pojo.StandardTree;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
@@ -16,6 +17,8 @@
 
     List<FactoryDto> selectStandardTreeList();
 
+    StandardProductList selectStandardProductById(Integer id);
+
 }
 
 
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardMethodList.java b/inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardMethodList.java
index 9b08ee7..7fb8fe1 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardMethodList.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardMethodList.java
@@ -50,7 +50,7 @@
     private String laboratory;
 
     @ApiModelProperty("鏍峰搧鍒嗙被")
-    private String sample_type;
+    private String sampleType;
 
     @ApiModelProperty("鏍峰搧")
     private String sample;
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardProductList.java b/inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardProductList.java
new file mode 100644
index 0000000..ba54bf8
--- /dev/null
+++ b/inspect-server/src/main/java/com/yuanchu/mom/pojo/StandardProductList.java
@@ -0,0 +1,176 @@
+package com.yuanchu.mom.pojo;
+
+import com.baomidou.mybatisplus.annotation.*;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 鏍囧噯鏍戜笅鐨勬楠岄」鐩�
+ * @TableName standard_product_list
+ */
+@TableName(value ="standard_product_list")
+@Data
+public class StandardProductList implements Serializable {
+    /**
+     * 涓婚敭id
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 妫�楠岄」
+     */
+    @ApiModelProperty("妫�楠岄」")
+    private String inspectionItem;
+
+    /**
+     * 妫�楠岄」鍒嗙被
+     */
+    @ApiModelProperty("妫�楠岄」鍒嗙被")
+    private String inspectionItemClassify;
+
+    /**
+     * 妫�楠岄」灏忕被
+     */
+    @ApiModelProperty("妫�楠岄」灏忕被")
+    private String inspectionItemSubclass;
+
+    /**
+     * 瀹為獙瀹�
+     */
+    @ApiModelProperty("瀹為獙瀹�")
+    private String laboratory;
+
+    /**
+     * 璁¢噺鍗曚綅
+     */
+    @ApiModelProperty("璁¢噺鍗曚綅")
+    private String unit;
+
+    /**
+     * 鍗曚环(鍏�)
+     */
+    @ApiModelProperty("鍗曚环")
+    private BigDecimal price;
+
+    /**
+     * 宸ユ椂(H)
+     */
+    @ApiModelProperty("宸ユ椂")
+    private Integer manHour;
+
+    /**
+     * 宸ユ椂鍒嗙粍
+     */
+    @ApiModelProperty("宸ユ椂鍒嗙粍")
+    private String manHourGroup;
+
+    /**
+     * 妫�楠岄」绫诲瀷
+     */
+    @ApiModelProperty("妫�楠岄」绫诲瀷")
+    private String inspectionItemType;
+
+    /**
+     * 妫�楠屽�肩被鍨�
+     */
+    @ApiModelProperty("妫�楠屽�肩被鍨�")
+    private String inspectionValueType;
+
+    /**
+     * 璁惧缁�
+     */
+    @ApiModelProperty("璁惧缁�")
+    private String deviceGroup;
+
+    /**
+     * 妫�楠屾鏁�
+     */
+    @ApiModelProperty("妫�楠屾鏁�")
+    private Integer checkoutNumber;
+
+    /**
+     * 鍖洪棿
+     */
+    @ApiModelProperty("鍖洪棿")
+    private String section;
+
+    /**
+     * 鍙栧�肩被鍨�
+     */
+    @ApiModelProperty("鍙栧�肩被鍨�")
+    private String valueType;
+
+    /**
+     * 鏂规硶
+     */
+    @ApiModelProperty("鏂规硶")
+    private String method;
+
+    /**
+     * 棰勮鏃堕棿(澶�)
+     */
+    @ApiModelProperty("棰勮鏃堕棿")
+    private Integer manDay;
+
+    /**
+     * 鐗规畩鏍囪瘑
+     */
+    @ApiModelProperty("鐗规畩鏍囪瘑")
+    private String bsm;
+
+    /**
+     * 瑕佹眰鍊�
+     */
+    @ApiModelProperty("瑕佹眰鍊�")
+    private String ask;
+
+    /**
+     * 澶栭敭锛氭爣鍑嗘柟娉昳d
+     */
+    @ApiModelProperty("鏍囧噯鏂规硶id")
+    private Integer standardMethodListId;
+
+    @ApiModelProperty("宸ュ巶")
+    private String factory;
+
+    @ApiModelProperty("鏍峰搧鍒嗙被")
+    private String sampleType;
+
+    @ApiModelProperty("鏍峰搧")
+    private String sample;
+
+    @ApiModelProperty("鍨嬪彿")
+    private String model;
+
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.INSERT)
+    private Integer createUser;
+    /**
+     *
+     */
+    @ApiModelProperty("鍒涘缓鏃堕棿")
+    @TableField(fill = FieldFill.INSERT)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime createTime;
+    /**
+     *
+     */
+    @ApiModelProperty("")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    private Integer updateUser;
+    /**
+     *
+     */
+    @ApiModelProperty("淇敼鏃堕棿")
+    @TableField(fill = FieldFill.INSERT_UPDATE)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime updateTime;
+}
\ No newline at end of file
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/StandardMethodListService.java b/inspect-server/src/main/java/com/yuanchu/mom/service/StandardMethodListService.java
index 086ec95..7a72e53 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/StandardMethodListService.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/StandardMethodListService.java
@@ -2,8 +2,10 @@
 
 import com.yuanchu.mom.pojo.StandardMethodList;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.yuanchu.mom.pojo.StandardProductList;
 
 import java.util.List;
+import java.util.Map;
 
 /**
 * @author Administrator
@@ -14,6 +16,7 @@
 
     int addStandardMethodList(Integer standardId, String tree);
 
-    List<StandardMethodList> selectsStandardMethodByFLSSM(String tree);
+    Map<String, List<?>> selectsStandardMethodByFLSSM(String tree);
 
+    int delStandardMethodByFLSSM(Integer id);
 }
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/StandardProductListService.java b/inspect-server/src/main/java/com/yuanchu/mom/service/StandardProductListService.java
new file mode 100644
index 0000000..8d547a1
--- /dev/null
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/StandardProductListService.java
@@ -0,0 +1,20 @@
+package com.yuanchu.mom.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.yuanchu.mom.pojo.StandardProductList;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.ArrayList;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恠tandard_product_list(鏍囧噯鏍戜笅鐨勬楠岄」鐩�)銆戠殑鏁版嵁搴撴搷浣淪ervice
+* @createDate 2024-03-05 10:33:29
+*/
+public interface StandardProductListService extends IService<StandardProductList> {
+
+    int upStandardProductList(StandardProductList list);
+
+    int delStandardProduct(JSONArray list);
+
+}
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/StandardTreeService.java b/inspect-server/src/main/java/com/yuanchu/mom/service/StandardTreeService.java
index a3b195b..7ebb3f8 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/StandardTreeService.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/StandardTreeService.java
@@ -17,4 +17,8 @@
 
     int addStandardTree(StandardTree standardTree);
 
+    int delStandardTree(String tree);
+
+    int addStandardProduct(String ids, String tree);
+
 }
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 98799f9..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
@@ -2,12 +2,17 @@
 
 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;
 
@@ -23,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);
@@ -32,37 +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 List<StandardMethodList> selectsStandardMethodByFLSSM(String tree) {
+    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;
         }
-        return standardMethodLists;
+        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);
     }
 }
 
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
new file mode 100644
index 0000000..db9964b
--- /dev/null
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardProductListServiceImpl.java
@@ -0,0 +1,36 @@
+package com.yuanchu.mom.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yuanchu.mom.pojo.StandardProductList;
+import com.yuanchu.mom.service.StandardProductListService;
+import com.yuanchu.mom.mapper.StandardProductListMapper;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+
+/**
+* @author Administrator
+* @description 閽堝琛ㄣ�恠tandard_product_list(鏍囧噯鏍戜笅鐨勬楠岄」鐩�)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+* @createDate 2024-03-05 10:33:29
+*/
+@Service
+@AllArgsConstructor
+public class StandardProductListServiceImpl extends ServiceImpl<StandardProductListMapper, StandardProductList>
+    implements StandardProductListService{
+
+    private StandardProductListMapper standardProductListMapper;
+
+    @Override
+    public int upStandardProductList(StandardProductList list) {
+        return standardProductListMapper.updateById(list);
+    }
+
+    @Override
+    public int delStandardProduct(JSONArray list) {
+        return standardProductListMapper.deleteBatchIds(list);
+    }
+}
+
+
+
+
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
index 139ce93..a7432b1 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/StandardTreeServiceImpl.java
@@ -1,26 +1,43 @@
 package com.yuanchu.mom.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yuanchu.mom.dto.FactoryDto;
+import com.yuanchu.mom.mapper.StandardMethodListMapper;
+import com.yuanchu.mom.mapper.StandardProductListMapper;
+import com.yuanchu.mom.pojo.StandardMethodList;
+import com.yuanchu.mom.pojo.StandardProductList;
 import com.yuanchu.mom.pojo.StandardTree;
+import com.yuanchu.mom.service.StandardMethodListService;
 import com.yuanchu.mom.service.StandardTreeService;
 import com.yuanchu.mom.mapper.StandardTreeMapper;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
-* @author Administrator
-* @description 閽堝琛ㄣ�恠tandard_tree(鏍囧噯鏍�)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
-* @createDate 2024-03-01 15:06:44
-*/
+ * @author Administrator
+ * @description 閽堝琛ㄣ�恠tandard_tree(鏍囧噯鏍�)銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+ * @createDate 2024-03-01 15:06:44
+ */
 @Service
 @AllArgsConstructor
 public class StandardTreeServiceImpl extends ServiceImpl<StandardTreeMapper, StandardTree>
-    implements StandardTreeService{
+        implements StandardTreeService {
 
     private StandardTreeMapper standardTreeMapper;
+
+    private StandardMethodListMapper standardMethodListMapper;
+
+    private StandardMethodListService standardMethodListService;
+
+    private StandardProductListMapper standardProductListMapper;
 
     @Override
     public List<FactoryDto> selectStandardTreeList() {
@@ -31,6 +48,62 @@
     public int addStandardTree(StandardTree standardTree) {
         return standardTreeMapper.insert(standardTree);
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public int delStandardTree(String tree) {
+        String[] trees = tree.split(" - ");
+        switch (trees.length) {
+            case 5:
+                standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]).eq(StandardTree::getModel, trees[4]));
+                break;
+            case 4:
+                standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
+                break;
+            case 3:
+                standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]));
+                break;
+            case 2:
+                standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]));
+                break;
+            case 1:
+                standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]));
+                break;
+        }
+        Map<String, List<?>> listMap = standardMethodListService.selectsStandardMethodByFLSSM(tree);
+        if(listMap.get("standardMethodList").size() != 0){
+            standardMethodListMapper.deleteBatchIds(listMap.get("standardMethodList"));
+        }
+        if(listMap.get("standardProductList").size() != 0){
+            standardProductListMapper.deleteBatchIds(listMap.get("standardProductList"));
+        }
+        return 1;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public int addStandardProduct(String ids, String tree) {
+        String[] trees = tree.split(" - ");
+        JSONArray jsonArray = JSON.parseArray(ids);
+        for (Object o : jsonArray) {
+            StandardProductList standardProductList = standardTreeMapper.selectStandardProductById(Integer.parseInt("" + o));
+            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;
+    }
 }
 
 
diff --git a/inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml b/inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml
index 7b812d4..f3e6d1d 100644
--- a/inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml
+++ b/inspect-server/src/main/resources/mapper/StandardMethodListMapper.xml
@@ -9,7 +9,6 @@
         <result property="code" column="code" jdbcType="VARCHAR"/>
         <result property="name" column="name" jdbcType="VARCHAR"/>
         <result property="remark" column="remark" jdbcType="VARCHAR"/>
-        <result property="standardTreeId" column="standard_tree_id" jdbcType="INTEGER"/>
         <result property="createUser" column="create_user" jdbcType="INTEGER"/>
         <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
         <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
@@ -49,4 +48,26 @@
             and model = #{data5}
         </if>
     </select>
+    <select id="selectParameterList" resultType="standardProductList">
+        select
+               inspection_item,
+               inspection_item_classify,
+               inspection_item_subclass,
+               laboratory,
+               unit,
+               price,
+               man_hour,
+               man_hour_group,
+               inspection_item_type,
+               inspection_value_type,
+               device_group,
+               checkout_number,
+               section,
+               value_type,
+               method,
+               man_day,
+               bsm
+        from structure_item_parameter
+        where method = #{code}
+    </select>
 </mapper>
diff --git a/inspect-server/src/main/resources/mapper/StandardProductListMapper.xml b/inspect-server/src/main/resources/mapper/StandardProductListMapper.xml
new file mode 100644
index 0000000..dfdbe58
--- /dev/null
+++ b/inspect-server/src/main/resources/mapper/StandardProductListMapper.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.yuanchu.mom.mapper.StandardProductListMapper">
+
+    <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.StandardProductList">
+            <id property="id" column="id" jdbcType="INTEGER"/>
+            <result property="inspectionItem" column="inspection_item" jdbcType="VARCHAR"/>
+            <result property="inspectionItemClassify" column="inspection_item_classify" jdbcType="VARCHAR"/>
+            <result property="inspectionItemSubclass" column="inspection_item_subclass" jdbcType="VARCHAR"/>
+            <result property="laboratory" column="laboratory" jdbcType="VARCHAR"/>
+            <result property="unit" column="unit" jdbcType="VARCHAR"/>
+            <result property="price" column="price" jdbcType="DECIMAL"/>
+            <result property="manHour" column="man_hour" jdbcType="INTEGER"/>
+            <result property="manHourGroup" column="man_hour_group" jdbcType="VARCHAR"/>
+            <result property="inspectionItemType" column="inspection_item_type" jdbcType="VARCHAR"/>
+            <result property="inspectionValueType" column="inspection_value_type" jdbcType="VARCHAR"/>
+            <result property="deviceGroup" column="device_group" jdbcType="VARCHAR"/>
+            <result property="checkoutNumber" column="checkout_number" jdbcType="INTEGER"/>
+            <result property="section" column="section" jdbcType="VARCHAR"/>
+            <result property="valueType" column="value_type" jdbcType="VARCHAR"/>
+            <result property="method" column="method" jdbcType="VARCHAR"/>
+            <result property="manDay" column="man_day" jdbcType="INTEGER"/>
+            <result property="bsm" column="bsm" jdbcType="VARCHAR"/>
+            <result property="ask" column="ask" jdbcType="VARCHAR"/>
+            <result property="standardMethodListId" column="standard_method_list_id" jdbcType="INTEGER"/>
+            <result property="createUser" column="create_user" jdbcType="INTEGER"/>
+            <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,inspection_item,inspection_item_classify,
+        inspection_item_subclass,laboratory,unit,
+        price,man_hour,man_hour_group,
+        inspection_item_type,inspection_value_type,device_group,
+        checkout_number,section,value_type,
+        method,man_day,bsm,
+        ask,standard_method_list_id,create_user,
+        update_user,create_time,update_time
+    </sql>
+</mapper>
diff --git a/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml b/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
index 1d093f8..5be0059 100644
--- a/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
+++ b/inspect-server/src/main/resources/mapper/StandardTreeMapper.xml
@@ -49,4 +49,27 @@
     <select id="selectStandardTreeList" resultMap="FactoryDto">
         select factory,laboratory,sample_type,sample,model from standard_tree
     </select>
+
+    <select id="selectStandardProductById" resultType="com.yuanchu.mom.pojo.StandardProductList">
+        select
+            inspection_item,
+            inspection_item_classify,
+            inspection_item_subclass,
+            laboratory,
+            unit,
+            price,
+            man_hour,
+            man_hour_group,
+            inspection_item_type,
+            inspection_value_type,
+            device_group,
+            checkout_number,
+            section,
+            value_type,
+            method,
+            man_day,
+            bsm
+        from structure_item_parameter
+        where id = #{id}
+    </select>
 </mapper>

--
Gitblit v1.9.3