From 22899f74279a47f4ec79e1325f8489d948ced005 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期五, 15 九月 2023 17:24:44 +0800
Subject: [PATCH] 修改2.0   9.15

---
 standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java b/standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java
index 8c07dba..714960b 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java
@@ -9,6 +9,7 @@
 import com.yuanchu.mom.service.*;
 import com.yuanchu.mom.utils.MyUtil;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.util.ArrayList;
@@ -62,6 +63,7 @@
 
     //(4绾�)鏂板-->鍨嬪彿
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public String addSpecifications(SpecificationsDto specificationsDto) {
         //鏍¢獙娣诲姞璇ユ爣鍑嗕笅鐨勫瀷鍙锋槸鍚﹂噸澶�
         List<String> specificationsNameList = specificationsMapper.selectList(Wrappers.<Specifications>query().eq("standard_id", specificationsDto.getId())).stream().map(specifications -> {
@@ -79,7 +81,17 @@
         /*鏂板鏍囧噯BOM-->宸ヨ壓璺嚎(鎵归噺娣诲姞)*/
         //鏍规嵁鏍囧噯id鏌ヨ鐗╂枡澶х被
         Material material = materialMapper.selFath(specificationsDto.getId());
-        List<TechnologyTemplate> technologyTemplateList = technologyTemplateMapper.selectList(Wrappers.<TechnologyTemplate>query().eq("type", material.getFather()));
+        Integer type = null;
+        if (material.getFather().equals("姗¤兌杩炴帴鍣�")){
+            type=0;
+        }else if (material.getFather().equals("閲戝睘杩炴帴鍣�")){
+            type=1;
+        }else if(material.getFather().equals("婀挎彃鎷旂數杩炴帴鍣�")){
+            type=2;
+        }else if(material.getFather().equals("鍒嗘敮缁勪欢")){
+            type=3;
+        }else return "娣诲姞鍨嬪彿銆�" + specificationsDto.getSpecifications() + "銆戞垚鍔�";
+        List<TechnologyTemplate> technologyTemplateList = technologyTemplateMapper.selectList(Wrappers.<TechnologyTemplate>query().eq("type",type));
         List<Technology> technologyList = technologyTemplateList.stream().map(technologyTemplate -> {
             Technology technology = new Technology();
             technology.setSpecificationsId(specifications.getId());
@@ -144,15 +156,6 @@
         }
         techniqueService.saveBatch(techniqueList);
         return "娣诲姞鍨嬪彿銆�"+ specificationsDto.getSpecifications() +"銆戞垚鍔燂紒";
-    }
-
-    /**
-     * 妫�楠屾ā鍧�-->QMS绠$悊-->鎴愬搧妫�楠�-->鏂板(闇�瑕佽鏍煎瀷鍙风殑Id涓庡悕绉�)
-     */
-    @Override
-    public List<Map<String, Object>> selectSpecificationIdAndName(Integer materialId) {
-        List<Map<String, Object>> maps = specificationsMapper.selectSpecificationIdAndName(materialId);
-        return maps;
     }
 
 }

--
Gitblit v1.9.3