✨ 新增未关联业务员客户列表

This commit is contained in:
caojia
2026-10-29 10:35:24 +08:00
parent d02d3dd881
commit eafc8af89a
9 changed files with 172 additions and 1 deletions
@@ -5,6 +5,7 @@ import java.util.List;
import com.bms.customer.customerinfo.domain.BmsCustomerAttachment;
import com.bms.customer.customerinfo.domain.BmsCustomerCompany;
import com.bms.customer.customerinfo.domain.BmsCustomerContact;
import com.bms.customer.customerinfo.vo.UnlinkedSalesCustomerVO;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@@ -52,6 +53,17 @@ public class BmsCustomerController extends BaseController
return getDataTable(list);
}
/** 查询未关联业务员的客户列表 */
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:list')")
@GetMapping("/unlinked-sales-user/list")
public TableDataInfo unlinkedSalesUserList()
{
startPage();
BmsCustomer query = new BmsCustomer();
List<UnlinkedSalesCustomerVO> list = bmsCustomerService.selectUnlinkedSalesUserCustomerList(query);
return getDataTable(list);
}
/**
* 客户下拉选项。
* 只返回客户ID、客户编码、客户名称,供各页面下拉框使用。
@@ -2,7 +2,6 @@ package com.bms.customer.customerinfo.mapper;
import java.util.List;
import com.bms.customer.customerinfo.domain.BmsCustomer;
import com.bms.customer.customerinfo.domain.BmsCustomerOption;
import com.bms.customer.customerinfo.domain.BmsCustomerAttachment;
import com.bms.customer.customerinfo.domain.BmsCustomerCompany;
import com.bms.customer.customerinfo.domain.BmsCustomerContact;
@@ -44,6 +43,9 @@ public interface BmsCustomerMapper
*/
public List<BmsCustomerOption> selectCustomerOptions(BmsCustomer query);
/** 独立分页查询未关联业务员的客户,仅按 sales_user_id 为空筛选。 */
public List<UnlinkedSalesCustomerVO> selectUnlinkedSalesUserCustomerList(BmsCustomer query);
/** 校验业务员用户ID仍对应未删除的系统用户。 */
public int countValidSalesUserId(@org.apache.ibatis.annotations.Param("salesUserId") String salesUserId);
@@ -7,6 +7,7 @@ import com.bms.customer.customerinfo.domain.BmsCustomerAttachment;
import com.bms.customer.customerinfo.domain.BmsCustomerCompany;
import com.bms.customer.customerinfo.domain.BmsCustomerContact;
import com.bms.customer.customerinfo.domain.BmsCustomerLog;
import com.bms.customer.customerinfo.vo.UnlinkedSalesCustomerVO;
/**
* 客户主Service接口
@@ -40,6 +41,9 @@ public interface IBmsCustomerService
*/
public List<BmsCustomer> selectBmsCustomerList(BmsCustomer bmsCustomer);
/** 独立查询未关联业务员的客户。 */
public List<UnlinkedSalesCustomerVO> selectUnlinkedSalesUserCustomerList(BmsCustomer query);
/**
* 查询客户下拉选项。
* 只返回客户ID、客户编码、客户名称;keywords 按客户名称、客户编码、对外代码模糊查询。
@@ -19,6 +19,7 @@ import com.bms.customer.customerinfo.mapper.BmsCustomerMapper;
import com.bms.customer.customerinfo.domain.BmsCustomer;
import com.bms.customer.customerinfo.domain.BmsCustomerOption;
import com.bms.customer.customerinfo.domain.BmsCustomerLog;
import com.bms.customer.customerinfo.vo.UnlinkedSalesCustomerVO;
import com.bms.customer.customerinfo.service.IBmsCustomerLogService;
import com.bms.customer.customerinfo.service.IBmsCustomerService;
import com.bms.customer.customermoney.service.ICustomerMoneyService;
@@ -90,6 +91,14 @@ public class BmsCustomerServiceImpl implements IBmsCustomerService
return bmsCustomerMapper.selectBmsCustomerList(bmsCustomer);
}
/** 查询未关联业务员客户,保留客户业务员维度的数据范围。 */
@Override
@DataScope(deptAlias = "su", deptField = "dept_id", userAlias = "su", userField = "user_id")
public List<UnlinkedSalesCustomerVO> selectUnlinkedSalesUserCustomerList(BmsCustomer query)
{
return bmsCustomerMapper.selectUnlinkedSalesUserCustomerList(query);
}
/**
* 客户下拉选项。数据权限与客户列表一致,只查下拉需要的字段。
*/
@@ -0,0 +1,16 @@
package com.bms.customer.customerinfo.vo;
import lombok.Data;
/** 未关联业务员客户弹窗专用列表响应。 */
@Data
public class UnlinkedSalesCustomerVO
{
private Long customerId;
private String customerCode;
private String customerName;
private String customerCodeDw;
private String customerType;
private String isEnable;
private String sourceSalesCode;
}
@@ -112,6 +112,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by c.customer_id desc
</select>
<select id="selectUnlinkedSalesUserCustomerList"
parameterType="com.bms.customer.customerinfo.domain.BmsCustomer"
resultType="com.bms.customer.customerinfo.vo.UnlinkedSalesCustomerVO">
select c.customer_id as customerId,
c.customer_code as customerCode,
c.customer_name as customerName,
c.customer_code_dw as customerCodeDw,
c.customer_type as customerType,
c.is_enable as isEnable,
c.source_sales_code as sourceSalesCode
from ctr_customer c
left join sys_user su
on su.del_flag = '0'
and cast(su.user_id as char) = c.sales_user_id
where c.del_flag = '0'
and (c.sales_user_id is null or trim(c.sales_user_id) = '')
${params.dataScope}
order by c.customer_id desc
</select>
<resultMap type="BmsCustomerOption" id="BmsCustomerOptionResult">
<result property="customerId" column="customer_id" />
<result property="customerCode" column="customer_code" />