补充异常账户人员查询SQL

This commit is contained in:
wkc
2026-03-31 21:00:24 +08:00
parent bcb2e39099
commit 09119a2365
6 changed files with 199 additions and 1 deletions

View File

@@ -48,6 +48,15 @@
<result property="hasNameListHit" column="hasNameListHit"/>
</resultMap>
<resultMap id="AbnormalAccountItemResultMap" type="com.ruoyi.ccdi.project.domain.vo.CcdiProjectAbnormalAccountItemVO">
<result property="accountNo" column="accountNo"/>
<result property="accountName" column="accountName"/>
<result property="bankName" column="bankName"/>
<result property="abnormalType" column="abnormalType"/>
<result property="abnormalTime" column="abnormal_time"/>
<result property="status" column="status"/>
</resultMap>
<sql id="digitTableSql">
select 0 as digit
union all select 1
@@ -644,6 +653,92 @@
order by neg.query_date desc, neg.person_id asc
</select>
<sql id="abnormalAccountBaseSql">
select
account.account_no as accountNo,
account.account_no as account_no,
coalesce(nullif(account.account_name, ''), staff.name) as accountName,
account.bank as bankName,
tr.rule_name as abnormalType,
tr.rule_code as rule_code,
case
when tr.rule_code = 'SUDDEN_ACCOUNT_CLOSURE' then date_format(account.invalid_date, '%Y-%m-%d')
when tr.rule_code = 'DORMANT_ACCOUNT_LARGE_ACTIVATION' then substring(
substring_index(
substring_index(tr.reason_detail, '', 2),
'首次交易日期',
-1
),
1,
10
)
else null
end as abnormal_time,
case
when account.status = 1 then '正常'
when account.status = 2 then '已销户'
else cast(account.status as char)
end as status
from ccdi_bank_statement_tag_result tr
inner join ccdi_account_info account
on account.owner_type = 'EMPLOYEE'
and account.owner_id = tr.object_key
and instr(tr.reason_detail, account.account_no) > 0
left join ccdi_base_staff staff
on staff.id_card = tr.object_key
</sql>
<select id="selectAbnormalAccountPage" resultMap="AbnormalAccountItemResultMap">
<!-- tr.model_code = 'ABNORMAL_ACCOUNT' -->
<!-- tr.bank_statement_id is null -->
<!-- account.owner_type = 'EMPLOYEE' -->
<!-- tr.reason_detail -->
<!-- instr(tr.reason_detail, account.account_no) > 0 -->
<!-- when account.status = 1 then '正常' -->
<!-- when account.status = 2 then '已销户' -->
<!-- when tr.rule_code = 'SUDDEN_ACCOUNT_CLOSURE' -->
<!-- when tr.rule_code = 'DORMANT_ACCOUNT_LARGE_ACTIVATION' -->
<!-- order by abnormal_time desc, account.account_no asc, tr.rule_code asc -->
select
abnormal.accountNo,
abnormal.accountName,
abnormal.bankName,
abnormal.abnormalType,
abnormal.abnormal_time,
abnormal.status
from (
<include refid="abnormalAccountBaseSql"/>
where tr.project_id = #{query.projectId}
and tr.model_code = 'ABNORMAL_ACCOUNT'
and tr.bank_statement_id is null
) abnormal
<!-- order by abnormal_time desc, account.account_no asc, tr.rule_code asc -->
order by abnormal.abnormal_time desc, abnormal.account_no asc, abnormal.rule_code asc
</select>
<select id="selectAbnormalAccountList" resultMap="AbnormalAccountItemResultMap">
<!-- tr.model_code = 'ABNORMAL_ACCOUNT' -->
<!-- tr.bank_statement_id is null -->
<!-- account.owner_type = 'EMPLOYEE' -->
<!-- tr.reason_detail -->
<!-- order by abnormal_time desc, account.account_no asc, tr.rule_code asc -->
select
abnormal.accountNo,
abnormal.accountName,
abnormal.bankName,
abnormal.abnormalType,
abnormal.abnormal_time,
abnormal.status
from (
<include refid="abnormalAccountBaseSql"/>
where tr.project_id = #{projectId}
and tr.model_code = 'ABNORMAL_ACCOUNT'
and tr.bank_statement_id is null
) abnormal
<!-- order by abnormal_time desc, account.account_no asc, tr.rule_code asc -->
order by abnormal.abnormal_time desc, abnormal.account_no asc, abnormal.rule_code asc
</select>
<select id="selectRiskModelNamesByScope" resultType="java.lang.String">
select
json_unquote(json_extract(result.model_hit_summary_json, concat('$[', idx.idx, '].modelName'))) as model_name