1
zj
2024-06-03 09206aedcfdf30050123e99f2af0a192ebad1de4
src/main/resources/mapper/UserRechargeMapper.xml
@@ -15,25 +15,13 @@
        <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"/>
      <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,pay_type,user_phone,channel_name,assets_type,wallet_address,
        pay_name,bank_num,route_num,pay_phone,pay_mail
    order_desc, add_time, pay_time, pay_id,img
    </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=",">
@@ -76,39 +64,6 @@
            <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">
@@ -150,40 +105,6 @@
            <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">
@@ -222,42 +143,6 @@
            <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>
@@ -278,9 +163,11 @@
    </update>
    <select id="checkInMoney" resultType="integer" parameterType="map">
        SELECT COUNT(*)
        FROM user_recharge
    SELECT COUNT(*) FROM user_recharge
        WHERE user_id = #{userId}
          and order_status = #{status}
          and add_time > date_sub(now(), interval 1 hour)
@@ -312,12 +199,13 @@
    </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
    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
        left join site_pay p
    join site_pay p
        on s.pay_id = p.id
        where agent_id != 1
        <if test="agentId != null">
@@ -350,9 +238,7 @@
    <delete id="deleteByUserId" parameterType="integer">
        DELETE
        FROM user_recharge
        WHERE user_id = #{userId}
    DELETE FROM user_recharge WHERE user_id = #{userId}
    </delete>
@@ -376,49 +262,34 @@
    </select>
    <select id="queryDayFrist" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
    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="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   <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="CountChargeSumAmt" resultType="decimal" parameterType="integer">
        SELECT sum(pay_amt)
        FROM user_recharge
        WHERE order_status = #{chargeState}
    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 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 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 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>