From 5de7e6e552bfceb3d5c4dc28482833150e37b49e Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期三, 17 一月 2024 15:09:48 +0800 Subject: [PATCH] 调整 --- server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java | 30 +++++++++++++++++++++++------- 1 files changed, 23 insertions(+), 7 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java index b04d642..0715696 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java @@ -11,12 +11,14 @@ import com.doumee.dao.business.SolutionWorktypeMapper; import com.doumee.dao.business.SolutionsMapper; import com.doumee.dao.business.WorktypeMapper; +import com.doumee.dao.business.join.SolutionWorktypeJoinMapper; import com.doumee.dao.business.model.*; import com.doumee.service.business.SolutionsService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.springframework.beans.BeanUtils; @@ -42,7 +44,7 @@ @Autowired private WorktypeMapper worktypeMapper; @Autowired - private SolutionWorktypeMapper solutionWorktypeMapper; + private SolutionWorktypeJoinMapper solutionWorktypeJoinMapper; @Autowired private InsuranceMapper insuranceMapper; @@ -87,7 +89,7 @@ if(worktypeList==null ||worktypeIdList.size()==0){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝宸ョ淇℃伅閫夋嫨鏈夎锛岃灏濊瘯鍒锋柊椤甸潰閲嶈瘯~" ); } - + int num =0; for(Worktype type : worktypeList) { //鍩虹鐗堟湰 SolutionWorktype w = new SolutionWorktype(); @@ -97,13 +99,14 @@ w.setCreateDate(solutions.getCreateDate()); w.setWorktypeId(type.getId()); w.setStatus(Constants.ZERO); - solutionWorktypeMapper.insert(w); + w.setSortnum(num++); + solutionWorktypeJoinMapper.insert(w); //鍘嗗彶鐗堟湰鐨勫伐绉嶄俊鎭� SolutionWorktype newType = new SolutionWorktype(); BeanUtils.copyProperties(w, newType); newType.setSolutionId(newModel.getId()); - solutionWorktypeMapper.insert(newType); + solutionWorktypeJoinMapper.insert(newType); } } @@ -172,7 +175,7 @@ solutionsMapper.insert(newModel); //鍒犻櫎鎵�鏈夊伐绉嶆暟鎹� - solutionWorktypeMapper.delete(new UpdateWrapper<SolutionWorktype>() + solutionWorktypeJoinMapper.delete(new UpdateWrapper<SolutionWorktype>() .lambda() .eq(SolutionWorktype::getSolutionId,solutions.getId()) ); @@ -222,7 +225,20 @@ } @Override public Solutions findById(Integer id) { - return solutionsMapper.selectById(id); + Solutions model = solutionsMapper.selectById(id); + if(model == null || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){ + throw new BusinessException(ResponseStatus.DATA_EMPTY ); + } + MPJLambdaWrapper<SolutionWorktype> wrapper = new MPJLambdaWrapper<>(); + wrapper.selectAll(SolutionWorktype.class); + wrapper.selectAs(Worktype::getName,SolutionWorktype::getWorktypeName); + wrapper.leftJoin(Worktype.class,Worktype::getId,SolutionWorktype::getWorktypeId); + wrapper.eq(SolutionWorktype::getSolutionId,id); + wrapper.eq(SolutionWorktype::getIsdeleted,Constants.ZERO); + wrapper.orderByAsc(SolutionWorktype::getSortnum); + List<SolutionWorktype> worktypeList = solutionWorktypeJoinMapper.selectJoinList(SolutionWorktype.class,wrapper); + model.setWorktypeList(worktypeList); + return model; } @Override @@ -266,7 +282,7 @@ queryWrapper.lambda().eq(Solutions::getIsdeleted, pageWrap.getModel().getIsdeleted()); } if (pageWrap.getModel().getName() != null) { - queryWrapper.lambda().eq(Solutions::getName, pageWrap.getModel().getName()); + queryWrapper.lambda().like(Solutions::getName, pageWrap.getModel().getName()); } if (pageWrap.getModel().getRemark() != null) { queryWrapper.lambda().eq(Solutions::getRemark, pageWrap.getModel().getRemark()); -- Gitblit v1.9.3