|
|
@@ -1,6 +1,7 @@
|
|
|
package org.dromara.customer.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
@@ -10,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.dromara.system.api.RemoteDeptService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.dromara.customer.domain.bo.CustomerContactBo;
|
|
|
import org.dromara.customer.domain.vo.CustomerContactVo;
|
|
|
@@ -32,6 +34,9 @@ import java.util.Collection;
|
|
|
@Service
|
|
|
public class CustomerContactServiceImpl extends ServiceImpl<CustomerContactMapper, CustomerContact> implements ICustomerContactService {
|
|
|
|
|
|
+ @DubboReference
|
|
|
+ private RemoteDeptService remoteDeptService;
|
|
|
+
|
|
|
private final CustomerContactMapper baseMapper;
|
|
|
|
|
|
/**
|
|
|
@@ -75,7 +80,7 @@ public class CustomerContactServiceImpl extends ServiceImpl<CustomerContactMappe
|
|
|
private LambdaQueryWrapper<CustomerContact> buildQueryWrapper(CustomerContactBo bo) {
|
|
|
Map<String, Object> params = bo.getParams();
|
|
|
LambdaQueryWrapper<CustomerContact> lqw = Wrappers.lambdaQuery();
|
|
|
- lqw.orderByAsc(CustomerContact::getId);
|
|
|
+ lqw.orderByDesc(CustomerContact::getId);
|
|
|
lqw.eq(bo.getCustomerId() != null, CustomerContact::getCustomerId, bo.getCustomerId());
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getContactName()), CustomerContact::getContactName, bo.getContactName());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getPhone()), CustomerContact::getPhone, bo.getPhone());
|
|
|
@@ -90,7 +95,16 @@ public class CustomerContactServiceImpl extends ServiceImpl<CustomerContactMappe
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getAddressCounty()), CustomerContact::getAddressCounty, bo.getAddressCounty());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getProvincialCityCounty()), CustomerContact::getProvincialCityCounty, bo.getProvincialCityCounty());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), CustomerContact::getStatus, bo.getStatus());
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getPlatformCode()), CustomerContact::getPlatformCode, bo.getPlatformCode());
|
|
|
+
|
|
|
+ if (bo.getDeptId() != null) {
|
|
|
+ // 1. 获取当前部门及所有子部门的 ID 列表
|
|
|
+ List<Long> deptIds = remoteDeptService.selectDeptChildrenIds(bo.getDeptId());
|
|
|
+
|
|
|
+ // 2. 使用 in 查询
|
|
|
+ if (deptIds != null && !deptIds.isEmpty()) {
|
|
|
+ lqw.in(CustomerContact::getDeptId, deptIds);
|
|
|
+ }
|
|
|
+ }
|
|
|
return lqw;
|
|
|
}
|
|
|
|