zhubaomin
2024-08-12 2555e23c828b603944f51883a580b401962b2209
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeVcOperateMapper.xml
@@ -143,7 +143,7 @@
    </select>
    <!--指定时间段内注册虚拟卡的农户-->
    <select id="getRegisterVcClients" resultType="com.dy.pipIrrGlobal.voSt.VoClientRegisterVC">
    <select id="getRegisterVcClients" resultType="com.dy.pipIrrGlobal.voSt.VoClientStatistics">
        SELECT cli.id   AS clientId,
               cli.name AS clientName
        FROM se_client cli
@@ -159,4 +159,57 @@
            </if>
        </trim>
    </select>
    <!--指定时间段内注册总数量-->
    <select id="getRegisterCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM se_vc_operate ope
        WHERE ope.operate_type = 1
          AND ope.operate_time BETWEEN #{timeStart} AND #{timeStop}
    </select>
    <!--指定时间段充值总数量-->
    <select id="getRechargeCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM se_vc_operate ope
                 INNER JOIN se_vc_recharge rec ON rec.id = ope.recharge_id
        WHERE ope.operate_type = 2
          AND rec.order_state = 2
          AND ope.operate_time BETWEEN #{timeStart} AND #{timeStop}
    </select>
    <!--当前余额总量-->
    <select id="getTotalBalance" resultType="java.lang.Double">
        SELECT SUM(money) AS totalBalance
        FROM se_virtual_card
    </select>
    <!--指定时间段内虚拟卡充值金额超过指定值的农户记录数量-->
    <select id="getLargeRechargeClientsCount" resultType="java.lang.Long">
        SELECT COUNT(*) AS recordCount
        FROM se_client cli
        WHERE (SELECT SUM(recharge_amount)
               FROM se_vc_recharge rec
               WHERE rec.client_id = cli.id
                 AND rec.order_state = 2
                 AND rec.order_time BETWEEN #{timeStart} AND #{timeStop}) > #{totalRecharge}
    </select>
    <!--指定时间段内虚拟卡充值金额超过指定值的农户-->
    <select id="getLargeRechargeClients" resultType="com.dy.pipIrrGlobal.voSt.VoClientStatistics">
        SELECT cli.id   AS clientId,
               cli.name AS clientName
        FROM se_client cli
        WHERE (SELECT SUM(recharge_amount)
               FROM se_vc_recharge rec
               WHERE rec.client_id = cli.id
                 AND rec.order_state = 2
                 AND rec.order_time BETWEEN #{timeStart} AND #{timeStop}) > #{totalRecharge}
        ORDER BY cli.id
        <trim prefix="limit ">
            <if test="start != null and count != null">
                #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER}
            </if>
        </trim>
    </select>
</mapper>