From 6a19365f5dea396622b32afe28b3e4b9b067e0e1 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期五, 01 九月 2023 16:33:08 +0800
Subject: [PATCH] 标准BOM(完结)

---
 standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java |   79 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 72 insertions(+), 7 deletions(-)

diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java b/standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java
index 4ccc9d7..0a17c2f 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/impl/ProductServiceImpl.java
@@ -2,10 +2,13 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yuanchu.mom.mapper.TechnologyMapper;
 import com.yuanchu.mom.pojo.Product;
 import com.yuanchu.mom.pojo.dto.ProductDto;
 import com.yuanchu.mom.service.ProductService;
 import com.yuanchu.mom.mapper.ProductMapper;
+import com.yuanchu.mom.utils.MyUtil;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -13,15 +16,18 @@
 import java.util.Map;
 
 /**
-* @author Administrator
-* @description 閽堝琛ㄣ�恜roduct銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
-* @createDate 2023-07-26 16:00:44
-*/
+ * @author Administrator
+ * @description 閽堝琛ㄣ�恜roduct銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+ * @createDate 2023-07-26 16:00:44
+ */
 @Service
-public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService{
+public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService {
 
     @Resource
     private ProductMapper productMapper;
+
+    @Resource
+    TechnologyMapper technologyMapper;
 
     //鏍规嵁鍨嬪彿id鏌ヨ椤圭洰(鎶�鏈寚鏍�)
     @Override
@@ -37,8 +43,67 @@
 
     //鍙充晶鏁版嵁灞曠ず-->鎶�鏈寚鏍�(妫�楠岄」鐩�)
     @Override
-    public List<Map<String, Object>> selectAllPro(Integer specificationsId, Integer version,String message) {
-        return productMapper.selectAllPro(specificationsId,version,message);
+    public List<Map<String, Object>> selectAllPro(Integer specificationsId, Integer version, String message) {
+        return productMapper.selectAllPro(specificationsId, version, message);
+    }
+
+    //鍙充笂瑙掓柊澧�-->鎶�鏈寚鏍�-->閫夋嫨宸ュ簭,宸ヨ壓
+    @Override
+    public List<Map<String, Object>> chooseTech(Integer specificationsId) {
+        return technologyMapper.chooseTech(specificationsId);
+    }
+
+    //鍙充笂瑙掓柊澧�-->鎶�鏈寚鏍�-->閫夋嫨椤圭洰鐖剁被
+    @Override
+    public List<Map<String, Object>> chooseFather(Integer technologyId) {
+        return productMapper.chooseFather(technologyId);
+    }
+
+    //鍙充笂瑙掓柊澧�-->鎶�鏈寚鏍�
+    @Override
+    public void addProduct(Integer technologyId, ProductDto productDto) {
+        Product product = new Product();
+        BeanUtils.copyProperties(productDto, product);
+        product.setTechnologyId(technologyId);
+        productMapper.insert(product);
+    }
+
+    //濉啓鏍囧噯鍊间笌鍐呮帶鍊�,榧犳爣绉诲紑淇濆瓨
+    @Override
+    public Integer write(Integer id, String required, String internal) {
+        Product product = new Product();
+        product.setId(id);
+        product.setRequired(required);
+        product.setInternal(internal);
+        return productMapper.updateById(product);
+    }
+
+    //娣诲姞鍚屼竴涓瀷鍙锋妧鏈寚鏍囩殑鐗堟湰
+    @Override
+    public Integer addVersion(Integer specificationsId,Integer version) {
+        List<Product> productList = productMapper.selAllBySpeId(specificationsId,version);
+        for (Product product : productList) {
+            product.setId(null);
+            //鏈�鏂扮増鏈�+1
+            product.setVersion(productMapper.selectVerByPro(specificationsId).get(0)+1);
+        }
+        saveBatch(productList);
+        return productList.get(0).getVersion();
+    }
+
+    //鍒犻櫎
+    @Override
+    public void delProById(Integer id) {
+        Product product = new Product();
+        product.setId(id);
+        product.setState(0);
+        productMapper.updateById(product);
+    }
+
+    //鎵归噺鍒犻櫎
+    @Override
+    public void delAllPro(String ids) {
+        productMapper.delAllPro(ids);
     }
 }
 

--
Gitblit v1.9.3