| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- <?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.ytpm.dao.RiskUserMapper">
- <insert id="addBannedRecord">
- insert yt_platform_banned
- (
- banned_id,
- user_id,
- app_id,
- agent_id,
- channel_id,
- banned_time,
- banned_reason,
- banned_type,
- banned_limit,
- operator,
- operator_name,
- risk_code
- )
- values
- (
- #{bannedId},
- #{userId},
- #{appId},
- #{agentId},
- #{channelId},
- #{bannedTime},
- #{bannedReason},
- #{bannedType},
- #{bannedLimit},
- #{operator},
- #{operatorName},
- #{riskCode}
- )
- </insert>
- <update id="updateByUserId">
- update yt_app_user
- <set>
- <if test="appId !=null and appId!=''">
- app_id = {appId},
- </if>
- <if test="nickName !=null and nickName!=''">
- nick_name = #{nickName},
- </if>
- <if test="registryTime !=null">
- registry_time = #{registryTime},
- </if>
- <if test="lastLoginTime !=null">
- last_login_time = #{lastLoginTime},
- </if>
- <if test="lastLoginIp !=null and lastLoginIp!=''">
- last_login_ip = #{lastLoginIp},
- </if>
- <if test="loginDays !=null">
- login_days = #{loginDays},
- </if>
- <if test="channelType !=null">
- channel_type = #{channelType},
- </if>
- <if test="channelOrigin !=null">
- channel_origin = #{channelOrigin},
- </if>
- <if test="userType !=null">
- user_type = #{userType},
- </if>
- <if test="totalVideo !=null">
- total_video = #{totalVideo},
- </if>
- <if test="totalIncome !=null">
- total_income = #{totalIncome},
- </if>
- <if test="redPacketBalance !=null">
- red_packet_balance = #{redPacketBalance},
- </if>
- <if test="redPacketAmount !=null">
- red_packet_amount = #{redPacketAmount},
- </if>
- <if test="pointsBalance !=null">
- points_balance = #{pointsBalance},
- </if>
- <if test="pointsTotal !=null">
- points_total = #{pointsTotal},
- </if>
- <if test="withdrawTotal !=null">
- withdraw_total = #{withdrawTotal},
- </if>
- <if test="signDays !=null">
- sign_days = #{signDays},
- </if>
- <if test="userStatus !=null">
- user_status = #{userStatus},
- </if>
- <if test="lockReason !=null">
- lock_reason = #{lockReason},
- </if>
- </set>
- where user_id = #{userId}
- </update>
- <update id="banned">
- update yt_app_user set user_status = 3
- where user_id in
- <foreach collection="userIdList" separator="," item="item" index="index" open="(" close=")">
- #{item}
- </foreach>
- </update>
- <update id="unBanned">
- update yt_app_user set user_status = 1
- where user_id in
- <foreach collection="userIdList" separator="," item="item" index="index" open="(" close=")">
- #{item}
- </foreach>
- </update>
- <select id="selectByUserId" resultType="com.ytpm.agent.model.YtAppUser">
- select
- user_id, app_id, channel_id, platform_id, nick_name,lock_reason, registry_time, last_login_time, last_login_ip, login_days, channel_type, channel_origin, user_type, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status
- from yt_app_user
- where user_id = #{userId}
- </select>
- <select id="getBannedUserList" resultType="com.ytpm.agent.model.YtAppUser">
- select
- user_id, app_id, channel_id, platform_id, nick_name, registry_time, last_login_time, last_login_ip, login_days, channel_type, channel_origin, user_type, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, wx_open_id, platform_id, channel_id
- from yt_app_user
- where user_id = #{userId}
- <if test="bannedTargetId != null and bannedTargetId != ''">
- <choose>
- <when test="bannedType == 1 ">
- and channel_id = #{bannedTargetId}
- </when>
- <otherwise>
- and platform_id = #{bannedTargetId}
- </otherwise>
- </choose>
- </if>
- </select>
- <select id="selectByWx" resultType="com.ytpm.agent.model.YtAppUser">
- select user_id, app_id, nick_name, registry_time, last_login_time, last_login_ip, login_days, channel_type, channel_origin, user_type, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, lock_reason, wx_open_id, platform_id, channel_id from yt_app_user where wx_open_id = #{openid}
- </select>
- <select id="selectByAppId" resultType="com.ytpm.risk.view.RiskAccessView">
- select
- a.app_id,
- a.app_name,
- pua.access_id,
- pua.access_secret,
- pua.user_id
- from yt_app a
- join yt_platform_user_access pua on a.user_id = pua.user_id and pua.enabled = 1
- where a.app_id = #{appId}
- </select>
- <select id="getTimedUser" resultType="java.lang.String">
- SELECT
- user_id
- FROM
- yt_platform_banned
- GROUP BY
- user_id
- HAVING
- TIMESTAMPDIFF(
- HOUR,
- max( banned_time ),
- NOW()) > 24
- </select>
- </mapper>
|