✨ 扩展应收账单销售经理部门数据范围

This commit is contained in:
caojia
2026-11-12 09:45:04 +08:00
parent 90147ed4e3
commit 89aadf97db
@@ -11,7 +11,7 @@
AND bill_id IN AND bill_id IN
<foreach collection="sourceIds" item="sourceId" open="(" separator="," close=")">#{sourceId}</foreach> <foreach collection="sourceIds" item="sourceId" open="(" separator="," close=")">#{sourceId}</foreach>
</select> </select>
<!-- c 固定为客户表别名;无部门层级扩展,不按角色管理 data_scope 过滤。 --> <!-- c 固定为客户表别名;销售经理可见本部门及下级部门,不按角色管理 data_scope 过滤。 -->
<sql id="customerScope"> <sql id="customerScope">
<choose> <choose>
<when test="scope != null and scope.all"/> <when test="scope != null and scope.all"/>
@@ -22,7 +22,14 @@
WHERE CAST(su.user_id AS CHAR) = c.sales_user_id AND su.del_flag = '0' WHERE CAST(su.user_id AS CHAR) = c.sales_user_id AND su.del_flag = '0'
AND (1 = 0 AND (1 = 0
<if test="scope.self">OR su.user_id = #{scope.userId}</if> <if test="scope.self">OR su.user_id = #{scope.userId}</if>
<if test="scope.department">OR su.dept_id = #{scope.deptId}</if> <if test="scope.department">
OR EXISTS (
SELECT 1 FROM sys_dept dept
WHERE dept.dept_id = su.dept_id
AND (dept.dept_id = #{scope.deptId}
OR find_in_set(#{scope.deptId}, dept.ancestors))
)
</if>
) )
) )
</when> </when>