Переглянути джерело

feat(customer): 添加客户联系人查询功能增强
- 在CustomerContactBo中新增customerName字段用于客户名称查询

hurx 5 днів тому
батько
коміт
49821f8719

+ 2 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/bo/CustomerContactBo.java

@@ -122,5 +122,7 @@ public class CustomerContactBo extends BaseEntity {
      */
     private String remark;
 
+    private String customerName;
+
 
 }

+ 9 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerContactServiceImpl.java

@@ -110,6 +110,7 @@ public class CustomerContactServiceImpl extends ServiceImpl<CustomerContactMappe
         LambdaQueryWrapper<CustomerContact> lqw = Wrappers.lambdaQuery();
         lqw.orderByDesc(CustomerContact::getId);
         lqw.eq(bo.getCustomerId() != null, CustomerContact::getCustomerId, bo.getCustomerId());
+        lqw.like(StringUtils.isNotBlank(bo.getContactNo()), CustomerContact::getContactNo, bo.getContactNo());
         lqw.like(StringUtils.isNotBlank(bo.getContactName()), CustomerContact::getContactName, bo.getContactName());
         lqw.eq(StringUtils.isNotBlank(bo.getPhone()), CustomerContact::getPhone, bo.getPhone());
         lqw.eq(StringUtils.isNotBlank(bo.getOfficePhone()), CustomerContact::getOfficePhone, bo.getOfficePhone());
@@ -124,6 +125,14 @@ public class CustomerContactServiceImpl extends ServiceImpl<CustomerContactMappe
         lqw.eq(StringUtils.isNotBlank(bo.getProvincialCityCounty()), CustomerContact::getProvincialCityCounty, bo.getProvincialCityCounty());
         lqw.eq(StringUtils.isNotBlank(bo.getStatus()), CustomerContact::getStatus, bo.getStatus());
 
+        if (ObjectUtil.isNotEmpty(bo.getCustomerName())) {
+            CustomerInfoVo customerInfoVo = customerInfoMapper.selectVoOne(new LambdaQueryWrapper<CustomerInfo>().eq(CustomerInfo::getCustomerName, bo.getCustomerName()));
+            if (ObjectUtil.isNotEmpty(customerInfoVo)) {
+                lqw.eq(CustomerContact::getCustomerId, customerInfoVo.getId());
+            } else {
+                lqw.eq(CustomerContact::getCustomerId, 0);
+            }
+        }
         if (bo.getDeptId() != null) {
             // 1. 获取当前部门及所有子部门的 ID 列表
             List<Long> deptIds = remoteDeptService.selectDeptChildrenIds(bo.getDeptId());