| | |
| | | select |
| | | COUNT(*) AS recordCount |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | Left JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | Left JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | <where> |
| | | AND ope.operate_type in(2, 5) |
| | | <if test = "clientName != null and clientName !=''"> |
| | |
| | | AND card.cardNum like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | |
| | | <if test = "paymentId != null and paymentId > 0"> |
| | | AND ope.payment_id = ${paymentId} |
| | | </if> |
| | | <!-- <if test = "paymentId != null and paymentId > 0">--> |
| | | <!-- AND ope.payment_id = ${paymentId}--> |
| | | <!-- </if>--> |
| | | |
| | | <if test = "rechargeTimeStart != null and rechargeTimeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{rechargeTimeStart} AND #{rechargeTimeStop} |
| | | </if> |
| | | <!-- <if test = "rechargeTimeStart != null and rechargeTimeStop != null">--> |
| | | <!-- AND ope.operate_dt BETWEEN #{rechargeTimeStart} AND #{rechargeTimeStop}--> |
| | | <!-- </if>--> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取充值记录--> |
| | | <select id="getRecharges" resultType="com.dy.pipIrrGlobal.voSe.VoRecharge"> |
| | | SELECT |
| | | CAST(ope.id AS char) AS id, |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | | CAST(card.cardNum AS char) AS cardNum, |
| | | IFNULL(ope.trade_amount, 0) AS amount, |
| | | IFNULL(ope.refund_amount, 0) AS refundAmount, |
| | | (IFNULL(ope.money, 0) + IFNULL(ope.trade_amount, 0)) AS afterRecharge, |
| | | -- ope.payment_id AS paymentId, |
| | | pay.name AS paymentName, |
| | | ope.price, |
| | | us.name AS operator, |
| | | ope.operate_dt |
| | | ope.id AS opeId, |
| | | card.id AS cardId, |
| | | cli.name AS clientName, |
| | | cli.phone, |
| | | cli.idCard, |
| | | cli.clientNum, |
| | | cli.address, |
| | | card.money, |
| | | CASE |
| | | WHEN card.cardNum LIKE '10%' THEN CONCAT(SUBSTRING(card.cardNum, 7, 6),SUBSTRING(card.cardNum, 14, 4)) |
| | | ELSE card.cardNum |
| | | END AS cardNum, |
| | | IFNULL(ope.card_cost,0) AS cardCost, |
| | | IFNULL(ope.trade_amount, 0) AS amount, |
| | | IFNULL(ope.refund_amount, 0) AS refundAmount, |
| | | (IFNULL(ope.money, 0) + IFNULL(ope.trade_amount, 0)) AS afterRecharge, |
| | | pay.name AS paymentName, |
| | | ope.price, |
| | | us.name AS opr, |
| | | (CASE |
| | | WHEN ope.operate_type = 1 THEN "开卡" |
| | | WHEN ope.operate_type = 2 THEN "充值" |
| | | WHEN ope.operate_type = 5 THEN "返还" |
| | | END) AS operateType, |
| | | ope.operate_dt |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | Left JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | Left JOIN se_payment_method pay ON ope.payment_id = pay.id |
| | | <where> |
| | | AND ope.operate_type in(2, 5) |
| | | AND ope.operate_type in(1, 2, 5) |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | |
| | | AND card.cardNum like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | |
| | | <if test = "paymentId != null and paymentId > 0"> |
| | | AND ope.payment_id = ${paymentId} |
| | | </if> |
| | | <!-- <if test = "paymentId != null and paymentId > 0">--> |
| | | <!-- AND ope.payment_id = ${paymentId}--> |
| | | <!-- </if>--> |
| | | |
| | | <if test = "rechargeTimeStart != null and rechargeTimeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{rechargeTimeStart} AND #{rechargeTimeStop} |
| | | </if> |
| | | <!-- <if test = "rechargeTimeStart != null and rechargeTimeStop != null">--> |
| | | <!-- AND ope.operate_dt BETWEEN #{rechargeTimeStart} AND #{rechargeTimeStop}--> |
| | | <!-- </if>--> |
| | | </where> |
| | | ORDER BY ope.operate_dt DESC |
| | | <trim prefix="limit " > |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | <!--根据指定条件获取交易统计记录数--> |
| | | <select id="getTransactionStatisticsRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | SELECT |
| | | COUNT(*) AS recordCount |
| | | FROM v_transactionstatistics |
| | | <where> |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND tradeDate BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取交易统计记录--> |
| | | <select id="getTransactionStatistics" resultType="com.dy.pipIrrGlobal.voSe.VoTransactionStatistics"> |
| | | SELECT * FROM v_transactionstatistics |
| | | <where> |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND tradeDate BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY tradeDate |
| | | <if test="pageCurr != null and pageSize != null"> |
| | | LIMIT ${pageCurr}, ${pageSize} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--根基指定条件获取笔数合计、实收金额合计、赠送金额合计--> |
| | | <select id="getTransactionStatisticsSums" resultType="java.util.Map"> |
| | | SELECT |
| | | SUM(count) AS totalCount, |
| | | SUM(received) AS totalReceived, |
| | | SUM(gift) AS totalGift |
| | | FROM v_transactionstatistics |
| | | <where> |
| | | <if test = "operateTimeStart != null and operateTimeStop != null"> |
| | | AND tradeDate BETWEEN #{operateTimeStart} AND #{operateTimeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--获取指定日期、指定支付方式实收金额合计--> |
| | | <select id="getPaymentSums" resultType="java.lang.Float"> |
| | | SELECT |
| | | SUM(ope.trade_amount) AS tradeAmount |
| | | FROM se_card_operate ope |
| | | <where> |
| | | <if test = "tradeDate != null and tradeDate !=''"> |
| | | AND Date(ope.operate_dt) = #{tradeDate} |
| | | </if> |
| | | |
| | | <if test = "paymentId != null and paymentId >0"> |
| | | AND ope.payment_id = ${paymentId} |
| | | </if> |
| | | </where> |
| | | GROUP BY ope.payment_id, Date(ope.operate_dt) |
| | | </select> |
| | | |
| | | <!--根据指定条件获取开卡记录数量--> |
| | | <select id="getActiveCardRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | select |
| | |
| | | </select> |
| | | |
| | | <!--根据指定条件获取开卡记录--> |
| | | <select id="getActiveCards" resultType="com.dy.pipIrrGlobal.voSe.VoActiveCardNew"> |
| | | <select id="getActiveCards" resultType="com.dy.pipIrrGlobal.voSe.VoActiveCard"> |
| | | SELECT |
| | | CAST(ope.id AS char) AS id , |
| | | cli.name AS clientName, |
| | |
| | | |
| | | <if test = "activeTimeStart != null and activeTimeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{reissueCardTimeStart} AND #{reissueCardTimeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY ope.operate_dt DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取通用操作记录数量--> |
| | | <select id="getCommonOperationRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> |
| | | select |
| | | COUNT(*) AS recordCount |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | <where> |
| | | <if test = "operateType != null and operateType > 0"> |
| | | AND ope.operate_type = ${operateType} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum !=''"> |
| | | AND card.cardNum like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据指定条件获取通用操作记录--> |
| | | <select id="getCommonOperations" resultType="com.dy.pipIrrGlobal.voSe.VoOperate"> |
| | | SELECT |
| | | cli.name AS clientName, |
| | | cli.clientNum, |
| | | CAST(card.cardNum AS char) AS cardNum, |
| | | us.name AS operator, |
| | | ope.operate_dt AS operateDt, |
| | | IFNULL(ope.trade_amount,0) AS refund, |
| | | (CASE |
| | | WHEN ope.payment_id = 1 THEN "现金" |
| | | END) AS refundTypeName, |
| | | card.money, |
| | | IFNULL(ope.system_balance,0) AS systemBalance |
| | | FROM se_card_operate ope |
| | | INNER JOIN se_client cli ON ope.client_id = cli.id |
| | | INNER JOIN se_client_card card ON ope.card_id = card.id |
| | | INNER JOIN ba_user us ON ope.operator = us.id |
| | | <where> |
| | | <if test = "operateType != null and operateType > 0"> |
| | | AND ope.operate_type = ${operateType} |
| | | </if> |
| | | |
| | | <if test = "clientName != null and clientName !=''"> |
| | | AND cli.name like CONCAT('%',#{clientName},'%') |
| | | </if> |
| | | |
| | | <if test = "cardNum != null and cardNum !=''"> |
| | | AND card.cardNum like CONCAT('%',#{cardNum},'%') |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ope.operate_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | ORDER BY ope.operate_dt DESC |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--根据水卡编号获取其挂失时退款金额(补卡时判断使用)--> |
| | | <select id="getTradeAmountByCardNo" resultType="java.lang.Double"> |
| | | SELECT |
| | | ope.trade_amount AS tradeAmount |
| | | FROM se_client_card card |
| | | INNER JOIN se_card_operate ope ON ope.card_id = card.id |
| | | <where> |
| | | AND ope.operate_type = 6 |
| | | AND card.cardNum = #{cardNum} |
| | | </where> |
| | | </select> |
| | | </mapper> |