zhangwei 3 年 前
コミット
d055f49357
1 ファイル変更26 行追加10 行削除
  1. 26 10
      src/main/resources/mapper/RepalRemindHistoryMapper.xml

+ 26 - 10
src/main/resources/mapper/RepalRemindHistoryMapper.xml

@@ -39,37 +39,53 @@
             DUAL
     </select>
     <select id="remindCount" resultType="com.winhc.repal.model.vo.RepalRemindCountVO">
-        select (select count(*) from ACCOUNT_REMIND_HISTORY where REMIND_TYPE = 'OVERDUE'
+        select (select count(*) from REPAL_REMIND_HISTORY where REMIND_TYPE = 'OVERDUE'
         and  REMIND_TIME >= #{localDateTime}
         and REPAL_BILL_ID = #{repalBillId}
         ) AS overdueCount,
-        (select count(*) from ACCOUNT_REMIND_HISTORY where REMIND_TYPE = 'OVERDUE'
+        (select count(*) from REPAL_REMIND_HISTORY where REMIND_TYPE = 'OVERDUE'
         AND REMIND_TIME >= #{localDateTime}
         and REPAL_BILL_ID = #{repalBillId}
         AND ID > #{overdueId} ) AS unreadOverdueCount,
-        (select count(*) from ACCOUNT_REMIND_HISTORY where REMIND_TYPE = 'RISK'
+        (select count(*) from REPAL_REMIND_HISTORY where REMIND_TYPE = 'RISK'
         AND REMIND_TIME >= #{localDateTime}
         and REPAL_BILL_ID = #{repalBillId}) AS riskCount,
-        (select count(*) from ACCOUNT_REMIND_HISTORY where REMIND_TYPE = 'RISK'
+        (select count(*) from REPAL_REMIND_HISTORY where REMIND_TYPE = 'RISK'
         AND REMIND_TIME >= #{localDateTime}
         and REPAL_BILL_ID = #{repalBillId}
         AND ID > #{riskId}) AS unreadRiskCount,
-        (select count(*) from ACCOUNT_REMIND_HISTORY where REMIND_TYPE = 'FINANCE'
+        (select count(*) from REPAL_REMIND_HISTORY where REMIND_TYPE = 'FINANCE'
         and REPAL_BILL_ID = #{repalBillId}
         AND REMIND_TIME >= #{localDateTime}) AS financeCount,
-        (select count(*) from ACCOUNT_REMIND_HISTORY where REMIND_TYPE = 'FINANCE'
+        (select count(*) from REPAL_REMIND_HISTORY where REMIND_TYPE = 'FINANCE'
         AND REMIND_TIME >= #{localDateTime}
         and REPAL_BILL_ID = #{repalBillId}
         AND ID > #{financeId} ) AS unreadFinanceCount,
-        (select count(*) from ACCOUNT_REMIND_HISTORY where REMIND_TYPE = 'RANK'
+        (select count(*) from REPAL_REMIND_HISTORY where REMIND_TYPE = 'RANK'
         and REPAL_BILL_ID = #{repalBillId}
         AND REMIND_TIME >= #{localDateTime}) AS rankCount,
-        (select count(*) from ACCOUNT_REMIND_HISTORY where REMIND_TYPE = 'RANK'
+        (select count(*) from REPAL_REMIND_HISTORY where REMIND_TYPE = 'RANK'
         AND REMIND_TIME >= #{localDateTime}
         and REPAL_BILL_ID = #{repalBillId}
         AND ID > #{rankId}) AS unreadRankCount,
-        (select count(*) from ACCOUNT_REMIND_HISTORY where  REPAL_BILL_ID = #{repalBillId}
-        AND REMIND_TIME >= #{localDateTime}) AS totalCount
+        (select count(*) from REPAL_REMIND_HISTORY where  REPAL_BILL_ID = #{repalBillId}
+        AND REMIND_TIME >= #{localDateTime}) AS totalCount,
+               (select count(*) from REPAL_REMIND_HISTORY where REMIND_TYPE = 'OVERDUE'
+                                                            AND REMIND_TIME >= #{localDateTime}
+                                                            and REPAL_BILL_ID = #{repalBillId}
+                                                            AND ID > #{overdueId} )+
+               (select count(*) from REPAL_REMIND_HISTORY where REMIND_TYPE = 'RISK'
+                                                            AND REMIND_TIME >= #{localDateTime}
+                                                            and REPAL_BILL_ID = #{repalBillId}
+                                                            AND ID > #{riskId})+
+               (select count(*) from REPAL_REMIND_HISTORY where REMIND_TYPE = 'FINANCE'
+                                                            AND REMIND_TIME >= #{localDateTime}
+                                                            and REPAL_BILL_ID = #{repalBillId}
+                                                            AND ID > #{financeId} )+
+               (select count(*) from REPAL_REMIND_HISTORY where REMIND_TYPE = 'RANK'
+                                                            AND REMIND_TIME >= #{localDateTime}
+                                                            and REPAL_BILL_ID = #{repalBillId}
+                                                            AND ID > #{rankId}) as unreadTotalCount
         FROM DUAL
     </select>