Revert "✨ 应收账单接入角色数据权限并同步在线缓存"

This reverts commit 4659c63ef9.
This commit is contained in:
caojia
2026-10-27 15:28:52 +08:00
parent 4d4065b9e9
commit fe30345045
13 changed files with 24 additions and 649 deletions
@@ -66,12 +66,6 @@
<include refid="columns"/>
where create_by = #{createBy}
and status in ('WAITING', 'RUNNING', 'CANCEL_REQUESTED')
<if test="params.dataScope != null and params.dataScope != ''">
and exists (
select 1 from ar_bill b where b.ar_bill_id = ar_bill_generate_task.ar_bill_id
<include refid="com.bms.ar.mapper.ArBillMapper.customerDataScope"><property name="customerIdColumn" value="b.customer_id"/></include>
)
</if>
order by create_time desc, task_id desc
</select>
@@ -26,7 +26,7 @@
<result property="createTime" column="create_time"/>
</resultMap>
<select id="selectList" resultMap="ArBillLogResult">
<select id="selectList" parameterType="ArBillLog" resultMap="ArBillLogResult">
select l.log_id, l.ar_bill_id, l.object_type, l.object_id, l.operation_type, l.operation_desc,
case l.object_type
when 'BILL' then b.bill_no
@@ -43,15 +43,14 @@
left join ar_balance_writeoff bw on bw.writeoff_id = case when l.object_type = 'BALANCE_WRITEOFF' then
cast(l.object_id as unsigned) end
<where>
<if test="query.arBillId != null">and l.ar_bill_id = #{query.arBillId}</if>
<if test="query.objectType != null and query.objectType != ''">and l.object_type = #{query.objectType}</if>
<if test="query.objectId != null and query.objectId != ''">and l.object_id = #{query.objectId}</if>
<if test="query.operationType != null and query.operationType != ''">and l.operation_type = #{query.operationType}</if>
<if test="query.operationSource != null and query.operationSource != ''">and l.operation_source = #{query.operationSource}
<if test="arBillId != null">and l.ar_bill_id = #{arBillId}</if>
<if test="objectType != null and objectType != ''">and l.object_type = #{objectType}</if>
<if test="objectId != null and objectId != ''">and l.object_id = #{objectId}</if>
<if test="operationType != null and operationType != ''">and l.operation_type = #{operationType}</if>
<if test="operationSource != null and operationSource != ''">and l.operation_source = #{operationSource}
</if>
<if test="query.requestId != null and query.requestId != ''">and l.request_id = #{query.requestId}</if>
<if test="query.result != null and query.result != ''">and l.result = #{query.result}</if>
<include refid="com.bms.ar.mapper.ArBillMapper.customerDataScope"><property name="customerIdColumn" value="b.customer_id"/></include>
<if test="requestId != null and requestId != ''">and l.request_id = #{requestId}</if>
<if test="result != null and result != ''">and l.result = #{result}</if>
</where>
order by l.create_time desc, l.log_id desc
</select>
@@ -67,27 +67,6 @@
from ar_bill
</sql>
<!-- 仅受限角色增加 EXISTS,避免业务员历史关联产生重复账单和错误分页。
sales_user_id 优先按用户ID解析;找不到ID时兼容历史工号,防止数字工号与用户ID同时匹配两个人。
customerIdColumn 仅由下面各个 include 的固定属性传入。 -->
<sql id="customerDataScope">
<if test="params.dataScope != null and params.dataScope != ''">
and exists (
select 1 from ctr_customer ar_scope_customer
left join sys_user ar_scope_id_user
on ar_scope_customer.sales_user_id regexp '^[0-9]+$'
and ar_scope_id_user.user_id = ar_scope_customer.sales_user_id + 0
left join sys_user ar_scope_user
on ar_scope_user.del_flag = '0'
and (ar_scope_user.user_id = ar_scope_id_user.user_id
or (ar_scope_id_user.user_id is null
and ar_scope_user.user_name = ar_scope_customer.sales_user_id))
where ar_scope_customer.customer_id = ${customerIdColumn}
${params.dataScope}
)
</if>
</sql>
<select id="selectArBillList" parameterType="com.bms.ar.domain.vo.ArBillQuery" resultMap="ArBillResult">
<include refid="selectArBillColumns"/>
<where>
@@ -106,23 +85,10 @@
<if test="billDateStart != null">and bill_date &gt;= #{billDateStart}</if>
<if test="billDateEnd != null">and bill_date &lt;= #{billDateEnd}</if>
<if test="billPeriodEnd != null">and bill_period_end = #{billPeriodEnd}</if>
<include refid="customerDataScope"><property name="customerIdColumn" value="ar_bill.customer_id"/></include>
</where>
order by create_time desc, ar_bill_id desc
</select>
<select id="selectArBillByDataScope" parameterType="com.bms.ar.domain.vo.ArBillQuery" resultMap="ArBillResult">
<include refid="selectArBillColumns"/>
where ar_bill_id = #{arBillId}
<include refid="customerDataScope"><property name="customerIdColumn" value="ar_bill.customer_id"/></include>
</select>
<select id="selectCustomerIdByDataScope" parameterType="com.bms.ar.domain.vo.ArBillQuery" resultType="long">
select c.customer_id from ctr_customer c where c.customer_id = #{customerId}
<include refid="customerDataScope"><property name="customerIdColumn" value="c.customer_id"/></include>
</select>
<!-- 后台生成/导出任务使用原始查询,前台入口通过 selectArBillByDataScope 校验。 -->
<select id="selectArBillById" parameterType="long" resultMap="ArBillResult">
<include refid="selectArBillColumns"/>
where ar_bill_id = #{arBillId}