| | |
| | | WHERE cardAddr = #{cardAddr} |
| | | AND state IN (1, 3) |
| | | </select> |
| | | |
| | | <!--获取指定时间段水卡使用情况记录数量--> |
| | | <select id="getCardUsagesCount" resultType="com.dy.pipIrrGlobal.voSt.VoCardUsage"> |
| | | SELECT |
| | | cli.name AS clientName, |
| | | card.cardNum, |
| | | (SELECT ROUND(SUM(rch.amount),2) FROM se_recharge_history rch WHERE rch.cardId = card.id AND rch.operateDt BETWEEN #{timeStart} AND #{timeStop}) AS totalRecharge, |
| | | (SELECT ROUND(SUM(his.cl_this_money),2) FROM rm_open_close_valve_history his WHERE his.cl_ic_card_no = card.cardNum AND his.cl_dt BETWEEN #{timeStart} AND #{timeStop}) AS totalConsumption, |
| | | ROUND(card.money,2) AS balance |
| | | FROM se_client_card card |
| | | INNER JOIN se_client cli ON cli.id = card.clientId |
| | | INNER JOIN se_recharge_history rch ON rch.cardId = card.id |
| | | <where> |
| | | <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="clientNum != null and clientNum != ''"> |
| | | AND cli.clientNum like CONCAT('%', #{clientNum}, '%') |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!--获取指定时间段水卡使用情况:充值合计、消费合计、余额--> |
| | | <select id="getCardUsages" resultType="com.dy.pipIrrGlobal.voSt.VoCardUsage"> |
| | | SELECT |
| | | cli.name AS clientName, |
| | | card.cardNum, |
| | | (SELECT ROUND(SUM(rch.amount),2) FROM se_recharge_history rch WHERE rch.cardId = card.id AND rch.operateDt BETWEEN #{timeStart} AND #{timeStop}) AS totalRecharge, |
| | | (SELECT ROUND(SUM(his.cl_this_money),2) FROM rm_open_close_valve_history his WHERE his.cl_ic_card_no = card.cardNum AND his.cl_dt BETWEEN #{timeStart} AND #{timeStop}) AS totalConsumption, |
| | | ROUND(card.money,2) AS balance |
| | | FROM se_client_card card |
| | | INNER JOIN se_client cli ON cli.id = card.clientId |
| | | INNER JOIN se_recharge_history rch ON rch.cardId = card.id |
| | | <where> |
| | | <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="clientNum != null and clientNum != ''"> |
| | | AND cli.clientNum like CONCAT('%', #{clientNum}, '%') |
| | | </if> |
| | | </where> |
| | | ORDER BY cli.name, card.cardNum |
| | | <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="getTotalRecharge" resultType="java.lang.Float"> |
| | | SELECT ROUND(SUM(amount),2) AS totalRecharge |
| | | FROM se_recharge_history |
| | | WHERE operateDt BETWEEN #{timeStart} AND #{timeStop} |
| | | </select> |
| | | |
| | | <!--获取指定时间段内水卡消费总计--> |
| | | <select id="getTotalConsumption" resultType="java.lang.Float"> |
| | | SELECT ROUND(SUM(cl_this_money),2) AS totalConsumption |
| | | FROM rm_open_close_valve_history |
| | | WHERE cl_dt BETWEEN #{timeStart} AND #{timeStop} |
| | | </select> |
| | | </mapper> |