From 09206aedcfdf30050123e99f2af0a192ebad1de4 Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Mon, 03 Jun 2024 18:08:33 +0800
Subject: [PATCH] 1

---
 src/main/resources/mapper/UserRechargeMapper.xml |  675 ++++++++++++++++++++++---------------------------------
 1 files changed, 273 insertions(+), 402 deletions(-)

diff --git a/src/main/resources/mapper/UserRechargeMapper.xml b/src/main/resources/mapper/UserRechargeMapper.xml
index 047401d..3e4767c 100644
--- a/src/main/resources/mapper/UserRechargeMapper.xml
+++ b/src/main/resources/mapper/UserRechargeMapper.xml
@@ -1,424 +1,295 @@
 <?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.nq.dao.UserRechargeMapper">
-    <resultMap id="BaseResultMap" type="com.nq.pojo.UserRecharge">
-        <id column="id" property="id"/>
-        <result column="user_id" property="userId"/>
-        <result column="nick_name" property="nickName"/>
-        <result column="agent_id" property="agentId"/>
-        <result column="order_sn" property="orderSn"/>
-        <result column="pay_sn" property="paySn"/>
-        <result column="pay_channel" property="payChannel"/>
-        <result column="pay_amt" property="payAmt"/>
-        <result column="order_status" property="orderStatus"/>
-        <result column="order_desc" property="orderDesc"/>
-        <result column="add_time" property="addTime"/>
-        <result column="pay_time" property="payTime"/>
-        <result column="pay_id" property="payId"/>
-        <result column="pay_type" property="payType"/>
-        <result column="img" property="img"/>
-    </resultMap>
-    <sql id="Base_Column_List">
-        id, user_id, nick_name, agent_id, order_sn, pay_sn, pay_channel, pay_amt, order_status,
-    order_desc, add_time, pay_time, pay_id,img,pay_type,user_phone,channel_name,assets_type,wallet_address,
-        pay_name,bank_num,route_num,pay_phone,pay_mail
-    </sql>
-    <insert id="insert" parameterType="com.nq.pojo.UserRecharge">
-        insert into user_recharge (id, user_id, nick_name,
-                                   agent_id, order_sn, pay_sn,
-                                   pay_channel, pay_amt, order_status,
-                                   order_desc, add_time, pay_time, pay_id, img, user_phone)
-        values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR},
-                #{agentId,jdbcType=INTEGER}, #{orderSn,jdbcType=VARCHAR}, #{paySn,jdbcType=VARCHAR},
-                #{payChannel,jdbcType=VARCHAR}, #{payAmt,jdbcType=DECIMAL}, #{orderStatus,jdbcType=INTEGER},
-                #{orderDesc,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP}, #{payTime,jdbcType=TIMESTAMP},
-                #{payId,jdbcType=INTEGER}, #{img,jdbcType=VARCHAR}, #{userPhone,jdbcType=VARCHAR})
-    </insert>
-    <insert id="insertSelective" parameterType="com.nq.pojo.UserRecharge">
-        insert into user_recharge
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="id != null">
-                id,
-            </if>
-            <if test="userId != null">
-                user_id,
-            </if>
-            <if test="nickName != null">
-                nick_name,
-            </if>
-            <if test="agentId != null">
-                agent_id,
-            </if>
-            <if test="orderSn != null">
-                order_sn,
-            </if>
-            <if test="paySn != null">
-                pay_sn,
-            </if>
-            <if test="payChannel != null">
-                pay_channel,
-            </if>
-            <if test="payAmt != null">
-                pay_amt,
-            </if>
-            <if test="orderStatus != null">
-                order_status,
-            </if>
-            <if test="orderDesc != null">
-                order_desc,
-            </if>
-            <if test="addTime != null">
-                add_time,
-            </if>
-            <if test="payTime != null">
-                pay_time,
-            </if>
-            <if test="payId != null">
-                pay_id,
-            </if>
-            <if test="payType != null">
-                pay_type,
-            </if>
-            <if test="img != null">
-                img,
-            </if>
-            <if test="userPhone != null">
-                user_phone,
-            </if>
-            <if test="channelName != null">
-                channel_name,
-            </if>
-            <if test="assetsType != null">
-                assets_type,
-            </if>
-            <if test="walletAddress != null">
-                wallet_address,
-            </if>
-            <if test="payName != null">
-                pay_name,
-            </if>
-            <if test="bankNum != null">
-                bank_num,
-            </if>
-            <if test="routeNum != null">
-                route_num,
-            </if>
-            <if test="payPhone != null">
-                pay_phone,
-            </if>
-            <if test="payMail != null">
-                pay_mail,
-            </if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="id != null">
-                #{id,jdbcType=INTEGER},
-            </if>
-            <if test="userId != null">
-                #{userId,jdbcType=INTEGER},
-            </if>
-            <if test="nickName != null">
-                #{nickName,jdbcType=VARCHAR},
-            </if>
-            <if test="agentId != null">
-                #{agentId,jdbcType=INTEGER},
-            </if>
-            <if test="orderSn != null">
-                #{orderSn,jdbcType=VARCHAR},
-            </if>
-            <if test="paySn != null">
-                #{paySn,jdbcType=VARCHAR},
-            </if>
-            <if test="payChannel != null">
-                #{payChannel,jdbcType=VARCHAR},
-            </if>
-            <if test="payAmt != null">
-                #{payAmt,jdbcType=DECIMAL},
-            </if>
-            <if test="orderStatus != null">
-                #{orderStatus,jdbcType=INTEGER},
-            </if>
-            <if test="orderDesc != null">
-                #{orderDesc,jdbcType=VARCHAR},
-            </if>
-            <if test="addTime != null">
-                #{addTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="payTime != null">
-                #{payTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="payId != null">
-                #{payId,jdbcType=INTEGER},
-            </if>
-            <if test="payType != null">
-                #{payType,jdbcType=INTEGER},
-            </if>
-            <if test="img != null">
-                #{img,jdbcType=VARCHAR},
-            </if>
-            <if test="userPhone != null">
-                #{userPhone,jdbcType=VARCHAR},
-            </if>
-            <if test="channelName != null">
-                #{channelName,jdbcType=VARCHAR},
-            </if>
-            <if test="assetsType != null">
-                #{assetsType,jdbcType=VARCHAR},
-            </if>
-            <if test="walletAddress != null">
-                #{walletAddress,jdbcType=VARCHAR},
-            </if>
-            <if test="payName != null">
-                #{payName,jdbcType=VARCHAR},
-            </if>
-            <if test="bankNum != null">
-                #{bankNum,jdbcType=VARCHAR},
-            </if>
-            <if test="routeNum != null">
-                #{routeNum,jdbcType=VARCHAR},
-            </if>
-            <if test="payPhone != null">
-                #{payPhone,jdbcType=VARCHAR},
-            </if>
-            <if test="payMail != null">
-                #{payMail,jdbcType=VARCHAR},
-            </if>
-
-        </trim>
-    </insert>
-    <update id="updateByPrimaryKeySelective" parameterType="com.nq.pojo.UserRecharge">
-        update user_recharge
-        <set>
-            <if test="userId != null">
-                user_id = #{userId,jdbcType=INTEGER},
-            </if>
-            <if test="nickName != null">
-                nick_name = #{nickName,jdbcType=VARCHAR},
-            </if>
-            <if test="agentId != null">
-                agent_id = #{agentId,jdbcType=INTEGER},
-            </if>
-            <if test="orderSn != null">
-                order_sn = #{orderSn,jdbcType=VARCHAR},
-            </if>
-            <if test="paySn != null">
-                pay_sn = #{paySn,jdbcType=VARCHAR},
-            </if>
-            <if test="payChannel != null">
-                pay_channel = #{payChannel,jdbcType=VARCHAR},
-            </if>
-            <if test="payAmt != null">
-                pay_amt = #{payAmt,jdbcType=DECIMAL},
-            </if>
-            <if test="orderStatus != null">
-                order_status = #{orderStatus,jdbcType=INTEGER},
-            </if>
-            <if test="orderDesc != null">
-                order_desc = #{orderDesc,jdbcType=VARCHAR},
-            </if>
-            <if test="addTime != null">
-                add_time = #{addTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="payTime != null">
-                pay_time = #{payTime,jdbcType=TIMESTAMP},
-            </if>
-            <if test="payId != null">
-                pay_id = #{payId,jdbcType=INTEGER},
-            </if>
-            <if test="payType != null">
-                pay_type = #{payType,jdbcType=INTEGER},
-            </if>
-            <if test="img != null">
-                img = #{img,jdbcType=VARCHAR},
-            </if>
-            <if test="userPhone != null">
-                user_phone = #{userPhone,jdbcType=VARCHAR},
-            </if>
-            <if test="channelName != null">
-                channel_name = #{channelName,jdbcType=VARCHAR},
-            </if>
-            <if test="assetsType != null">
-                assets_type = #{assetsType,jdbcType=VARCHAR},
-            </if>
-            <if test="walletAddress != null">
-                wallet_address = #{walletAddress,jdbcType=VARCHAR},
-            </if>
-            <if test="payName != null">
-                pay_name = #{payName,jdbcType=VARCHAR},
-            </if>
-            <if test="bankNum != null">
-                bank_num = #{bankNum,jdbcType=VARCHAR},
-            </if>
-            <if test="routeNum != null">
-                route_num = #{routeNum,jdbcType=VARCHAR},
-            </if>
-            <if test="payPhone != null">
-                pay_phone = #{payPhone,jdbcType=VARCHAR},
-            </if>
-            <if test="payMail != null">
-                pay_mail = #{payMail,jdbcType=VARCHAR},
-            </if>
-        </set>
-        where id = #{id,jdbcType=INTEGER}
-    </update>
-    <update id="updateByPrimaryKey" parameterType="com.nq.pojo.UserRecharge">
-        update user_recharge
-        set user_id      = #{userId,jdbcType=INTEGER},
-            nick_name    = #{nickName,jdbcType=VARCHAR},
-            agent_id     = #{agentId,jdbcType=INTEGER},
-            order_sn     = #{orderSn,jdbcType=VARCHAR},
-            pay_sn       = #{paySn,jdbcType=VARCHAR},
-            pay_channel  = #{payChannel,jdbcType=VARCHAR},
-            pay_amt      = #{payAmt,jdbcType=DECIMAL},
-            order_status = #{orderStatus,jdbcType=INTEGER},
-            order_desc   = #{orderDesc,jdbcType=VARCHAR},
-            add_time     = #{addTime,jdbcType=TIMESTAMP},
-            pay_time     = #{payTime,jdbcType=TIMESTAMP}
-        where id = #{id,jdbcType=INTEGER}
-    </update>
+<mapper namespace="com.nq.dao.UserRechargeMapper" >
+  <resultMap id="BaseResultMap" type="com.nq.pojo.UserRecharge" >
+      <id column="id" property="id" />
+      <result column="user_id"  property="userId"/>
+      <result column="nick_name"  property="nickName"/>
+      <result column="agent_id"  property="agentId"/>
+      <result column="order_sn"  property="orderSn"/>
+      <result column="pay_sn"  property="paySn"/>
+      <result column="pay_channel" property="payChannel"/>
+      <result column="pay_amt" property="payAmt"/>
+      <result column="order_status"  property="orderStatus"/>
+      <result column="order_desc"  property="orderDesc"/>
+      <result column="add_time"   property="addTime"/>
+      <result column="pay_time"  property="payTime"/>
+      <result column="pay_id"  property="payId"/>
+      <result column="img" property="img"/>
+      <result column="assets_type" property="assetsType"/>
+  </resultMap>
+  <sql id="Base_Column_List" >
+    id, user_id, nick_name, agent_id, order_sn, pay_sn, pay_channel, pay_amt, order_status,
+    order_desc, add_time, pay_time, pay_id,img
+  </sql>
+  <insert id="insertSelective" parameterType="com.nq.pojo.UserRecharge" >
+    insert into user_recharge
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        id,
+      </if>
+      <if test="userId != null" >
+        user_id,
+      </if>
+      <if test="nickName != null" >
+        nick_name,
+      </if>
+      <if test="agentId != null" >
+        agent_id,
+      </if>
+      <if test="orderSn != null" >
+        order_sn,
+      </if>
+      <if test="paySn != null" >
+        pay_sn,
+      </if>
+      <if test="payChannel != null" >
+        pay_channel,
+      </if>
+      <if test="payAmt != null" >
+        pay_amt,
+      </if>
+      <if test="orderStatus != null" >
+        order_status,
+      </if>
+      <if test="orderDesc != null" >
+        order_desc,
+      </if>
+      <if test="addTime != null" >
+        add_time,
+      </if>
+      <if test="payTime != null" >
+        pay_time,
+      </if>
+      <if test="payId != null" >
+        pay_id,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        #{id,jdbcType=INTEGER},
+      </if>
+      <if test="userId != null" >
+        #{userId,jdbcType=INTEGER},
+      </if>
+      <if test="nickName != null" >
+        #{nickName,jdbcType=VARCHAR},
+      </if>
+      <if test="agentId != null" >
+        #{agentId,jdbcType=INTEGER},
+      </if>
+      <if test="orderSn != null" >
+        #{orderSn,jdbcType=VARCHAR},
+      </if>
+      <if test="paySn != null" >
+        #{paySn,jdbcType=VARCHAR},
+      </if>
+      <if test="payChannel != null" >
+        #{payChannel,jdbcType=VARCHAR},
+      </if>
+      <if test="payAmt != null" >
+        #{payAmt,jdbcType=DECIMAL},
+      </if>
+      <if test="orderStatus != null" >
+        #{orderStatus,jdbcType=INTEGER},
+      </if>
+      <if test="orderDesc != null" >
+        #{orderDesc,jdbcType=VARCHAR},
+      </if>
+      <if test="addTime != null" >
+        #{addTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="payTime != null" >
+        #{payTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="payId != null" >
+        #{payId,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.nq.pojo.UserRecharge" >
+    update user_recharge
+    <set >
+      <if test="userId != null" >
+        user_id = #{userId,jdbcType=INTEGER},
+      </if>
+      <if test="nickName != null" >
+        nick_name = #{nickName,jdbcType=VARCHAR},
+      </if>
+      <if test="agentId != null" >
+        agent_id = #{agentId,jdbcType=INTEGER},
+      </if>
+      <if test="orderSn != null" >
+        order_sn = #{orderSn,jdbcType=VARCHAR},
+      </if>
+      <if test="paySn != null" >
+        pay_sn = #{paySn,jdbcType=VARCHAR},
+      </if>
+      <if test="payChannel != null" >
+        pay_channel = #{payChannel,jdbcType=VARCHAR},
+      </if>
+      <if test="payAmt != null" >
+        pay_amt = #{payAmt,jdbcType=DECIMAL},
+      </if>
+      <if test="orderStatus != null" >
+        order_status = #{orderStatus,jdbcType=INTEGER},
+      </if>
+      <if test="orderDesc != null" >
+        order_desc = #{orderDesc,jdbcType=VARCHAR},
+      </if>
+      <if test="addTime != null" >
+        add_time = #{addTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="payTime != null" >
+        pay_time = #{payTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.nq.pojo.UserRecharge" >
+    update user_recharge
+    set user_id = #{userId,jdbcType=INTEGER},
+      nick_name = #{nickName,jdbcType=VARCHAR},
+      agent_id = #{agentId,jdbcType=INTEGER},
+      order_sn = #{orderSn,jdbcType=VARCHAR},
+      pay_sn = #{paySn,jdbcType=VARCHAR},
+      pay_channel = #{payChannel,jdbcType=VARCHAR},
+      pay_amt = #{payAmt,jdbcType=DECIMAL},
+      order_status = #{orderStatus,jdbcType=INTEGER},
+      order_desc = #{orderDesc,jdbcType=VARCHAR},
+      add_time = #{addTime,jdbcType=TIMESTAMP},
+      pay_time = #{payTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
 
 
-    <select id="checkInMoney" resultType="integer" parameterType="map">
-        SELECT COUNT(*)
-        FROM user_recharge
-        WHERE user_id = #{userId}
-          and order_status = #{status}
-          and add_time > date_sub(now(), interval 1 hour)
-    </select>
 
 
-    <select id="findUserRechargeByOrderSn" parameterType="string" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM user_recharge
-        WHERE order_sn = #{orderSn}
-    </select>
+
+  <select id="checkInMoney" resultType="integer" parameterType="map">
+    SELECT COUNT(*) FROM user_recharge
+    WHERE user_id = #{userId}
+    and order_status = #{status}
+    and add_time > date_sub(now(), interval 1 hour)
+  </select>
 
 
-    <select id="findUserChargeList" resultMap="BaseResultMap" parameterType="map">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM user_recharge
-        <where>
-            user_id = #{uid}
-            <if test="payChannel != null and payChannel != '' ">
-                and pay_channel = #{payChannel}
-            </if>
-            <if test="orderStatus != null and orderStatus != '' ">
-                and order_status = #{orderStatus}
-            </if>
-        </where>
-        ORDER BY id DESC
-    </select>
+  <select id="findUserRechargeByOrderSn" parameterType="string" resultMap="BaseResultMap">
+    SELECT
+    <include refid="Base_Column_List"/>
+    FROM user_recharge
+    WHERE order_sn = #{orderSn}
+  </select>
 
 
-    <select id="listByAdmin" parameterType="map" resultType="com.nq.pojo.UserRecharge">
-        SELECT
-        s.id, s.user_id, s.nick_name, s.agent_id, s.order_sn, s.pay_sn, s.pay_channel,s.user_phone,
-        s.pay_amt, s.order_status,s.order_desc,s.add_time,s.pay_time,s.pay_id,s.img ,s.channel_name,s.assets_type
-        FROM user_recharge s
-        left join site_pay p
-        on s.pay_id = p.id
-        where agent_id != 1
-        <if test="agentId != null">
-            and ( agent_id = #{agentId}
-            or agent_id in (
-            select agent_user.id
-            FROM agent_user
-            where parent_id = ${agentId}
-            )
-            )
-        </if>
-        <if test="userId != null">
-            and user_id = #{userId}
-        </if>
-        <if test="realName != null and realName != '' ">
-            and nick_name like CONCAT('%','${realName}','%')
-        </if>
-        <if test="state != null">
-            and order_status = #{state}
-        </if>
-
-        <if test="begin_time != null ">
-            and pay_time <![CDATA[>=]]> #{begin_time}
-        </if>
-        <if test="end_time != null ">
-            and pay_time <![CDATA[<=]]> #{end_time}
-        </if>
-        ORDER BY s.id DESC
-    </select>
+  <select id="findUserChargeList" resultMap="BaseResultMap" parameterType="map">
+    SELECT
+    <include refid="Base_Column_List"/>
+    FROM user_recharge
+    <where>
+      user_id = #{uid}
+      <if test="payChannel != null and payChannel != '' ">
+        and pay_channel = #{payChannel}
+      </if>
+      <if test="orderStatus != null and orderStatus != '' ">
+        and order_status = #{orderStatus}
+      </if>
+    </where>
+    ORDER BY id DESC
+  </select>
 
 
-    <delete id="deleteByUserId" parameterType="integer">
-        DELETE
-        FROM user_recharge
-        WHERE user_id = #{userId}
-    </delete>
+
+  <select id="listByAdmin" parameterType="map" resultType="com.nq.pojo.UserRecharge">
+    SELECT
+    s.id, s.user_id, s.nick_name, s.agent_id, s.order_sn, s.pay_sn, s.pay_channel,
+    s.pay_amt, s.order_status,s.order_desc,s.add_time,s.pay_time,s.pay_id,s.img ,p.channel_name,p.assets_type
+    FROM user_recharge s
+    join site_pay p
+    on s.pay_id = p.id
+    where  agent_id != 1
+    <if test="agentId != null">
+      and ( agent_id = #{agentId}
+      or agent_id in (
+      select agent_user.id
+      FROM agent_user
+      where parent_id = ${agentId}
+      )
+      )
+    </if>
+    <if test="userId != null">
+      and user_id = #{userId}
+    </if>
+    <if test="realName != null and realName != '' ">
+      and nick_name like CONCAT('%','${realName}','%')
+    </if>
+    <if test="state != null">
+      and order_status = #{state}
+    </if>
+
+    <if test="begin_time != null ">
+      and pay_time <![CDATA[>=]]> #{begin_time}
+    </if>
+    <if test="end_time != null ">
+      and pay_time <![CDATA[<=]]> #{end_time}
+    </if>
+    ORDER BY s.id DESC
+  </select>
 
 
-    <select id="listByAgent" parameterType="map" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM user_recharge
-        <where>
-            agent_id = #{searchId}
-            <if test="realName != null and realName != '' ">
-                and nick_name like CONCAT('%','${realName}','%')
-            </if>
-            <if test="payChannel != null and payChannel != '' ">
-                and pay_channel = #{payChannel}
-            </if>
-            <if test="state != null">
-                and order_status = #{state}
-            </if>
-        </where>
-        ORDER BY id DESC
-    </select>
-
-    <select id="queryDayFrist" resultMap="BaseResultMap">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM user_recharge WHERE TO_DAYS(add_time) = TO_DAYS(NOW()) AND order_status = 1 GROUP BY user_id
-    </select>
+  <delete id="deleteByUserId" parameterType="integer" >
+    DELETE FROM user_recharge WHERE user_id = #{userId}
+  </delete>
 
 
-    <select id="queryDayFrist" resultMap="BaseResultMap" parameterType="integer">
-        SELECT
-        <include refid="Base_Column_List"/>
-        FROM user_recharge WHERE TO_DAYS(add_time) = TO_DAYS(NOW()) AND order_status = 1 GROUP BY user_id AND agent_id =
-        #{id}
-    </select>
+  <select id="listByAgent" parameterType="map" resultMap="BaseResultMap">
+    SELECT
+    <include refid="Base_Column_List"/>
+    FROM user_recharge
+    <where>
+      agent_id = #{searchId}
+      <if test="realName != null and realName != '' ">
+        and nick_name like CONCAT('%','${realName}','%')
+      </if>
+      <if test="payChannel != null and payChannel != '' ">
+        and pay_channel = #{payChannel}
+      </if>
+      <if test="state != null">
+        and order_status = #{state}
+      </if>
+    </where>
+    ORDER BY id DESC
+  </select>
 
-    <!--累计充值金额-->
-    <select id="CountChargeSumAmt" resultType="decimal" parameterType="integer">
-        SELECT sum(pay_amt)
-        FROM user_recharge
-        WHERE order_status = #{chargeState}
-    </select>
+  <select id="queryDayFrist"  resultMap="BaseResultMap">
+    SELECT   <include refid="Base_Column_List"/>
+        FROM user_recharge WHERE TO_DAYS(add_time) = TO_DAYS(NOW())  AND  order_status = 1  GROUP BY  user_id
+  </select>
 
-    <!--累计充值金额-->
-    <select id="agentCountChargeSumAmt" resultType="decimal" parameterType="map">
-        SELECT sum(pay_amt)
-        FROM user_recharge
-        WHERE order_status = #{chargeState}
-          and agent_id = #{agentId}
-    </select>
 
-    <!--今日充值金额-->
-    <select id="CountTotalRechargeAmountByTime" parameterType="integer" resultType="decimal">
-        select sum(IFNULL(pay_amt, 0)) pay_amt
-        from user_recharge
-        where order_status = #{chargeState}
-          and TO_DAYS(pay_time) = TO_DAYS(NOW())
-    </select>
+  <select id="queryDayFrist"  resultMap="BaseResultMap" parameterType="integer">
+    SELECT   <include refid="Base_Column_List"/>
+    FROM user_recharge WHERE TO_DAYS(add_time) = TO_DAYS(NOW())  AND  order_status = 1  GROUP BY  user_id AND agent_id = #{id}
+  </select>
 
-    <!--今日充值金额-->
-    <select id="CountTotalRechargeAmountByTime" parameterType="map" resultType="decimal">
-        select sum(IFNULL(pay_amt, 0)) pay_amt
-        from user_recharge
-        where order_status = #{chargeState}
-          and TO_DAYS(pay_time) = TO_DAYS(NOW())
-          and agent_id = #{agentId}
-    </select>
+  <!--累计充值金额-->
+  <select id="CountChargeSumAmt" resultType="decimal" parameterType="integer">
+    SELECT sum(pay_amt) FROM user_recharge WHERE order_status = #{chargeState}
+  </select>
+
+  <!--累计充值金额-->
+  <select id="agentCountChargeSumAmt" resultType="decimal" parameterType="map">
+    SELECT sum(pay_amt) FROM user_recharge WHERE order_status = #{chargeState} and  agent_id = #{agentId}
+  </select>
+
+  <!--今日充值金额-->
+  <select id="CountTotalRechargeAmountByTime" parameterType="integer" resultType="decimal">
+    select sum(IFNULL(pay_amt,0)) pay_amt from user_recharge where order_status = #{chargeState} and TO_DAYS(pay_time) = TO_DAYS(NOW())
+  </select>
+
+  <!--今日充值金额-->
+  <select id="CountTotalRechargeAmountByTime" parameterType="map" resultType="decimal">
+    select sum(IFNULL(pay_amt,0)) pay_amt from user_recharge where order_status = #{chargeState} and TO_DAYS(pay_time) = TO_DAYS(NOW()) and  agent_id = #{agentId}
+  </select>
 
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3