|
@@ -163,17 +163,35 @@ public class VppContractServiceImpl implements VppContractService {
|
|
|
@Override
|
|
@Override
|
|
|
public CommonPage<VppContractResponseVO> page(Long id, LocalDate signDateStart, LocalDate signDateEnd,
|
|
public CommonPage<VppContractResponseVO> page(Long id, LocalDate signDateStart, LocalDate signDateEnd,
|
|
|
Long templateId, Integer contractType, Long customerId,
|
|
Long templateId, Integer contractType, Long customerId,
|
|
|
|
|
+ String customerName, LocalDate signDateRangeStart, LocalDate signDateRangeEnd,
|
|
|
Integer contractStatus, Integer pageNum, Integer pageSize) {
|
|
Integer contractStatus, Integer pageNum, Integer pageSize) {
|
|
|
IPage<VppContract> page = new Page<>(pageNum, pageSize);
|
|
IPage<VppContract> page = new Page<>(pageNum, pageSize);
|
|
|
|
|
|
|
|
|
|
+ // 客户名称模糊匹配:先反查符合条件的客户ID
|
|
|
|
|
+ List<Long> customerIdsByName = null;
|
|
|
|
|
+ if (StringUtils.isNotBlank(customerName)) {
|
|
|
|
|
+ LambdaQueryWrapper<VppCustomer> customerWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ customerWrapper.like(VppCustomer::getCustomerName, customerName)
|
|
|
|
|
+ .eq(VppCustomer::getDeleteFlag, 0)
|
|
|
|
|
+ .select(VppCustomer::getId);
|
|
|
|
|
+ List<VppCustomer> matchedCustomers = vppCustomerMapper.selectList(customerWrapper);
|
|
|
|
|
+ customerIdsByName = matchedCustomers.stream().map(VppCustomer::getId).collect(Collectors.toList());
|
|
|
|
|
+ if (customerIdsByName.isEmpty()) {
|
|
|
|
|
+ return new CommonPage<>(Collections.emptyList(), 0L, pageSize, pageNum);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
LambdaQueryWrapper<VppContract> queryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<VppContract> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(VppContract::getDeleteFlag, 0)
|
|
queryWrapper.eq(VppContract::getDeleteFlag, 0)
|
|
|
.eq(id != null, VppContract::getId, id)
|
|
.eq(id != null, VppContract::getId, id)
|
|
|
.ge(signDateStart != null, VppContract::getSignDate, signDateStart)
|
|
.ge(signDateStart != null, VppContract::getSignDate, signDateStart)
|
|
|
.le(signDateEnd != null, VppContract::getSignDate, signDateEnd)
|
|
.le(signDateEnd != null, VppContract::getSignDate, signDateEnd)
|
|
|
|
|
+ .ge(signDateRangeStart != null, VppContract::getSignDate, signDateRangeStart)
|
|
|
|
|
+ .le(signDateRangeEnd != null, VppContract::getSignDate, signDateRangeEnd)
|
|
|
.eq(templateId != null, VppContract::getTemplateId, templateId)
|
|
.eq(templateId != null, VppContract::getTemplateId, templateId)
|
|
|
.eq(contractType != null, VppContract::getContractType, contractType)
|
|
.eq(contractType != null, VppContract::getContractType, contractType)
|
|
|
- .eq(customerId != null, VppContract::getCustomerId, customerId);
|
|
|
|
|
|
|
+ .eq(customerId != null, VppContract::getCustomerId, customerId)
|
|
|
|
|
+ .in(customerIdsByName != null, VppContract::getCustomerId, customerIdsByName);
|
|
|
VppContractStatusHelper.applyStatusFilter(queryWrapper, contractStatus);
|
|
VppContractStatusHelper.applyStatusFilter(queryWrapper, contractStatus);
|
|
|
queryWrapper.orderByDesc(VppContract::getCreateTime);
|
|
queryWrapper.orderByDesc(VppContract::getCreateTime);
|
|
|
page = vppContractMapper.selectPage(page, queryWrapper);
|
|
page = vppContractMapper.selectPage(page, queryWrapper);
|