修改客户管理权限控制,按user_id控制

This commit is contained in:
luojiaquan
2026-10-19 12:00:56 +08:00
parent 92fc2f1ad0
commit 6b570f948c
7 changed files with 72 additions and 10 deletions
@@ -59,12 +59,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
su.nick_name as sales_user_nick_name,
cps.price_set_id, ps.price_set_name
from ctr_customer c
<!-- 老系统同步数据 sales_user_id 存员工工号(=sys_user.user_name);
BMS 手工新建数据可能存数字 user_id,两种都要能关联上。
'WS0052'+0 在 MySQL 中结果为 0,不会误关联到任何用户 -->
<!-- sales_user_id 统一存本系统 user_id(同步时由工号转换、手工录入选人即存ID),
数据权限按 su.user_id / su.dept_id 控制;保留 user_name 匹配仅作历史未转换工号兜底 -->
left join sys_user su
on su.del_flag = '0'
and (su.user_name = c.sales_user_id or su.user_id = c.sales_user_id + 0)
and (su.user_id = c.sales_user_id + 0 or su.user_name = c.sales_user_id)
<!-- 客户套餐绑定:uk_customer_one_set 保证一客户至多一条,不会放大行数 -->
left join prc_customer_price_set cps on cps.customer_id = c.customer_id
left join prc_price_set ps on ps.price_set_id = cps.price_set_id
@@ -8,6 +8,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT customer_code FROM ctr_customer WHERE del_flag = '0'
</select>
<!-- 工号->用户ID 映射(列别名显式映射,项目未开下划线转驼峰) -->
<select id="selectUserLoginMap" resultType="com.bms.common.core.domain.entity.SysUser">
SELECT user_id AS userId, user_name AS userName
FROM sys_user
WHERE del_flag = '0'
</select>
<!-- 字段集与 scripts/import_customers.py 的 MAP_COLUMNS 保持一致;
源行为空的字段不写,走数据库默认值 -->
<insert id="insertSyncCustomer" parameterType="com.bms.customer.customerinfo.domain.BmsCustomer">