订单列表和计费列表调整使用客户下拉全查接口

This commit is contained in:
liuminghui
2026-10-29 10:33:41 +08:00
parent 3bb7267b0b
commit d02d3dd881
10 changed files with 119 additions and 2 deletions
@@ -0,0 +1,22 @@
package com.bms.customer.customerinfo.domain;
import lombok.Data;
/**
* 客户下拉选项。
* 只携带下拉展示和回填需要的字段,不返回额度、账期等客户档案内容。
*
* @author bms
*/
@Data
public class BmsCustomerOption
{
/** 客户ID。收款、账单等已有下拉按主键选中,需一并返回 */
private Long customerId;
/** 客户编码 */
private String customerCode;
/** 客户名称 */
private String customerName;
}
@@ -2,6 +2,7 @@ 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;
@@ -34,6 +35,15 @@ public interface BmsCustomerMapper
*/
public List<BmsCustomer> selectBmsCustomerList(BmsCustomer bmsCustomer);
/**
* 查询客户下拉选项。
* 按客户名称、客户编码、对外代码模糊匹配,只返回下拉所需字段。
*
* @param query 下拉查询条件
* @return 客户下拉选项
*/
public List<BmsCustomerOption> selectCustomerOptions(BmsCustomer query);
/** 校验业务员用户ID仍对应未删除的系统用户。 */
public int countValidSalesUserId(@org.apache.ibatis.annotations.Param("salesUserId") String salesUserId);
@@ -2,6 +2,7 @@ package com.bms.customer.customerinfo.service;
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;
@@ -39,6 +40,15 @@ public interface IBmsCustomerService
*/
public List<BmsCustomer> selectBmsCustomerList(BmsCustomer bmsCustomer);
/**
* 查询客户下拉选项。
* 只返回客户ID、客户编码、客户名称;keywords 按客户名称、客户编码、对外代码模糊查询。
*
* @param query 下拉查询条件
* @return 客户下拉选项
*/
public List<BmsCustomerOption> selectCustomerOptions(BmsCustomer query);
/**
* 查询客户附件列表
*
@@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
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.service.IBmsCustomerLogService;
import com.bms.customer.customerinfo.service.IBmsCustomerService;
@@ -89,6 +90,16 @@ public class BmsCustomerServiceImpl implements IBmsCustomerService
return bmsCustomerMapper.selectBmsCustomerList(bmsCustomer);
}
/**
* 客户下拉选项。数据权限与客户列表一致,只查下拉需要的字段。
*/
@Override
@DataScope(deptAlias = "su", deptField = "dept_id", userAlias = "su", userField = "user_id")
public List<BmsCustomerOption> selectCustomerOptions(BmsCustomer query)
{
return bmsCustomerMapper.selectCustomerOptions(query);
}
//查询附件子表数据
@Override
public List<BmsCustomerAttachment> selectBmsCustomerAttachmentList(BmsCustomerAttachment bmsCustomerAttachment) {
@@ -112,6 +112,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by c.customer_id desc
</select>
<resultMap type="BmsCustomerOption" id="BmsCustomerOptionResult">
<result property="customerId" column="customer_id" />
<result property="customerCode" column="customer_code" />
<result property="customerName" column="customer_name" />
</resultMap>
<!-- 客户下拉:不关联账户、套餐,只取名称和编码;对外代码仅参与模糊条件 -->
<select id="selectCustomerOptions" parameterType="BmsCustomer" resultMap="BmsCustomerOptionResult">
select c.customer_id, c.customer_code, c.customer_name
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'
<if test="keywordList != null and keywordList.size() > 0">
and (
<foreach collection="keywordList" item="kw" separator=" or ">
(c.customer_name like concat('%', #{kw}, '%')
or c.customer_code like concat('%', #{kw}, '%')
or c.customer_code_dw like concat('%', #{kw}, '%'))
</foreach>
)
</if>
${params.dataScope}
</where>
order by c.customer_id desc
</select>
<select id="countValidSalesUserId" resultType="int">
select count(1)
from sys_user