From c9df4cfec262ca54af52715af60a1276c37d08c5 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 29 一月 2024 20:12:24 +0800
Subject: [PATCH] 111

---
 server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java |  168 +++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 137 insertions(+), 31 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java
index 8483330..46b2958 100644
--- a/server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java
+++ b/server/service/src/main/java/com/doumee/service/business/impl/DispatchUnitServiceImpl.java
@@ -1,5 +1,6 @@
 package com.doumee.service.business.impl;
 
+import com.doumee.biz.system.SystemDictDataBiz;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
 import com.doumee.core.model.LoginUserInfo;
@@ -12,10 +13,12 @@
 import com.doumee.dao.business.DuSolutionMapper;
 import com.doumee.dao.business.DuWorktypeMapper;
 import com.doumee.dao.business.dto.*;
+import com.doumee.dao.business.join.DispatchUnitJoinMapper;
 import com.doumee.dao.business.join.DuLogJoinMapper;
 import com.doumee.dao.business.join.DuSolutionJoinMapper;
 import com.doumee.dao.business.join.DuWorkTypeJoinMapper;
 import com.doumee.dao.business.model.*;
+import com.doumee.dao.system.model.SystemUser;
 import com.doumee.service.business.DispatchUnitService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -31,6 +34,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 娲鹃仯鍗曚綅淇℃伅琛⊿ervice瀹炵幇
@@ -42,6 +46,9 @@
 
     @Autowired
     private DispatchUnitMapper dispatchUnitMapper;
+
+    @Autowired
+    private DispatchUnitJoinMapper dispatchUnitJoinMapper;
 
     @Autowired
     private DuSolutionMapper duSolutionMapper;
@@ -60,6 +67,9 @@
 
     @Autowired
     private DuWorkTypeJoinMapper duWorkTypeJoinMapper;
+
+    @Autowired
+    private SystemDictDataBiz systemDictDataBiz;
 
     @Override
     @Transactional(rollbackFor = {Exception.class,BusinessException.class})
@@ -125,7 +135,17 @@
         List<DuWorktype> newWorktypes = new ArrayList<>();
         List<DuSolution> solutions = duSolutionMapper.selectList(new QueryWrapper<DuSolution>().lambda()
                 .eq(DuSolution::getIsdeleted,Constants.ZERO)
-                .eq(DuSolution::getDispatchUnitId,model.getSolutionId()));
+                .eq(DuSolution::getDispatchUnitId,model.getId()));
+
+        duSolutionMapper.update(null,new UpdateWrapper<DuSolution>().lambda()
+                        .set(DuSolution::getStatus,Constants.ONE)
+                .eq(DuSolution::getIsdeleted,Constants.ZERO)
+                .eq(DuSolution::getStatus,Constants.ZERO)
+                .eq(DuSolution::getDispatchUnitId,model.getId())
+        );
+
+
+
         if(solutions == null || solutions.size() ==0){
             throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ユ淳閬e崟浣嶆湭璁剧疆鏂规宸ョ淇℃伅锛屽鏍搁�氳繃澶辫触锛�");
         }
@@ -141,9 +161,18 @@
             List<DuWorktype> worktypes = duWorktypeMapper.selectList(new QueryWrapper<DuWorktype>().lambda()
                     .eq(DuWorktype::getIsdeleted,Constants.ZERO)
                     .eq(DuWorktype::getDuSolutionId,s.getId()));
+
+            duWorktypeMapper.update(null,new UpdateWrapper<DuWorktype>().lambda()
+                    .set(DuWorktype::getStatus,Constants.ONE)
+                    .eq(DuWorktype::getIsdeleted,Constants.ZERO)
+                    .eq(DuWorktype::getStatus,Constants.ZERO)
+                    .eq(DuWorktype::getDuSolutionId,s.getId()));
+
             if(worktypes == null || worktypes.size() ==0){
                 throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ユ淳閬e崟浣嶆柟妗堝瓨鍦ㄦ柟妗堟槸鏈缃伐绉嶄俊鎭俊鎭紝瀹℃牳閫氳繃澶辫触锛�");
             }
+
+
             for (DuWorktype w : worktypes) {
                 DuWorktype nw = new DuWorktype();
                 BeanUtils.copyProperties(w, nw);
@@ -166,31 +195,34 @@
     public Integer check(DispatchUnit param) {
         if(Objects.isNull(param)
                 ||Objects.isNull(param.getId())
-                ||param.getStatus() == null
-                ||!(param.getStatus() ==Constants.ONE || param.getStatus() == Constants.TWO)){
+                ||param.getUnitStatus() == null
+                ||!(param.getUnitStatus() ==Constants.ONE || param.getUnitStatus() == Constants.TWO)){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
         LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
         DispatchUnit model = dispatchUnitMapper.selectById(param.getId());
-        if(Objects.isNull(model) || Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO) ||!Constants.equalsInteger(model.getDataType(),Constants.ZERO)){
+        if(Objects.isNull(model) || !Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO) ||!Constants.equalsInteger(model.getDataType(),Constants.ZERO)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌娲鹃仯鍗曚綅淇℃伅");
         }
-        if(Constants.equalsInteger(model.getStatus(),Constants.ZERO)){
+        if(!Constants.equalsInteger(model.getUnitStatus(),Constants.ZERO)){
             throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ユ淳閬e崟浣嶅伐绉嶅凡瀹℃牳锛岃鍕块噸澶嶆彁浜");
         }
         DispatchUnit update = new DispatchUnit();
         update.setEditor(user.getId());
         update.setEditDate(new Date());
         update.setId(model.getId());
-        update.setStatus(param.getStatus());
+        update.setUnitStatus(param.getUnitStatus());
         update.setWorktypeStatus(param.getWorktypeStatus());
         update.setCheckDate(update.getEditDate());
         update.setCheckUserId(user.getId());
         update.setCheckInfo(param.getCheckInfo());
         dispatchUnitMapper.updateById(update);
-        if(Constants.equalsInteger(model.getStatus(),Constants.ONE)){
+        DispatchUnit dispatchUnit = dispatchUnitMapper.selectById(param.getId());
+        if(Constants.equalsInteger(param.getUnitStatus(),Constants.ONE)){
             //瀹℃牳閫氳繃锛屼慨鏀圭姸鎬侊紝浜х敓鍘嗗彶鐗堟湰
-            newVersionData(dispatchUnitMapper.selectById(param.getId()),update);
+            newVersionData(dispatchUnit,update);
+            //瀛樺偍鎿嶄綔鍘嗗彶
+            this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.AUDIT_PASS,null);
         }else{
             //鏇存柊鏄庣粏鏁版嵁涓哄鏍稿け璐�
             duSolutionMapper.update(null,new UpdateWrapper<DuSolution>().lambda()
@@ -199,6 +231,28 @@
                     .set(DuSolution::getCheckUserId,update.getCheckUserId())
                     .set(DuSolution::getCheckInfo,update.getCheckInfo())
                     .eq(DuSolution::getDispatchUnitId,update.getId()));
+
+
+            List<DuSolution> solutions = duSolutionMapper.selectList(new QueryWrapper<DuSolution>().lambda()
+                    .eq(DuSolution::getIsdeleted,Constants.ZERO)
+                    .eq(DuSolution::getDispatchUnitId,model.getId()));
+
+            if(solutions == null || solutions.size() ==0){
+                throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀵逛笉璧凤紝璇ユ淳閬e崟浣嶆湭璁剧疆鏂规宸ョ淇℃伅锛屽鏍搁�氳繃澶辫触锛�");
+            }
+            for (DuSolution s : solutions){
+                duWorktypeMapper.update(null,new UpdateWrapper<DuWorktype>().lambda()
+                        .set(DuWorktype::getStatus,Constants.TWO)
+                        .set(DuWorktype::getCheckUserId,update.getCheckUserId())
+                        .set(DuWorktype::getCheckInfo,update.getCheckInfo())
+                        .set(DuWorktype::getCheckDate,new Date() )
+                        .eq(DuWorktype::getIsdeleted,Constants.ZERO)
+                        .eq(DuWorktype::getStatus,Constants.ZERO)
+                        .eq(DuWorktype::getDuSolutionId,s.getId()));
+            }
+
+            //瀛樺偍鎿嶄綔鍘嗗彶
+            this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.AUDIT_UN_PASS,update.getCheckInfo());
         }
         return  1;
     }
@@ -247,11 +301,19 @@
         this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.UPLOAD,null);
 
         List<SaveDuSolutionDTO> saveDuSolutionDTOList = saveDispatchUnitDTO.getSaveDuSolutionDTOList();
+
+        List<Integer> duSolutionIdS = saveDuSolutionDTOList.stream().map(m->m.getSolutionId()).collect(Collectors.toList());
+        HashSet<Integer> setDuSolutionIdS=new HashSet<>(duSolutionIdS);
+        if(duSolutionIdS.size()!=setDuSolutionIdS.size()){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鏂规淇℃伅閲嶅");
+        }
+
         for (int i = 0; i < saveDuSolutionDTOList.size(); i++) {
             SaveDuSolutionDTO saveDuSolutionDTO = saveDuSolutionDTOList.get(i);
             DuSolution duSolution = new DuSolution();
             duSolution.setCreateDate(new Date());
             duSolution.setCreator(loginUserInfo.getId());
+            duSolution.setStatus(Constants.ZERO);
             duSolution.setIsdeleted(Constants.ZERO);
             duSolution.setDispatchUnitId(dispatchUnit.getId());
             duSolution.setSortnum(i);
@@ -259,6 +321,13 @@
             duSolutionMapper.insert(duSolution);
 
             List<SaveDuWorkTypeDTO> saveDuWorkTypeDTOList = saveDuSolutionDTO.getSaveDuWorkTypeDTOList();
+
+            List<Integer> duWorkTypeIdS = saveDuWorkTypeDTOList.stream().map(m->m.getWorkTypeId()).collect(Collectors.toList());
+            HashSet<Integer> setDuWorkTypeIdS=new HashSet<>(duWorkTypeIdS);
+            if(duWorkTypeIdS.size()!=setDuWorkTypeIdS.size()){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+saveDuSolutionDTO.getSolutionName()+"銆戣鏂规涓嬪瓨鍦ㄩ噸澶嶅伐绉嶏紒");
+            }
+
             if(!CollectionUtils.isNotEmpty(saveDuSolutionDTOList)){
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+saveDuSolutionDTO.getSolutionName()+"銆戣鏂规涓嬫湭閫夋嫨宸ョ锛�");
             }
@@ -269,6 +338,7 @@
                 duWorktype.setCreator(loginUserInfo.getId());
                 duWorktype.setIsdeleted(Constants.ZERO);
                 duWorktype.setDuSolutionId(duSolution.getId());
+                duWorktype.setStatus(Constants.ZERO);
                 duWorktype.setSortnum(j);
                 duWorktype.setWorkTypeId(saveDuWorkTypeDTO.getWorkTypeId());
                 duWorktype.setVideoUrl(saveDuWorkTypeDTO.getVideoUrl());
@@ -285,7 +355,6 @@
     public Integer editDispatchUnit(SaveDispatchUnitDTO saveDispatchUnitDTO) {
         if(Objects.isNull(saveDispatchUnitDTO)
                 ||Objects.isNull(saveDispatchUnitDTO.getId())
-                || CollectionUtils.isEmpty(saveDispatchUnitDTO.getSaveDuSolutionDTOList())
         ){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
@@ -314,7 +383,6 @@
         dispatchUnit.setContent(saveDispatchUnitDTO.getContent());
         dispatchUnit.setName(saveDispatchUnitDTO.getName());
         dispatchUnit.setUnitStatus(Constants.ZERO);
-        dispatchUnit.setWorktypeStatus(Constants.ZERO);
         dispatchUnit.setEditDate(new Date());
         dispatchUnit.setEditor(loginUserInfo.getId());
         dispatchUnitMapper.updateById(dispatchUnit);
@@ -322,7 +390,7 @@
         //瀛樺偍鎿嶄綔璁板綍
         this.saveDuLog(dispatchUnit,Constants.DispatchUnitLogType.EDIT_UNIT,null);
 
-        this.dealDuData(saveDispatchUnitDTO,loginUserInfo);
+//        this.dealDuData(saveDispatchUnitDTO,loginUserInfo);
 
         return dispatchUnit.getId();
     }
@@ -338,7 +406,7 @@
     public Integer createSolution(SaveDispatchUnitDTO saveDispatchUnitDTO) {
         if(Objects.isNull(saveDispatchUnitDTO)
                 ||Objects.isNull(saveDispatchUnitDTO.getId())
-                || CollectionUtils.isEmpty(saveDispatchUnitDTO.getSaveDuSolutionDTOList())
+                || !CollectionUtils.isNotEmpty(saveDispatchUnitDTO.getSaveDuSolutionDTOList())
         ){
             throw new BusinessException(ResponseStatus.BAD_REQUEST);
         }
@@ -363,7 +431,10 @@
         List<SaveDuSolutionDTO> saveDuSolutionDTOList = saveDispatchUnitDTO.getSaveDuSolutionDTOList();
         for (int i = 0; i < saveDuSolutionDTOList.size(); i++) {
             SaveDuSolutionDTO saveDuSolutionDTO = saveDuSolutionDTOList.get(i);
-            DuSolution duSolution = duSolutionMapper.selectOne(new QueryWrapper<DuSolution>().lambda().eq(DuSolution::getDispatchUnitId,saveDuSolutionDTO.getId())
+            if(Objects.isNull(saveDuSolutionDTO.getSolutionId())){
+                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+saveDuSolutionDTO.getSolutionName()+"銆戣鏂规涓嬮�夋嫨鏂规淇℃伅寮傚父锛�");
+            }
+            DuSolution duSolution = duSolutionMapper.selectOne(new QueryWrapper<DuSolution>().lambda().eq(DuSolution::getDispatchUnitId,saveDispatchUnitDTO.getId())
                     .eq(DuSolution::getIsdeleted,Constants.ZERO)
                     .eq(DuSolution::getSolutionId,saveDuSolutionDTO.getSolutionId()).last("limit 1"));
             Integer duSolutionNum = duSolutionMapper.selectCount(new QueryWrapper<DuSolution>().lambda().eq(DuSolution::getDispatchUnitId,saveDuSolutionDTO.getId()));
@@ -372,6 +443,7 @@
                 duSolution.setCreateDate(new Date());
                 duSolution.setCreator(loginUserInfo.getId());
                 duSolution.setIsdeleted(Constants.ZERO);
+                duSolution.setStatus(Constants.ZERO);
                 duSolution.setDispatchUnitId(saveDispatchUnitDTO.getId());
                 duSolution.setSortnum(duSolutionNum + i);
                 duSolution.setSolutionId(saveDuSolutionDTO.getSolutionId());
@@ -383,10 +455,14 @@
             }
             for (int j = 0; j < saveDuWorkTypeDTOList.size(); j++) {
                 SaveDuWorkTypeDTO saveDuWorkTypeDTO = saveDuWorkTypeDTOList.get(j);
-                if(duWorktypeMapper.selectCount(new QueryWrapper<DuWorktype>().lambda().eq(DuWorktype::getDuSolutionId,duSolution.getId())
+                if(Objects.isNull(saveDuWorkTypeDTO.getWorkTypeId())){
+                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+saveDuSolutionDTO.getSolutionName()+"銆戣鏂规涓�"+saveDuWorkTypeDTO.getWorkTypeName()+"璇ュ伐绉嶄俊鎭紓甯�");
+                }
+                if(duWorktypeMapper.selectCount(new QueryWrapper<DuWorktype>()
+                        .lambda().eq(DuWorktype::getDuSolutionId,duSolution.getId())
                         .eq(DuWorktype::getIsdeleted,Constants.ZERO)
                         .eq(DuWorktype::getWorkTypeId,saveDuWorkTypeDTO.getWorkTypeId()))>0){
-                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+saveDuSolutionDTO.getSolutionName()+"銆戣鏂规涓�"+saveDuWorkTypeDTO.getWorkTypeName()+"璇ュ伐绉嶅凡瀛樺湪宸ョ宸插瓨鍦�");
+                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+saveDuSolutionDTO.getSolutionName()+"銆戣鏂规涓�"+saveDuWorkTypeDTO.getWorkTypeName()+"璇ュ伐绉嶅凡瀛樺湪");
                 }
                 Integer duWorkTypeNum = duWorktypeMapper.selectCount(new QueryWrapper<DuWorktype>().lambda().eq(DuWorktype::getDuSolutionId,duSolution.getId()));
                 DuWorktype duWorktype = new DuWorktype();
@@ -394,6 +470,7 @@
                 duWorktype.setCreator(loginUserInfo.getId());
                 duWorktype.setIsdeleted(Constants.ZERO);
                 duWorktype.setDuSolutionId(duSolution.getId());
+                duWorktype.setStatus(Constants.ZERO);
                 duWorktype.setSortnum(duWorkTypeNum + j);
                 duWorktype.setWorkTypeId(saveDuWorkTypeDTO.getWorkTypeId());
                 duWorktype.setVideoUrl(saveDuWorkTypeDTO.getVideoUrl());
@@ -587,12 +664,14 @@
         QueryWrapper<DispatchUnit> wrapper = new QueryWrapper<>(dispatchUnit);
         return dispatchUnitMapper.selectList(wrapper);
     }
-  
+
+
     @Override
     public PageData<DispatchUnit> findPage(PageWrap<DispatchUnit> pageWrap) {
         IPage<DispatchUnit> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
         QueryWrapper<DispatchUnit> queryWrapper = new QueryWrapper<>();
         Utils.MP.blankToNull(pageWrap.getModel());
+        queryWrapper.lambda().eq(DispatchUnit::getIsdeleted,Constants.ZERO);
         if (pageWrap.getModel().getId() != null) {
             queryWrapper.lambda().eq(DispatchUnit::getId, pageWrap.getModel().getId());
         }
@@ -666,7 +745,8 @@
                 queryWrapper.orderByAsc(sortData.getProperty());
             }
         }
-        return PageData.from(dispatchUnitMapper.selectPage(page, queryWrapper));
+        PageData<DispatchUnit> dispatchUnitPageData = PageData.from(dispatchUnitMapper.selectPage(page, queryWrapper));
+        return dispatchUnitPageData;
     }
 
     @Override
@@ -685,7 +765,7 @@
                         .selectAll(DuSolution.class)
                         .selectAs(Solutions::getName,DuSolution::getSolutionName)
                         .leftJoin(Solutions.class,Solutions::getId,DuSolution::getSolutionId)
-                        .eq(DuSolution::getSolutionId,dispatchUnit.getId())
+                        .eq(DuSolution::getDispatchUnitId,dispatchUnit.getId())
                         .orderByAsc(DuSolution::getSortnum)
         );
         if(CollectionUtils.isNotEmpty(duSolutionList)){
@@ -698,6 +778,14 @@
                                 .leftJoin(Worktype.class,Worktype::getId,DuWorktype::getWorkTypeId)
                                 .eq(DuWorktype::getDuSolutionId,duSolution.getId())
                 );
+                if(CollectionUtils.isNotEmpty(duWorkTypeList)){
+                    String path = systemDictDataBiz.queryByCode(Constants.OSS,Constants.RESOURCE_PATH).getCode()+systemDictDataBiz.queryByCode(Constants.OSS,Constants.DU_FILE).getCode();
+                    duWorkTypeList.forEach(i->{
+                        if(StringUtils.isNotBlank(i.getVideoUrl())){
+                            i.setVideoUrlFull(path + i.getVideoUrl());
+                        }
+                    });
+                }
                 duSolution.setDuWorktypeList(duWorkTypeList);
             }
             dispatchUnit.setDuSolutionList(duSolutionList);
@@ -706,10 +794,10 @@
         List<DuLog> duLogList = duLogJoinMapper.selectJoinList(DuLog.class,
                 new MPJLambdaWrapper<DuLog>()
                         .selectAll(DuLog.class)
-                        .selectAs(Member::getName,DuLog::getCreatorName)
+                        .selectAs(SystemUser::getRealname,DuLog::getCreatorName)
                         .selectAs(Company::getName,DuLog::getCompanyName)
-                        .leftJoin(Member.class,Member::getId,DuLog::getCreator)
-                        .leftJoin(Company.class,Company::getId,Member::getCompanyId)
+                        .leftJoin(SystemUser.class,SystemUser::getId,DuLog::getCreator)
+                        .leftJoin(Company.class,Company::getId,SystemUser::getCompanyId)
                         .eq(DuLog::getDuId,dispatchUnit.getId())
                         .orderByAsc(DuLog::getCreateDate)
         );
@@ -725,17 +813,35 @@
     @Override
     public List<DispatchUnit> findByDTO(DispatchUnitQueryDTO dispatchUnitQueryDTO) {
         LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
-        List<DispatchUnit> dispatchUnitList = dispatchUnitMapper.selectList(new QueryWrapper<DispatchUnit>().lambda()
-                .eq(DispatchUnit::getIsdeleted,Constants.ZERO)
-                .eq(loginUserInfo.getType().equals(Constants.ONE),DispatchUnit::getCompanyId,loginUserInfo.getCompanyId())
-                .eq(DispatchUnit::getStatus,Constants.ZERO)
-                .eq(DispatchUnit::getDataType,dispatchUnitQueryDTO.getDataType())
-                .apply(!Objects.isNull(dispatchUnitQueryDTO.getSolutionId()), " id in ( select d.dispatch_unit_id from du_solution d where d.solutionId = "+dispatchUnitQueryDTO.getSolutionId()+"  ) " )
-                .exists(!Objects.isNull(dispatchUnitQueryDTO.getApplyId()),
-                        " select 1 from apply_detail ad where ad.isdeleted = 0 and ad.apply_id = "+dispatchUnitQueryDTO.getApplyId()+" " +
-                                " ad.du_id = t.id ")
-                .orderByAsc(DispatchUnit::getSortnum)
+//        List<DispatchUnit> dispatchUnitList = dispatchUnitMapper.selectList(new QueryWrapper<DispatchUnit>().lambda()
+//                .eq(DispatchUnit::getIsdeleted,Constants.ZERO)
+//                .eq(loginUserInfo.getType().equals(Constants.ONE),DispatchUnit::getCompanyId,loginUserInfo.getCompanyId())
+//                .eq(DispatchUnit::getStatus,Constants.ZERO)
+//                .eq(DispatchUnit::getDataType,dispatchUnitQueryDTO.getDataType())
+//                .apply(!Objects.isNull(dispatchUnitQueryDTO.getSolutionId()), " id in ( select d.dispatch_unit_id from du_solution d where d.solution_id = "+dispatchUnitQueryDTO.getSolutionId()+"  ) " )
+//                .exists(!Objects.isNull(dispatchUnitQueryDTO.getApplyId()),
+//                        " select 1 from apply_detail ad where ad.isdeleted = 0 and ad.apply_id = "+dispatchUnitQueryDTO.getApplyId()+" " +
+//                                " ad.du_id = t.id ")
+//                .orderByAsc(DispatchUnit::getSortnum)
+//        );
+
+
+        List<DispatchUnit> dispatchUnitList  = dispatchUnitJoinMapper.selectJoinList(DispatchUnit.class,
+                new MPJLambdaWrapper<DispatchUnit>().selectAll(DispatchUnit.class)
+                        .selectAs(DuSolution::getId,DispatchUnit::getDuSolutionId)
+                        .leftJoin(DuSolution.class,DuSolution::getDispatchUnitId,DispatchUnit::getId)
+                        .eq(DispatchUnit::getIsdeleted,Constants.ZERO)
+                        .eq(loginUserInfo.getType().equals(Constants.ONE),DispatchUnit::getCompanyId,loginUserInfo.getCompanyId())
+                        .eq(DispatchUnit::getStatus,Constants.ZERO)
+                        .eq(DispatchUnit::getDataType,dispatchUnitQueryDTO.getDataType())
+                        .eq(!Objects.isNull(dispatchUnitQueryDTO.getSolutionId()),DuSolution::getSolutionId,dispatchUnitQueryDTO.getSolutionId())
+                        .exists(!Objects.isNull(dispatchUnitQueryDTO.getApplyId()),
+                                " select 1 from apply_detail ad where ad.isdeleted = 0 and ad.apply_id = "+dispatchUnitQueryDTO.getApplyId()+" " +
+                                        " ad.du_id = t.id ")
         );
+
+
+
         return dispatchUnitList;
     }
 

--
Gitblit v1.9.3