|
|
@@ -20,6 +20,7 @@ public interface PayBillMapper extends BaseMapper<PayBillEntity> {
|
|
|
* 单次 SQL 完成三个时间窗口聚合(参考 doStatAmount 模式)
|
|
|
*/
|
|
|
@Select("""
|
|
|
+ <script>
|
|
|
SELECT
|
|
|
COALESCE(SUM(CASE WHEN gmt_recieve_pay >= CURRENT_DATE
|
|
|
THEN consume_amount ELSE 0 END), 0) as amount_of_today,
|
|
|
@@ -28,9 +29,16 @@ public interface PayBillMapper extends BaseMapper<PayBillEntity> {
|
|
|
COALESCE(SUM(consume_amount), 0) as amount_of_all
|
|
|
FROM pay_bill
|
|
|
WHERE consume_type = 'CONSUME' AND status = 'PROCESSED'
|
|
|
+ <if test="tenantId != null">
|
|
|
AND tenant_id = #{tenantId}
|
|
|
+ </if>
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''">
|
|
|
AND enterprise_id = #{enterpriseId}
|
|
|
+ </if>
|
|
|
+ <if test="payeeType != null and payeeType != ''">
|
|
|
AND employee_id = #{payeeType}
|
|
|
+ </if>
|
|
|
+ </script>
|
|
|
""")
|
|
|
Map<String, BigDecimal> statConsumeAmount(@Param("tenantId") Long tenantId,
|
|
|
@Param("enterpriseId") String enterpriseId,
|