Browse Source

1.合同报销查询优化

wuhp 1 năm trước cách đây
mục cha
commit
5eb2192d4f

+ 8 - 8
src/main/java/com/ydtech/modules/fnc/service/contract/impl/ContractSupplierServiceImpl.java

@@ -77,14 +77,14 @@ public class ContractSupplierServiceImpl extends ServiceImpl<ContractSupplierMap
         pageVo.setPageNum(contractVO.getPageNum());
         pageVo.setPageSize(contractVO.getPageSize());
 
-        if (contractVO.getSupplierIdList() != null && !contractVO.getSupplierIdList().isEmpty()) { //查关联表获取合同id
-            ContractSupplierDto contractSupplierDto = new ContractSupplierDto();
-            contractSupplierDto.setSupplierIdList(contractVO.getSupplierIdList());
-            List<ContractSupplierEntity> contractSupplierEntityList = contractSupplierService.selecSupplierList(contractSupplierDto);
-            List<String> contractIdList = contractSupplierEntityList.stream().map(ContractSupplierEntity::getContractId).collect(Collectors.toList());
-            contractVO.setContractIdList(contractIdList);
-
-        }
+//        if (contractVO.getSupplierIdList() != null && !contractVO.getSupplierIdList().isEmpty()) { //查关联表获取合同id
+//            ContractSupplierDto contractSupplierDto = new ContractSupplierDto();
+//            contractSupplierDto.setSupplierIdList(contractVO.getSupplierIdList());
+//            List<ContractSupplierEntity> contractSupplierEntityList = contractSupplierService.selecSupplierList(contractSupplierDto);
+//            List<String> contractIdList = contractSupplierEntityList.stream().map(ContractSupplierEntity::getContractId).collect(Collectors.toList());
+//            contractVO.setContractIdList(contractIdList);
+//
+//        }
         IPage<ContractDto> queriedPage = baseMapper.queryPage(page, contractVO);
         return queriedPage;
     }

+ 8 - 2
src/main/resources/mapper/modules/fnc/contract/ContractSupplierMapper.xml

@@ -79,9 +79,8 @@
         left join  ins_contract  ic on ic.id =ics.contract_id
         <where>
             <if test="vo.contractCode !=null  and  vo.contractCode !=''">
-                and ic.contract_code like concat('%',#{vo.contractCode},'%')
+                and (ic.contract_code like concat('%',#{vo.contractCode},'%') or ic.contract_name like concat('%',#{vo.contractCode},'%'))
             </if>
-
             <if test="vo.contractIdList != null  and vo.contractIdList !='' and  vo.contractIdList.size()>0 ">
                 and ic.id IN
                 <foreach collection="vo.contractIdList" item="id" index="index" open="(" close=")" separator=",">
@@ -89,6 +88,13 @@
                 </foreach>
             </if>
 
+            <if test="vo.supplierIdList != null  and vo.supplierIdList !='' and  vo.supplierIdList.size()>0 ">
+                and ics.supplier_id IN
+                <foreach collection="vo.supplierIdList" item="id" index="index" open="(" close=")" separator=",">
+                    #{id}
+                </foreach>
+            </if>
+
             <if test="vo.contractName !=null  and  vo.contractName !=''">
                 and ic.contract_name =#{vo.contractName}
             </if>