xiaoyong931011
2023-10-25 b3c8303ecd936182e2df4933dbf1ad167b81266e
src/main/resources/mapper/modules/ChatUserMapper.xml
@@ -35,6 +35,36 @@
        order by a.create_time desc
    </select>
    <select id="selectUserPerkListInPage" resultType="cc.mrbird.febs.mall.vo.AdminChatUserPerkVo">
        select
        a.user_id userId,
        a.nick_name nickName,
        a.chat_no chatNo,
        a.phone phone,
        a.invite_id inviteId,
        a.is_robot isRobot,
        date_format(a.create_time, '%Y-%m-%d %H:%m:%s') createTime,
        IFNULL(sum(b.total_amount), 0) totalAmount,
        IFNULL(sum(b.ava_amount), 0) avaAmount
        from chat_user a
        left join chat_wallet b on b.user_id = a.user_id and type = 'USDT'
        <where>
            <if test="record != null">
                <if test="record.nickName != null and record.nickName != ''">
                    and a.nick_name like CONCAT('%', CONCAT(#{record.nickName}, '%'))
                </if>
                <if test="record.inviteId != null and record.inviteId != ''">
                    and a.invite_id = #{record.inviteId}
                </if>
                <if test="record.status != null and record.status != ''">
                    and a.status = #{record.status}
                </if>
            </if>
        </where>
        group by a.user_id
        order by a.create_time desc
    </select>
    <select id="selectByUserId" resultType="cc.mrbird.febs.mall.entity.ChatUser">
        select
        a.*
@@ -317,5 +347,33 @@
        </if>
    </select>
    <select id="selectListByMsgType" resultType="cc.mrbird.febs.mall.vo.AdminChatRedBagVo">
        select
               a.*
        from chat_red_bag a
        where a.msg_type = #{msgType}
        <if test='date != "" and date != null'>
            and date_format(a.create_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
        </if>
        and a.from_user_id = #{userId}
    </select>
    <select id="selectByOverDueStatueAndTime" resultType="cc.mrbird.febs.mall.vo.AdminChatRedBagVo">
        select *
        from chat_red_bag
        where overdue_state = #{overdueState}
          and #{overdueTime} > overdue_time
        order by id asc
            limit 500
    </select>
    <update id="updateOverdueStatusById">
        update chat_red_bag
        set
            overdue_state = #{overdueState}
        where id = #{id}
    </update>
</mapper>