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/TechnologyServiceImpl.java | 47 ++++++++++++++++++++++++++---------------------
1 files changed, 26 insertions(+), 21 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 f713884..a40cf8f 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
@@ -4,17 +4,19 @@
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yuanchu.mom.mapper.*;
-import com.yuanchu.mom.pojo.Technology;
+import com.yuanchu.mom.pojo.*;
import com.yuanchu.mom.pojo.dto.TechnologyDto;
-import com.yuanchu.mom.service.TechnologyService;
+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>
@@ -63,17 +65,26 @@
//鍙充笂瑙掓柊澧�-->宸ヨ壓璺嚎-->閫夋嫨宸ュ簭
@Override
- public List<Map<String, Object>> chooseFather(Integer specificationsId) {
- return technologyMapper.chooseFather(specificationsId);
+ public List<Map<String, Object>> chooseFather(Integer specificationsId,Integer version) {
+ return technologyMapper.chooseFather(specificationsId,version);
}
//鍙充笂瑙掓柊澧�-->宸ヨ壓璺嚎
@Override
- public void addTechnology(Integer specificationsId, TechnologyDto technologyDto) {
+ public String addTechnology(TechnologyDto technologyDto) {
+ /*鏍¢獙鏄惁娣诲姞閲嶅*/
+ if (ObjectUtils.isNotEmpty(technologyMapper.selectList(Wrappers.<Technology>query()
+ .eq("version", technologyDto.getVersion())
+ .eq("state", 1)
+ .eq("specifications_id",technologyDto.getSpecificationsId())
+ .eq("father", technologyDto.getFather())
+ .eq("name", technologyDto.getName())))) {
+ return "閲嶅娣诲姞!";
+ }
Technology technology = new Technology();
BeanUtils.copyProperties(technologyDto, technology);
- technology.setSpecificationsId(specificationsId);
technologyMapper.insert(technology);
+ return "娣诲姞宸ヨ壓銆�"+ technologyDto.getName() +"銆戞垚鍔�";
}
//濉啓鐢熶骇瀹氶,榧犳爣绉诲紑淇濆瓨
@@ -83,21 +94,6 @@
technology.setId(id);
technology.setProductionQuota(productionQuota);
return technologyMapper.updateById(technology);
- }
-
- //娣诲姞鍚屼竴涓瀷鍙峰伐鑹鸿矾绾跨殑鐗堟湰
- @Override
- public Integer addVersion(Integer specificationsId, Integer version) {
- List<Technology> technologyList = technologyMapper.selectList(Wrappers.<Technology>query()
- .eq("specifications_id", specificationsId)
- .eq("version", version));
- for (Technology technology : technologyList) {
- technology.setId(null);
- //鏈�鏂扮増鏈�+!
- technology.setVersion(technologyMapper.selectVerByTec(specificationsId).get(0) + 1);
- }
- saveBatch(technologyList);
- return technologyList.get(0).getVersion();
}
//鍒犻櫎
@@ -130,4 +126,13 @@
//鎵归噺鍒犻櫎鐢熶骇宸ヨ壓琛�
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