From e43043961cc300c722d309240656e268c164fdcd Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期五, 21 七月 2023 16:57:04 +0800 Subject: [PATCH] 查删检验计划 --- inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionServiceImpl.java | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 58 insertions(+), 0 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 4cfef0f..ee9070c 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,10 +1,20 @@ package com.yuanchu.limslaboratory.service.impl; + +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.yuanchu.limslaboratory.mapper.InspectionMaterialListMapper; +import com.yuanchu.limslaboratory.mapper.PlanMapper; import com.yuanchu.limslaboratory.pojo.Inspection; import com.yuanchu.limslaboratory.mapper.InspectionMapper; +import com.yuanchu.limslaboratory.pojo.InspectionMaterialList; +import com.yuanchu.limslaboratory.pojo.Plan; +import com.yuanchu.limslaboratory.pojo.dto.InspectionDto; 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.List; + /** * <p> @@ -17,4 +27,52 @@ @Service public class InspectionServiceImpl extends ServiceImpl<InspectionMapper, Inspection> implements InspectionService { + @Resource + private InspectionMapper inspectionMapper; + @Resource + private PlanMapper planMapper; + @Resource + InspectionMaterialListMapper inspectionMaterialListMapper; + + @Override + public Inspection addInspection(String userName,int type) { + Inspection inspection = new Inspection(type, 0,1,1, userName); + System.out.println(inspection); + int judge = inspectionMapper.insert(inspection); + System.out.println(judge); + return judge>0?inspection:null; + } + + //鏌ヨ鎵�鏈夋楠屽崟鍒楄〃 + @Override + public List<InspectionDto> selectAllInspection(int pageSize, int countSize, Integer state) { + return inspectionMapper.selectAllInspection((pageSize - 1) * countSize,pageSize * countSize, state); + } + + //浣滃簾鐢宠妫�楠屽崟 + @Override + public boolean delInspectionByInsId(String inspectionId) { + //妫�楠屽崟浣滃簾 + Inspection inspection = inspectionMapper.selectById(inspectionId); + inspection.setState(0); + int judge1 = inspectionMapper.updateById(inspection); + //妫�楠屾牱鍝佷綔搴� + UpdateWrapper<InspectionMaterialList> wrapper = new UpdateWrapper<>(); + wrapper.eq("inspection_id", inspectionId).set("state", 0); + int judge2 = inspectionMaterialListMapper.update(new InspectionMaterialList(),wrapper); + return judge1>0&&judge2>0; + } + + //鎻愪氦鐢宠妫�楠屽崟 + @Override + public boolean subInspectionByInsId(String inspectionId) { + Inspection inspection = inspectionMapper.selectById(inspectionId); + //鐘舵�佹敼涓哄凡鎻愪氦2 + inspection.setState(2); + int judge = inspectionMapper.updateById(inspection); + //璁″垝琛ㄦ柊澧� + Plan plan = Plan.builder().inspectionId(inspectionId).state(1).build(); + planMapper.insert(plan); + return judge>0; + } } -- Gitblit v1.9.3