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/ProductServiceImpl.java | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 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 8f60368..7c484bb 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,6 +2,7 @@
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yuanchu.mom.mapper.TechniqueMapper;
import com.yuanchu.mom.mapper.TechnologyMapper;
import com.yuanchu.mom.pojo.Product;
import com.yuanchu.mom.pojo.dto.ProductDto;
@@ -9,6 +10,8 @@
import com.yuanchu.mom.mapper.ProductMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@@ -26,6 +29,9 @@
@Resource
TechnologyMapper technologyMapper;
+
+ @Resource
+ TechniqueMapper techniqueMapper;
//鏍规嵁鍨嬪彿id鏌ヨ椤圭洰(鎶�鏈寚鏍�)
@Override
@@ -47,8 +53,8 @@
//鍙充笂瑙掓柊澧�-->鎶�鏈寚鏍�-->閫夋嫨宸ュ簭,宸ヨ壓
@Override
- public List<Map<String, Object>> chooseTech(Integer specificationsId) {
- return technologyMapper.chooseTech(specificationsId);
+ public List<Map<String, Object>> chooseTech(Integer specificationsId, Integer version) {
+ return technologyMapper.chooseTech(specificationsId, version);
}
//鍙充笂瑙掓柊澧�-->鎶�鏈寚鏍�-->閫夋嫨椤圭洰鐖剁被
@@ -63,13 +69,13 @@
Product product = new Product();
String required = productDto.getRequired();
String internal = productDto.getInternal();
- if (ObjectUtils.isNotEmpty(required)){
+ if (ObjectUtils.isNotEmpty(required)) {
char requ = required.charAt(0);
if (requ != '>' && requ != '<' && requ != '=') {
return "鏍囧噯鍊艰緭鍏ユ牸寮忔湁闂!";
}
}
- if (ObjectUtils.isNotEmpty(internal)){
+ if (ObjectUtils.isNotEmpty(internal)) {
char inter = internal.charAt(0);
if (inter != '>' && inter != '<' && inter != '=') {
return "鍐呮帶鍊艰緭鍏ユ牸寮忔湁闂!";
@@ -84,14 +90,18 @@
@Override
public String write(Integer id, String required, String internal) {
//鏍¢獙鏍囧噯鍊�,鍐呮帶鍊兼牸寮�
+ if (ObjectUtils.isNotEmpty(internal)) {
char inter = internal.charAt(0);
- char requ = required.charAt(0);
if (inter != '>' && inter != '<' && inter != '=') {
return "鍐呮帶鍊艰緭鍏ユ牸寮忔湁闂!";
}
+ }
+ if (ObjectUtils.isNotEmpty(required)) {
+ char requ = required.charAt(0);
if (requ != '>' && requ != '<' && requ != '=') {
return "鏍囧噯鍊艰緭鍏ユ牸寮忔湁闂!";
}
+ }
Product product = new Product();
product.setId(id);
product.setRequired(required);
@@ -102,17 +112,25 @@
//鍒犻櫎
@Override
+ @Transactional(rollbackFor = Exception.class)
public void delProById(Integer id) {
+ //鍒犻櫎鎶�鏈寚鏍�
Product product = new Product();
product.setId(id);
product.setState(0);
productMapper.updateById(product);
+ //鍒犻櫎鐢熶骇宸ヨ壓
+ techniqueMapper.delByProId(id);
}
//鎵归噺鍒犻櫎
@Override
+ @Transactional(rollbackFor = Exception.class)
public void delAllPro(String ids) {
+ //鎵归噺鍒犻櫎鎶�鏈寚鏍�
productMapper.delAllPro(ids);
+ //鍒犻櫎鐢熶骇宸ヨ壓
+ techniqueMapper.delAll(ids);
}
//鏌ヨ鏍囧噯BOM鎶�鏈寚鏍囦腑璇ュ瀷鍙峰伐鑹轰笅鏈�鏂扮増鏈殑妫�楠岄」鐩�
--
Gitblit v1.9.3