销售权限控制修改

This commit is contained in:
luojiaquan
2026-09-30 09:18:23 +08:00
parent 4f5959a2f9
commit 4d8cb7c69c
9 changed files with 83 additions and 14 deletions
@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="isEnable" column="is_enable" />
<result property="salesUserId" column="sales_user_id" />
<result property="salesUser" column="sales_user" />
<result property="salesUserNickName" column="sales_user_nick_name" />
<result property="ed" column="ed" />
<result property="zq" column="zq" />
<result property="settlementUserId" column="settlement_user_id" />
@@ -52,11 +53,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where ca.customer_id = c.customer_id and ca.del_flag = '0') as credit_ed,
c.product_codes, c.remark,
c.create_by, c.create_time, c.update_by, c.update_time, c.del_flag
c.create_by, c.create_time, c.update_by, c.update_time, c.del_flag,
su.nick_name as sales_user_nick_name
from ctr_customer c
<!-- 数据权限:销售(仅本人 c.sales_user_id)/销售经理(本部门 su.dept_id);
历史迁移数据 sales_user_id 为非数字工号,+0 后不匹配任何 sys_user,仅管理员可见 -->
left join sys_user su on su.user_id = c.sales_user_id + 0
<!-- 老系统同步数据 sales_user_id 存员工工号(=sys_user.user_name);
BMS 手工新建数据可能存数字 user_id,两种都要能关联上。
'WS0052'+0 在 MySQL 中结果为 0,不会误关联到任何用户 -->
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)
</sql>
<select id="selectBmsCustomerList" parameterType="BmsCustomer" resultMap="BmsCustomerResult">
@@ -93,7 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="throwRatio != null "> and c.throw_ratio = #{throwRatio}</if>
<if test="creditEd != null "> and c.credit_ed = #{creditEd}</if>
<if test="productCodes != null and productCodes != ''"> and c.product_codes = #{productCodes}</if>
<!-- 数据权限过滤(@DataScope 生成:仅本人= c.sales_user_id=当前用户;本部门= su.dept_id=当前用户部门) -->
<!-- 数据权限过滤(@DataScope 生成:仅本人= su.user_id=当前用户;本部门= su.dept_id=当前用户部门) -->
${params.dataScope}
</where>
order by c.customer_id desc