|
@@ -85,7 +85,8 @@
|
|
|
group by temp.date
|
|
group by temp.date
|
|
|
order by temp.date
|
|
order by temp.date
|
|
|
</select>
|
|
</select>
|
|
|
- <select id="countMonth" resultType="com.sckw.payment.model.vo.SettlementRecord">
|
|
|
|
|
|
|
+ <!--原方案 按月统计-->
|
|
|
|
|
+ <select id="countMonth2" resultType="com.sckw.payment.model.vo.SettlementRecord">
|
|
|
SELECT temp.date createTime,
|
|
SELECT temp.date createTime,
|
|
|
ifnull(sum(ksr.total_receive_money), 0) totalReceiveMoney,
|
|
ifnull(sum(ksr.total_receive_money), 0) totalReceiveMoney,
|
|
|
ifnull(sum(ksr.exact_money), 0) exactMoney,
|
|
ifnull(sum(ksr.exact_money), 0) exactMoney,
|
|
@@ -114,4 +115,43 @@
|
|
|
group by temp.date
|
|
group by temp.date
|
|
|
order by temp.date
|
|
order by temp.date
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+ <!-- 支持时间范围筛选的按月统计-->
|
|
|
|
|
+ <select id="countMonth" resultType="com.sckw.payment.model.vo.SettlementRecord">
|
|
|
|
|
+ select tmpd.createTime,
|
|
|
|
|
+ tmpd.totalReceiveMoney,
|
|
|
|
|
+ tmpd.exactMoney,
|
|
|
|
|
+ tmpd.receivedMoney,
|
|
|
|
|
+ tmpd.overdueExactMoney,
|
|
|
|
|
+ tmpd.totalPayMoney,
|
|
|
|
|
+ tmpd.unpaidMoney,
|
|
|
|
|
+ tmpd.paidMoney,
|
|
|
|
|
+ tmpd.overduePaidMoney
|
|
|
|
|
+ FROM (
|
|
|
|
|
+ <foreach collection="timeAll" item="date" separator="UNION ALL">
|
|
|
|
|
+ SELECT #{date} AS date
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ ) AS temp
|
|
|
|
|
+ left join
|
|
|
|
|
+ (SELECT date_format(ksr.create_time, '%Y-%m') createTime,
|
|
|
|
|
+ ifnull(sum(ksr.total_receive_money), 0) totalReceiveMoney,
|
|
|
|
|
+ ifnull(sum(ksr.exact_money), 0) exactMoney,
|
|
|
|
|
+ ifnull(sum(ksr.received_money), 0) receivedMoney,
|
|
|
|
|
+ ifnull(sum(ksr.overdue_exact_money), 0) overdueExactMoney,
|
|
|
|
|
+ ifnull(sum(ksr.total_pay_money), 0) totalPayMoney,
|
|
|
|
|
+ ifnull(sum(ksr.unpaid_money), 0) unpaidMoney,
|
|
|
|
|
+ ifnull(sum(ksr.paid_money), 0) paidMoney,
|
|
|
|
|
+ ifnull(sum(ksr.overdue_paid_money), 0) overduePaidMoney
|
|
|
|
|
+ FROM kwp_settlement_record ksr
|
|
|
|
|
+ <where>
|
|
|
|
|
+ ksr.ent_id = #{entId,jdbcType=BIGINT}
|
|
|
|
|
+ <if test="time != null and time.size() != 0">
|
|
|
|
|
+ and ksr.create_time between
|
|
|
|
|
+ <foreach collection="time" open=" " separator="and" close=" " item="item">
|
|
|
|
|
+ #{item,jdbcType=TIMESTAMP}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ group by date_format(ksr.create_time, '%Y-%m')) as tmpd on temp.date = tmpd.createTime
|
|
|
|
|
+ order by temp.date
|
|
|
|
|
+ </select>
|
|
|
</mapper>
|
|
</mapper>
|