feat: 银行卡数量统计编码。
This commit is contained in:
@@ -992,4 +992,38 @@
|
||||
t.type
|
||||
</select>
|
||||
|
||||
<resultMap type="BankCardStatisticsVo" id="BankCardStatisticsResult">
|
||||
<result property="bankId" column="bank_id" />
|
||||
<result property="bankName" column="bank_name" />
|
||||
<result property="creditCardCount" column="credit_card_count" />
|
||||
<result property="debitCardCount" column="debit_card_count" />
|
||||
<result property="debitTypeOneCount" column="debit_type_one_count" />
|
||||
<result property="debitTypeTwoCount" column="debit_type_two_count" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectBankCardStatistics" parameterType="AccountsDto" resultMap="BankCardStatisticsResult">
|
||||
select
|
||||
b.id as bank_id,
|
||||
b.bank_name,
|
||||
COALESCE(SUM(CASE WHEN a.type = '2' THEN 1 ELSE 0 END), 0) as credit_card_count,
|
||||
COALESCE(SUM(CASE WHEN a.type = '1' THEN 1 ELSE 0 END), 0) as debit_card_count,
|
||||
COALESCE(SUM(CASE WHEN a.type = '1' AND a.debit_type = '1' THEN 1 ELSE 0 END), 0) as debit_type_one_count,
|
||||
COALESCE(SUM(CASE WHEN a.type = '1' AND a.debit_type = '2' THEN 1 ELSE 0 END), 0) as debit_type_two_count
|
||||
from
|
||||
bank_base_info b
|
||||
inner join bank_card_lend a on
|
||||
a.bank_id = b.id
|
||||
and a.del_flag = '0'
|
||||
and a.status = '1'
|
||||
where
|
||||
b.del_flag = '0'
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
group by
|
||||
b.id,
|
||||
b.bank_name
|
||||
order by
|
||||
b.bank_name
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user