调整项目人数按流水证件号统计
This commit is contained in:
@@ -117,37 +117,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<select id="countMatchedStaffCountByProjectId" resultType="java.lang.Integer">
|
||||
select count(distinct scope_staff.id_card)
|
||||
from (
|
||||
select staff.id_card
|
||||
from ccdi_bank_statement bs
|
||||
inner join ccdi_base_staff staff on staff.id_card = trim(bs.cret_no)
|
||||
where bs.project_id = #{projectId}
|
||||
and bs.cret_no is not null
|
||||
and trim(bs.cret_no) != ''
|
||||
union
|
||||
select family_staff.id_card
|
||||
from ccdi_bank_statement bs
|
||||
inner join ccdi_staff_fmy_relation relation
|
||||
on relation.relation_cert_no = trim(bs.cret_no)
|
||||
and relation.status = 1
|
||||
inner join ccdi_base_staff family_staff
|
||||
on family_staff.id_card = relation.person_id
|
||||
where bs.project_id = #{projectId}
|
||||
and bs.cret_no is not null
|
||||
and trim(bs.cret_no) != ''
|
||||
union
|
||||
select account_staff.id_card
|
||||
from ccdi_bank_statement bs
|
||||
inner join ccdi_account_info account
|
||||
on trim(account.account_no) = trim(bs.LE_ACCOUNT_NO)
|
||||
and account.owner_type = 'EMPLOYEE'
|
||||
inner join ccdi_base_staff account_staff
|
||||
on account_staff.id_card = account.owner_id
|
||||
where bs.project_id = #{projectId}
|
||||
and bs.LE_ACCOUNT_NO is not null
|
||||
and trim(bs.LE_ACCOUNT_NO) != ''
|
||||
) scope_staff
|
||||
select count(distinct trim(bs.cret_no))
|
||||
from ccdi_bank_statement bs
|
||||
inner join ccdi_base_staff staff on staff.id_card = trim(bs.cret_no)
|
||||
where bs.project_id = #{projectId}
|
||||
and bs.cret_no is not null
|
||||
and trim(bs.cret_no) != ''
|
||||
</select>
|
||||
|
||||
<sql id="parsedTrxDateExpr">
|
||||
|
||||
@@ -221,18 +221,16 @@ class CcdiBankStatementMapperXmlTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void targetCount_shouldUseResolvedProjectEmployeeScope() throws Exception {
|
||||
void targetCount_shouldOnlyUseStatementCretNoMatchedStaff() throws Exception {
|
||||
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(RESOURCE)) {
|
||||
String xml = new String(inputStream.readAllBytes(), StandardCharsets.UTF_8);
|
||||
String selectSql = extractSelect(xml, "countMatchedStaffCountByProjectId");
|
||||
|
||||
assertTrue(selectSql.contains("select count(distinct scope_staff.id_card)"), selectSql);
|
||||
assertTrue(selectSql.contains("select count(distinct trim(bs.cret_no))"), selectSql);
|
||||
assertTrue(selectSql.contains("inner join ccdi_base_staff staff on staff.id_card = trim(bs.cret_no)"), selectSql);
|
||||
assertTrue(selectSql.contains("inner join ccdi_staff_fmy_relation relation"), selectSql);
|
||||
assertTrue(selectSql.contains("family_staff.id_card = relation.person_id"), selectSql);
|
||||
assertTrue(selectSql.contains("inner join ccdi_account_info account"), selectSql);
|
||||
assertTrue(selectSql.contains("account.owner_type = 'EMPLOYEE'"), selectSql);
|
||||
assertTrue(selectSql.contains("account_staff.id_card = account.owner_id"), selectSql);
|
||||
assertFalse(selectSql.contains("ccdi_staff_fmy_relation"), selectSql);
|
||||
assertFalse(selectSql.contains("ccdi_account_info"), selectSql);
|
||||
assertFalse(selectSql.contains("LE_ACCOUNT_NO"), selectSql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user