From 2d6a0cdcb1e31510a6f7776abab17cc5cb82fdcb Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期三, 13 九月 2023 17:50:04 +0800
Subject: [PATCH] 修改2.0 9.13
---
base-server/src/main/java/com/yuanchu/mom/service/impl/TechnicalModelServiceImpl.java | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/base-server/src/main/java/com/yuanchu/mom/service/impl/TechnicalModelServiceImpl.java b/base-server/src/main/java/com/yuanchu/mom/service/impl/TechnicalModelServiceImpl.java
index e15387a..dc893c3 100644
--- a/base-server/src/main/java/com/yuanchu/mom/service/impl/TechnicalModelServiceImpl.java
+++ b/base-server/src/main/java/com/yuanchu/mom/service/impl/TechnicalModelServiceImpl.java
@@ -2,11 +2,13 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.mapper.TechnicalModelMapper;
+import com.yuanchu.mom.mapper.TechniqueModelMapper;
import com.yuanchu.mom.pojo.TechnicalModel;
import com.yuanchu.mom.pojo.dto.TechnicalModelDto;
import com.yuanchu.mom.service.TechnicalModelService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@@ -23,6 +25,9 @@
@Resource
TechnicalModelMapper technicalModelMapper;
+
+ @Resource
+ TechniqueModelMapper techniqueModelMapper;
//鏌ヨ鎶�鏈寚鏍囩淮鎶ゅ垪琛�-->宸﹁竟浜岀骇灞曠ず宸ュ簭鍜屽伐鑹�
@Override
@@ -51,10 +56,13 @@
//鏂板鎶�鏈寚鏍囩淮鎶�
@Override
- public void addTechMode(Integer id, TechnicalModelDto technicalModelDto) {
- TechnicalModel technicalModel = new TechnicalModel();
- BeanUtils.copyProperties(technicalModelDto, technicalModel);
- technicalModel.setTechTemId(id);
+ public void addTechMode(TechnicalModelDto technicalModelDto) {
+ TechnicalModel technicalModel = TechnicalModel.builder()
+ .techTemId(technicalModelDto.getTechTemId())
+ .father(technicalModelDto.getFather())
+ .name(technicalModelDto.getName())
+ .unit(technicalModelDto.getUnit())
+ .build();
technicalModelMapper.insert(technicalModel);
}
@@ -66,7 +74,7 @@
//缂栬緫
@Override
- public void writeTechById(Integer id, TechnicalModelDto technicalModelDto) {
+ public void writeTechById(Integer id,TechnicalModelDto technicalModelDto) {
TechnicalModel technicalModel = new TechnicalModel();
BeanUtils.copyProperties(technicalModelDto, technicalModel);
technicalModel.setId(id);
@@ -75,17 +83,23 @@
//鍒犻櫎
@Override
+ @Transactional(rollbackFor = Exception.class)
public void delTechById(Integer id) {
+ //鍒犻櫎鎶�鏈寚鏍�
TechnicalModel technicalModel = new TechnicalModel();
technicalModel.setState(0);
technicalModel.setId(id);
technicalModelMapper.updateById(technicalModel);
+ //鍒犻櫎鐢熶骇宸ヨ壓
+ techniqueModelMapper.delTechById(id);
}
//鎵归噺鍒犻櫎
@Override
+ @Transactional(rollbackFor = Exception.class)
public void delAllTech(String ids) {
technicalModelMapper.delAllTech(ids);
+ techniqueModelMapper.delAllTech(ids);
}
}
--
Gitblit v1.9.3