实现结果总览员工结果聚合构建

This commit is contained in:
wkc
2026-03-22 11:45:26 +08:00
parent ec006f202b
commit 0a58ac3251
7 changed files with 421 additions and 0 deletions

View File

@@ -29,6 +29,58 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark"/>
</resultMap>
<resultMap id="CcdiProjectOverviewEmployeeHitRowMap"
type="com.ruoyi.ccdi.project.domain.vo.CcdiProjectOverviewEmployeeHitRowVO">
<result property="projectId" column="project_id"/>
<result property="staffIdCard" column="staff_id_card"/>
<result property="staffName" column="staff_name"/>
<result property="staffCode" column="staff_code"/>
<result property="deptId" column="dept_id"/>
<result property="deptName" column="dept_name"/>
<result property="modelCode" column="model_code"/>
<result property="modelName" column="model_name"/>
<result property="ruleCode" column="rule_code"/>
<result property="ruleName" column="rule_name"/>
<result property="riskLevel" column="risk_level"/>
</resultMap>
<sql id="resolvedEmployeeHitRowsSql">
select distinct
tr.project_id,
coalesce(direct_staff.id_card, statement_staff.id_card, family_staff.id_card) as staff_id_card,
coalesce(direct_staff.name, statement_staff.name, family_staff.name) as staff_name,
cast(coalesce(direct_staff.staff_id, statement_staff.staff_id, family_staff.staff_id) as char) as staff_code,
coalesce(direct_staff.dept_id, statement_staff.dept_id, family_staff.dept_id) as dept_id,
dept.dept_name,
tr.model_code,
tr.model_name,
tr.rule_code,
tr.rule_name,
tr.risk_level
from ccdi_bank_statement_tag_result tr
left join ccdi_base_staff direct_staff
on tr.object_type = 'STAFF_ID_CARD'
and tr.object_key = direct_staff.id_card
left join ccdi_bank_statement bs
on tr.bank_statement_id = bs.bank_statement_id
left join ccdi_base_staff statement_staff
on (tr.object_key is null or tr.object_key = '')
and bs.cret_no = statement_staff.id_card
left join ccdi_staff_fmy_relation relation
on relation.status = 1
and (
((tr.object_key is null or tr.object_key = '') and bs.cret_no = relation.relation_cert_no)
or ((tr.object_key is not null and tr.object_key != '') and tr.object_type != 'STAFF_ID_CARD'
and tr.object_key = relation.relation_cert_no)
)
left join ccdi_base_staff family_staff
on relation.person_id = family_staff.id_card
left join sys_dept dept
on dept.dept_id = coalesce(direct_staff.dept_id, statement_staff.dept_id, family_staff.dept_id)
where tr.project_id = #{projectId}
and coalesce(direct_staff.id_card, statement_staff.id_card, family_staff.id_card) is not null
</sql>
<delete id="deleteByProjectId">
delete from ccdi_project_overview_employee_result
where project_id = #{projectId}
@@ -97,4 +149,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by id asc
</select>
<select id="selectEmployeeHitRowsByProjectId" resultMap="CcdiProjectOverviewEmployeeHitRowMap">
<include refid="resolvedEmployeeHitRowsSql"/>
order by staff_id_card asc, model_code asc, rule_code asc
</select>
</mapper>