bugfix:对账完成
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.saye.hospitalgd.mapper.FinancialReconciliation.TenpaySummaryMapper">
|
||||
|
||||
<select id="findTenpayBankSummary" parameterType="HashMap" resultType="HashMap">
|
||||
SELECT '微信支付' AS PAY_NAME,
|
||||
COUNT(1) AS CNT,
|
||||
CAST(IFNULL(SUM(CAST(C_JYJE AS DECIMAL(19,2))),0) AS DECIMAL(19,2)) AS AMT
|
||||
FROM bankbill_history
|
||||
<where>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND C_JYRQ >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND C_JYRQ <= #{endTime}
|
||||
</if>
|
||||
AND bill_table_name = '微信支付账单'
|
||||
AND C_JYLX = '1'
|
||||
</where>
|
||||
UNION ALL
|
||||
SELECT '支付宝支付' AS PAY_NAME,
|
||||
0 AS CNT,
|
||||
CAST(0 AS DECIMAL(19,2)) AS AMT
|
||||
UNION ALL
|
||||
SELECT '刷卡支付' AS PAY_NAME,
|
||||
0 AS CNT,
|
||||
CAST(0 AS DECIMAL(19,2)) AS AMT
|
||||
UNION ALL
|
||||
SELECT '退款' AS PAY_NAME,
|
||||
COUNT(1) AS CNT,
|
||||
CAST(IFNULL(SUM(CAST(C_JYJE AS DECIMAL(19,2))),0) AS DECIMAL(19,2)) AS AMT
|
||||
FROM bankbill_history
|
||||
<where>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND C_JYRQ >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND C_JYRQ <= #{endTime}
|
||||
</if>
|
||||
AND bill_table_name = '微信支付账单'
|
||||
AND C_JYLX = '2'
|
||||
</where>
|
||||
UNION ALL
|
||||
SELECT '合计' AS PAY_NAME,
|
||||
COUNT(1) AS CNT,
|
||||
CAST(IFNULL(SUM(CAST(C_JYJE AS DECIMAL(19,2))),0) AS DECIMAL(19,2)) AS AMT
|
||||
FROM bankbill_history
|
||||
<where>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND C_JYRQ >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND C_JYRQ <= #{endTime}
|
||||
</if>
|
||||
AND bill_table_name = '微信支付账单'
|
||||
AND C_JYLX IN ('1','2')
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="findTenpayHisSummary" parameterType="HashMap" resultType="HashMap">
|
||||
SELECT '微信支付' AS PAY_NAME,
|
||||
COUNT(1) AS CNT,
|
||||
CAST(IFNULL(SUM(CAST(Amount AS DECIMAL(19,2))),0) AS DECIMAL(19,2)) AS AMT
|
||||
FROM hisbill_history
|
||||
<where>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND trade_date >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND trade_date <= #{endTime}
|
||||
</if>
|
||||
AND LOWER(HisOperCode) = 'wx'
|
||||
AND TradingStatus = '1'
|
||||
</where>
|
||||
UNION ALL
|
||||
SELECT '支付宝支付' AS PAY_NAME,
|
||||
0 AS CNT,
|
||||
CAST(0 AS DECIMAL(19,2)) AS AMT
|
||||
UNION ALL
|
||||
SELECT '刷卡支付' AS PAY_NAME,
|
||||
0 AS CNT,
|
||||
CAST(0 AS DECIMAL(19,2)) AS AMT
|
||||
UNION ALL
|
||||
SELECT '退款' AS PAY_NAME,
|
||||
COUNT(1) AS CNT,
|
||||
CAST(IFNULL(SUM(CAST(Amount AS DECIMAL(19,2))),0) AS DECIMAL(19,2)) AS AMT
|
||||
FROM hisbill_history
|
||||
<where>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND trade_date >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND trade_date <= #{endTime}
|
||||
</if>
|
||||
AND LOWER(HisOperCode) = 'wx'
|
||||
AND TradingStatus = '2'
|
||||
</where>
|
||||
UNION ALL
|
||||
SELECT '合计' AS PAY_NAME,
|
||||
COUNT(1) AS CNT,
|
||||
CAST(IFNULL(SUM(CAST(Amount AS DECIMAL(19,2))),0) AS DECIMAL(19,2)) AS AMT
|
||||
FROM hisbill_history
|
||||
<where>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
AND trade_date >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
AND trade_date <= #{endTime}
|
||||
</if>
|
||||
AND LOWER(HisOperCode) = 'wx'
|
||||
AND TradingStatus IN ('1','2')
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user