From c6c30ead51b2ac1f7ffd4fb7e4b193c5d11d7bdf Mon Sep 17 00:00:00 2001 From: XiaoRuby <3114200645@qq.com> Date: 星期四, 27 七月 2023 16:02:57 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java | 85 ++++++++++++++++++++++++++++++------------ 1 files changed, 61 insertions(+), 24 deletions(-) diff --git a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java index 45da709..ef612f3 100644 --- a/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java +++ b/inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/PlanServiceImpl.java @@ -1,21 +1,24 @@ package com.yuanchu.limslaboratory.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.yuanchu.limslaboratory.mapper.InspectionMaterialListMapper; -import com.yuanchu.limslaboratory.mapper.InspectionProductListMapper; -import com.yuanchu.limslaboratory.pojo.InspectionMaterialList; -import com.yuanchu.limslaboratory.pojo.InspectionProductList; -import com.yuanchu.limslaboratory.pojo.Plan; -import com.yuanchu.limslaboratory.mapper.PlanMapper; -import com.yuanchu.limslaboratory.pojo.dto.PlanDto; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; +import com.yuanchu.limslaboratory.mapper.*; +import com.yuanchu.limslaboratory.pojo.*; +import com.yuanchu.limslaboratory.pojo.dto.InspectionProductListDto; +import com.yuanchu.limslaboratory.pojo.vo.FinPlanVo; +import com.yuanchu.limslaboratory.pojo.vo.PlanVo; +import com.yuanchu.limslaboratory.service.InspectionProductListService; import com.yuanchu.limslaboratory.service.PlanService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Date; import java.util.List; -import java.util.Map; + /** * <p> @@ -34,9 +37,15 @@ @Resource InspectionProductListMapper inspectionProductListMapper; + @Resource + InspectionMaterialListMapper inspectionMaterialListMapper; + + @Resource + InspectionProductListService inspectionProductListService; + //鏌ヨ鎵�鏈夋楠岃鍒掑垎閰� @Override - public Map selectAllPlan(int pageSize, int countSize, Integer state) { + public List<PlanVo> selectAllPlan(int pageSize, int countSize, Integer state) { if (state == null) { state = 2; } @@ -45,32 +54,60 @@ //浣滃簾妫�楠岃鍒� @Override - public boolean delPlan(Integer id) { + public void delPlan(Integer id) { Plan plan = planMapper.selectById(id); + + /*妫�楠岃鍒掍綔搴�*/ //鐘舵�佹敼涓轰綔搴�0 plan.setState(0); - int judge = planMapper.updateById(plan); - return judge > 0; + planMapper.updateById(plan); + + /*妫�楠屾牱鍝佷綔搴�(鏍规嵁鎶ユ鍗昳d鍒犻櫎鏍峰搧淇℃伅)*/ + UpdateWrapper<InspectionMaterialList> wrapper1 = new UpdateWrapper<>(); + wrapper1.eq("inspection_id", plan.getInspectionId()).set("state", 0); + inspectionMaterialListMapper.update(new InspectionMaterialList(), wrapper1); + + /*妫�楠屾牱鍝佷腑鐨勬楠岄」鐩綔搴�*/ + //鏌ュ嚭妫�楠屾牱鍝乮d + LambdaQueryWrapper<InspectionMaterialList> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(InspectionMaterialList::getInspectionId, plan.getInspectionId()); + 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); + } } - //鏍规嵁鏍峰搧id鏌ヨ妫�楠岃鍒掗噷闈㈢殑妫�楠岄」鐩� + //淇敼(鍒嗛厤)妫�楠岃鍒掗噷鍒嗛厤璁″垝鐨勪俊鎭� @Override - public List<InspectionProductList> selectProductById(Integer id) { - return inspectionProductListMapper.selectByMaterId(id); - } + public void upPlan(Integer id, InspectionProductListDto inspectionProductListDto) { + /*鏇存柊璁″垝琛ㄤ腑鐨勭姸鎬�(3:宸插垎閰�),鏇存柊鏃堕棿*/ + //鏌ヨ鎶ユ鍗昳d + InspectionMaterialList inspectionMaterialList = inspectionMaterialListMapper.selectById(id); + LambdaQueryWrapper<Plan> queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(Plan::getInspectionId, inspectionMaterialList.getInspectionId()); + Plan plan = planMapper.selectOne(queryWrapper); + plan.setState(3).setUpdateTime(new Date()); + //鏍规嵁鎶ユ鍗昳d杩涜鏇存柊璁″垝琛� + LambdaUpdateWrapper<Plan> updateWrapper1 = new LambdaUpdateWrapper<>(); + updateWrapper1.eq(Plan::getInspectionId, plan.getInspectionId()); + planMapper.update(plan, updateWrapper1); - //淇敼妫�楠岃鍒掗噷鍒嗛厤璁″垝鐨勪俊鎭� - @Override - public void upPlan(InspectionProductList inspectionProductList) { - LambdaUpdateWrapper<InspectionProductList> updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(InspectionProductList::getInspectionMaterialListId, inspectionProductList.getInspectionMaterialListId()) - .eq(InspectionProductList::getMethod, inspectionProductList.getMethod()); - inspectionProductListMapper.update(inspectionProductList, updateWrapper); + /*鏇存柊妫�楠岄」鐩〃涓殑椤圭洰妫�楠屽紑濮嬫棩鏈�,椤圭洰妫�楠岀粨鏉熸棩鏈�,椤圭洰璇曢獙鍛�,璇曢獙瑕佹眰,鏇存柊鏃堕棿,璁惧id*/ + InspectionProductList inspectionProductList = new InspectionProductList(); + BeanUtils.copyProperties(inspectionProductListDto, inspectionProductList); + inspectionProductList.setInspectionMaterialListId(id); + //鏍规嵁鎶ユ鏍峰搧id鍜岄」鐩悕绉拌繘琛屾洿鏂版楠岄」鐩〃 + LambdaUpdateWrapper<InspectionProductList> updateWrapper2 = new LambdaUpdateWrapper<>(); + updateWrapper2.eq(InspectionProductList::getInspectionMaterialListId, inspectionProductList.getInspectionMaterialListId()) + .eq(InspectionProductList::getName, inspectionProductList.getName()); + inspectionProductListMapper.update(inspectionProductList, updateWrapper2); } //鏌ヨ鎴愬搧妫�楠� @Override - public List<PlanDto> selectInspection(int pageSize, int countSize, Integer state) { + public List<FinPlanVo> selectInspection(int pageSize, int countSize, Integer state) { return planMapper.selectInspection((pageSize - 1) * countSize, pageSize * countSize, state); } } -- Gitblit v1.9.3