From cbf4b74927fe51c19c307d89b326ae999cb6a165 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期二, 12 九月 2023 17:50:25 +0800
Subject: [PATCH] 修改   9.12

---
 standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java |  114 +++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 102 insertions(+), 12 deletions(-)

diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java b/standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java
index 38a5bfb..c70ee4b 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/impl/TechnologyServiceImpl.java
@@ -2,19 +2,25 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
-import com.yuanchu.mom.pojo.Technology;
-import com.yuanchu.mom.mapper.TechnologyMapper;
-import com.yuanchu.mom.service.TechnologyService;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.yuanchu.mom.mapper.*;
+import com.yuanchu.mom.pojo.*;
+import com.yuanchu.mom.pojo.dto.TechnologyDto;
+import com.yuanchu.mom.service.*;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * <p>
- *  鏈嶅姟瀹炵幇绫�
+ * 鏈嶅姟瀹炵幇绫�
  * </p>
  *
  * @author 姹熻嫃榈烽洀缃戠粶绉戞妧鏈夐檺鍏徃
@@ -24,15 +30,99 @@
 public class TechnologyServiceImpl extends ServiceImpl<TechnologyMapper, Technology> implements TechnologyService {
 
     @Resource
-    private TechnologyMapper technologyMapper;
+    TechnologyMapper technologyMapper;
 
+    @Resource
+    DeviceMapper deviceMapper;
+
+    @Resource
+    ProductMapper productMapper;
+
+    @Resource
+    MbomMapper mbomMapper;
+
+    @Resource
+    TechniqueMapper techniqueMapper;
+
+
+    //鏍规嵁鍨嬪彿id鏌ヨ鐗堟湰
     @Override
-    public List<Map<String, Object>> selectTechnology(String technologyName) {
-        LambdaQueryWrapper<Technology> wrapper = new LambdaQueryWrapper<>();
-        if (!ObjectUtils.isEmpty(technologyName)){
-            wrapper.like(Technology::getName, technologyName);
-        }
-        wrapper.select(Technology::getId, Technology::getName, Technology::getDeviceGroup, Technology::getFather);
-        return technologyMapper.selectMaps(wrapper);
+    public List<Integer> selectVerByTec(Integer specificationsId) {
+        return technologyMapper.selectVerByTec(specificationsId);
+    }
+
+    //鍙充晶鏁版嵁灞曠ず-->宸ヨ壓璺嚎
+    @Override
+    public List<Map<String, Object>> selectAllTec(Integer specificationsId, Integer version, String message) {
+        return technologyMapper.selectAllTec(specificationsId, version, message);
+    }
+
+    //鍙充笂瑙掓柊澧�-->宸ヨ壓璺嚎-->閫夋嫨璁惧缁�
+    @Override
+    public List<Map<String, Object>> chooseDevice() {
+        return deviceMapper.chooseDevGroup();
+    }
+
+    //鍙充笂瑙掓柊澧�-->宸ヨ壓璺嚎-->閫夋嫨宸ュ簭
+    @Override
+    public List<Map<String, Object>> chooseFather(Integer specificationsId) {
+        return technologyMapper.chooseFather(specificationsId);
+    }
+
+    //鍙充笂瑙掓柊澧�-->宸ヨ壓璺嚎
+    @Override
+    public void addTechnology(TechnologyDto technologyDto) {
+        Technology technology = new Technology();
+        BeanUtils.copyProperties(technologyDto, technology);
+        technologyMapper.insert(technology);
+    }
+
+    //濉啓鐢熶骇瀹氶,榧犳爣绉诲紑淇濆瓨
+    @Override
+    public Integer write(Integer id, Integer productionQuota) {
+        Technology technology = new Technology();
+        technology.setId(id);
+        technology.setProductionQuota(productionQuota);
+        return technologyMapper.updateById(technology);
+    }
+
+    //鍒犻櫎
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void delTechById(Integer id) {
+        //鍒犻櫎宸ヨ壓璺嚎琛�
+        Technology technology = new Technology();
+        technology.setId(id);
+        technology.setState(0);
+        technologyMapper.updateById(technology);
+        //鍒犻櫎鎶�鏈寚鏍囪〃
+        productMapper.delProByTecId(id);
+        //鍒犻櫎鐗╂枡娓呭崟琛�
+        mbomMapper.delMbomByTecId(id);
+        //鍒犻櫎鐢熶骇宸ヨ壓琛�
+        techniqueMapper.delTeqByTecId(id);
+    }
+
+    //鎵归噺鍒犻櫎
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void delAllTech(String ids) {
+        //鎵归噺鍒犻櫎宸ヨ壓璺嚎琛�
+        technologyMapper.delAllTech(ids);
+        //鎵归噺鍒犻櫎鎶�鏈寚鏍囪〃
+        productMapper.delAllByTechId(ids);
+        //鎵归噺鍒犻櫎鐗╂枡娓呭崟琛�
+        mbomMapper.delAllByTecId(ids);
+        //鎵归噺鍒犻櫎鐢熶骇宸ヨ壓琛�
+        techniqueMapper.delAllByTecId(ids);
+    }
+
+    //閫夋嫨璁惧缁�,榧犳爣绉诲紑淇濆瓨
+    @Override
+    public Integer writeDevice(Integer id, String deviceGroup) {
+        Technology technology = new Technology();
+        technology.setId(id);
+        technology.setDeviceGroup(deviceGroup);
+        return technologyMapper.updateById(technology);
     }
 }

--
Gitblit v1.9.3