| | |
| | | <!--根据交易日期获取总账记录列表(待生成的) --> |
| | | <select id="getGeneralByOperateDate" resultType="com.dy.pipIrrGlobal.pojoSe.SeGeneral"> |
| | | SELECT |
| | | us.id AS cashierId, |
| | | us.`name` AS cashierName, |
| | | IFNULL(SUM(ope.trade_amount),0) AS tradeAmount, |
| | | IFNULL(SUM(ope.gift),0) AS gift, |
| | | IFNULL((SUM(ope.trade_amount) + SUM(ope.gift)),0) AS totalAmount, |
| | | Date(ope.operate_dt) AS operateDate, |
| | | 1 AS auditStatus |
| | | us.id AS cashierId, |
| | | us.`name` AS cashierName, |
| | | IFNULL(SUM(ope.trade_amount),0) AS tradeAmount, |
| | | IFNULL(SUM(ope.gift),0) AS gift, |
| | | IFNULL((SUM(ope.trade_amount) + SUM(ope.gift)),0) AS totalAmount, |
| | | Date(ope.operate_dt) AS operateDate, |
| | | 1 AS auditStatus |
| | | FROM se_card_operate ope |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | WHERE Date(ope.operate_dt) = #{operateDate} |
| | | GROUP BY ope.operator, Date(ope.operate_dt) |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | 1000000 AS cashierId, |
| | | '微信' AS cashierName, |
| | | IFNULL(SUM(amount), 0) AS tradeAmount, |
| | | 0 AS gift, |
| | | IFNULL(SUM(amount), 0) AS totalAmount, |
| | | Date(recharge_time) AS operateDate, |
| | | 1 AS auditStatus |
| | | FROM se_wallet_recharge |
| | | WHERE Date(recharge_time) = #{operateDate} |
| | | GROUP BY Date(recharge_time) |
| | | |
| | | UNION ALL |
| | | |
| | | SELECT |
| | | 1000000 AS cashierId, |
| | | '微信' AS cashierName, |
| | | IFNULL(-SUM(refund_amount), 0) AS tradeAmount, |
| | | 0 AS gift, |
| | | IFNULL(-SUM(refund_amount), 0) AS totalAmount, |
| | | Date(audit_time) AS operateDate, |
| | | 1 AS auditStatus |
| | | FROM se_refund |
| | | WHERE Date(audit_time) = #{operateDate} |
| | | GROUP BY Date(audit_time) |
| | | </select> |
| | | |
| | | <!--根据指定条件获取总账记录数--> |
| | |
| | | </where> |
| | | </select> |
| | | |
| | | <!--财务对账审核页,收银员+日期分组,排除交易类型分组--> |
| | | <!--财务对账审核页,收银员+日期+类型分组,排除交易类型分组--> |
| | | <select id="getToAudit" resultType="com.dy.pipIrrGlobal.voSe.VoTransactionStatistics"> |
| | | SELECT * FROM v_transactionstatistics2 |
| | | <where> |
| | |
| | | </if> |
| | | </where> |
| | | ORDER BY tradeDate |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <!-- 根据收银员ID及日期获取财务对账_交易明细记录数--> |
| | | <select id="getTradeDetailsRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM v_trade_details |
| | | <where> |
| | | <if test = "cashierId != null and cashierId > 0"> |
| | | AND cashierId = ${cashierId} |
| | | </if> |
| | | |
| | | <if test = "tradeDate != null"> |
| | | AND tradeDate = #{tradeDate} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据收银员ID及日期获取财务对账_交易明细记录--> |
| | | <select id="getTradeDetails" resultType="com.dy.pipIrrGlobal.voSe.VoTradeDetails"> |
| | | SELECT * FROM v_trade_details |
| | | <where> |
| | | <if test = "cashierId != null and cashierId > 0"> |
| | | AND cashierId = ${cashierId} |
| | | </if> |
| | | |
| | | <if test = "tradeDate != null"> |
| | | AND tradeDate = #{tradeDate} |
| | | </if> |
| | | </where> |
| | | ORDER BY tradeDate |
| | | </select> |
| | | </mapper> |