2 Commits

Author SHA1 Message Date
caojia fb9a4e1b29 ⚡ 优化应收账单预览排序 2026-11-12 15:00:58 +08:00
caojia 89aadf97db ✨ 扩展应收账单销售经理部门数据范围 2026-11-12 15:00:58 +08:00
2 changed files with 15 additions and 15 deletions
@@ -694,14 +694,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{excludedBillId} #{excludedBillId}
</foreach> </foreach>
</if> </if>
<choose> order by p.bill_id
<when test="dateType != null and dateType == 'PICKUP_DATE'">
order by p.pickup_date, p.order_no, p.bill_id
</when>
<otherwise>
order by p.biz_date, p.order_no, p.bill_id
</otherwise>
</choose>
</select> </select>
<select id="sumPrcOrderBillIncomeByCustomerPeriod" resultType="java.math.BigDecimal"> <select id="sumPrcOrderBillIncomeByCustomerPeriod" resultType="java.math.BigDecimal">
@@ -11,20 +11,27 @@
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"/>
<when test="scope != null and (scope.self or scope.department)"> <when test="scope != null and (scope.self or scope.department)">
AND c.del_flag = '0' AND c.del_flag = '0'
AND EXISTS ( AND EXISTS (
SELECT 1 FROM sys_user su SELECT 1 FROM sys_user su
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>
<otherwise>AND 1 = 0</otherwise> <otherwise>AND 1 = 0</otherwise>
</choose> </choose>