From a33396e17dd847f31b62f416f7d9c5a58b79126b Mon Sep 17 00:00:00 2001
From: XiaoRuby <3114200645@qq.com>
Date: 星期五, 28 七月 2023 09:02:29 +0800
Subject: [PATCH] LIMS管理系统框架-开发7-28早上
---
inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionServiceImpl.java | 37 +++++++++++++++++++++++--------------
1 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionServiceImpl.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionServiceImpl.java
index 040aa26..ebfb650 100644
--- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionServiceImpl.java
+++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionServiceImpl.java
@@ -1,7 +1,10 @@
package com.yuanchu.limslaboratory.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yuanchu.limslaboratory.mapper.InspectionMaterialListMapper;
import com.yuanchu.limslaboratory.mapper.InspectionProductListMapper;
import com.yuanchu.limslaboratory.mapper.PlanMapper;
@@ -15,6 +18,7 @@
import com.yuanchu.limslaboratory.service.InspectionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
+
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@@ -41,7 +45,7 @@
InspectionMaterialListMapper inspectionMaterialListMapper;
@Resource
- InspectionProductListMapper inspectionProductListMapper;
+ InspectionProductListService inspectionProductListService;
//娣诲姞妫�楠岀敵璇峰崟
@Override
@@ -59,35 +63,40 @@
//浣滃簾鐢宠妫�楠屽崟
@Override
- public boolean delInspectionByInsId(String inspectionId) {
- //妫�楠屽崟浣滃簾
+ public void delInspectionByInsId(String inspectionId) {
+ /*妫�楠屽崟浣滃簾*/
Inspection inspection = inspectionMapper.selectById(inspectionId);
inspection.setState(0);
- int judge1 = inspectionMapper.updateById(inspection);
- //妫�楠岃鍒掍綔搴�
+ inspectionMapper.updateById(inspection);
+ /*妫�楠岃鍒掍綔搴�*/
UpdateWrapper<Plan> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("inspection_id", inspectionId).set("state", 0);
- planMapper.update(new Plan(),updateWrapper );
- //妫�楠屾牱鍝佷綔搴�(鏍规嵁鎶ユ鍗昳d鍒犻櫎鏍峰搧淇℃伅)
+ planMapper.update(new Plan(), updateWrapper);
+ /*妫�楠屾牱鍝佷綔搴�(鏍规嵁鎶ユ鍗昳d鍒犻櫎鏍峰搧淇℃伅)*/
UpdateWrapper<InspectionMaterialList> wrapper1 = new UpdateWrapper<>();
wrapper1.eq("inspection_id", inspectionId).set("state", 0);
- int judge2 = inspectionMaterialListMapper.update(new InspectionMaterialList(), wrapper1);
- return judge1 > 0 && judge2 > 0;
- //妫�楠屾牱鍝佷腑鐨勬楠岄」鐩綔搴�
+ inspectionMaterialListMapper.update(new InspectionMaterialList(), wrapper1);
+ /*妫�楠屾牱鍝佷腑鐨勬楠岄」鐩綔搴�*/
//鏌ュ嚭妫�楠屾牱鍝乮d
-
+ LambdaQueryWrapper<InspectionMaterialList> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(InspectionMaterialList::getInspectionId,inspectionId);
+ List<InspectionMaterialList> inspectionMaterialLists = inspectionMaterialListMapper.selectList(queryWrapper);
+ for (InspectionMaterialList inspectionMaterialList : inspectionMaterialLists) {
+ UpdateWrapper<InspectionProductList> wrapper = new UpdateWrapper<>();
+ wrapper.eq("inspection_material_list_id", inspectionMaterialList.getId()).set("state", 0);
+ inspectionProductListService.update(new InspectionProductList(), wrapper);
+ }
}
//鎻愪氦鐢宠妫�楠屽崟
@Override
- public boolean subInspectionByInsId(String inspectionId) {
+ public void subInspectionByInsId(String inspectionId) {
Inspection inspection = inspectionMapper.selectById(inspectionId);
//鐘舵�佹敼涓哄凡鎻愪氦2
inspection.setState(2);
- int judge = inspectionMapper.updateById(inspection);
+ inspectionMapper.updateById(inspection);
//璁″垝琛ㄦ柊澧�
Plan plan = Plan.builder().inspectionId(inspectionId).state(1).userId(inspection.getInspectUserId()).createTime(new Date()).build();
planMapper.insert(plan);
- return judge > 0;
}
}
--
Gitblit v1.9.3