From e7f3835c7ffb0de6747c7c496c590f7f42e455fc Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 24 一月 2024 15:05:33 +0800
Subject: [PATCH] 111

---
 server/service/src/main/java/com/doumee/service/business/impl/SolutionsServiceImpl.java |   66 +++++++++++++++++++++++++++++---
 1 files changed, 59 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..432e677 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,15 @@
 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.join.SolutionsJoinMapper;
 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;
@@ -27,6 +30,7 @@
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 import java.util.UUID;
 
 /**
@@ -40,9 +44,11 @@
     @Autowired
     private SolutionsMapper solutionsMapper;
     @Autowired
+    private SolutionsJoinMapper solutionsJoinMapper;
+    @Autowired
     private WorktypeMapper worktypeMapper;
     @Autowired
-    private SolutionWorktypeMapper solutionWorktypeMapper;
+    private SolutionWorktypeJoinMapper solutionWorktypeJoinMapper;
     @Autowired
     private InsuranceMapper insuranceMapper;
 
@@ -87,7 +93,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 +103,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 +179,7 @@
         solutionsMapper.insert(newModel);
 
         //鍒犻櫎鎵�鏈夊伐绉嶆暟鎹�
-        solutionWorktypeMapper.delete(new UpdateWrapper<SolutionWorktype>()
+        solutionWorktypeJoinMapper.delete(new UpdateWrapper<SolutionWorktype>()
                 .lambda()
                 .eq(SolutionWorktype::getSolutionId,solutions.getId())
         );
@@ -222,7 +229,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
@@ -234,6 +254,7 @@
     @Override
     public List<Solutions> findList(Solutions solutions) {
         solutions.setIsdeleted(Constants.ZERO);
+        solutions.setDataType(Constants.TWO);
         QueryWrapper<Solutions> wrapper = new QueryWrapper<>(solutions);
         return solutionsMapper.selectList(wrapper);
     }
@@ -266,7 +287,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());
@@ -343,10 +364,41 @@
         }
         return PageData.from(solutionsMapper.selectPage(page, queryWrapper));
     }
+    @Override
+    public PageData<Solutions> findPageCom(PageWrap<Solutions> pageWrap) {
+        IPage<Solutions> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
+        QueryWrapper<Solutions> queryWrapper = new QueryWrapper<>();
+        Utils.MP.blankToNull(pageWrap.getModel());
+        pageWrap.getModel().setDataType(Constants.ZERO);//鍙�夋嫨鍩鸿〃鏁版嵁
+        pageWrap.getModel().setStatus(Constants.ZERO);
+        pageWrap.getModel().setIsdeleted(Constants.ZERO);
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        queryWrapper.exists(("select b.id from company_solution b where b.isdeleted=0 and b.company_id="+user.getCompanyId()+" and b.SOLUTION_BASE_ID = solutions.id"));
+        if (pageWrap.getModel().getName() != null) {
+            queryWrapper.lambda().like(Solutions::getName, pageWrap.getModel().getName());
+        }
+        if (pageWrap.getModel().getStatus() != null) {
+            queryWrapper.lambda().eq(Solutions::getStatus, pageWrap.getModel().getStatus());
+        }
+        if (pageWrap.getModel().getSortnum() != null) {
+            queryWrapper.lambda().eq(Solutions::getSortnum, pageWrap.getModel().getSortnum());
+        }
+        if (pageWrap.getModel().getInsuranceId() != null) {
+            queryWrapper.lambda().eq(Solutions::getInsuranceId, pageWrap.getModel().getInsuranceId());
+        }
+        if (pageWrap.getModel().getBaseId() != null) {
+            queryWrapper.lambda().eq(Solutions::getBaseId, pageWrap.getModel().getBaseId());
+        }
+        queryWrapper.lambda().orderByAsc(Solutions::getInsuranceId);
+        return PageData.from(solutionsMapper.selectPage(page, queryWrapper));
+    }
 
     @Override
     public long count(Solutions solutions) {
         QueryWrapper<Solutions> wrapper = new QueryWrapper<>(solutions);
         return solutionsMapper.selectCount(wrapper);
     }
+
+
+
 }

--
Gitblit v1.9.3