| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785 |
- <?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.arena.dao.AppUserMapper">
- <insert id="addOne" parameterType="com.ytpm.app.model.YtDyzUser">
- insert into yt_dyz_user
- (
- user_id,
- nick_name,
- head_img,
- registry_time,
- last_login_time,
- last_login_ip,
- login_days,
- total_video,
- total_income,
- red_packet_balance,
- red_packet_amount,
- points_balance,
- points_total,
- withdraw_total,
- sign_days,
- user_status,
- risk_reason,
- wx_open_id,
- ditch_id,
- platform_id,
- app_id,
- power,
- phone,
- phone_json,
- device_id
- )
- values
- (
- #{userId},
- #{nickName},
- #{headImg},
- #{registryTime},
- #{lastLoginTime},
- #{lastLoginIp},
- #{loginDays},
- #{totalVideo},
- #{totalIncome},
- #{redPacketBalance},
- #{redPacketAmount},
- #{pointsBalance},
- #{pointsTotal},
- #{withdrawTotal},
- #{signDays},
- #{userStatus},
- #{riskReason},
- #{wxOpenId},
- #{ditchId},
- #{platformId},
- #{appId},
- #{power},
- #{phone},
- #{phoneJson},
- #{deviceId}
- )
- </insert>
- <insert id="addPowerRecord">
- insert into yt_dyz_power_record
- (
- record_id, user_id, type, remark, add_time
- )
- values
- (
- #{recordId},#{userId},#{type},#{remark},#{addTime}
- )
- </insert>
- <insert id="saveAppConfig">
- insert into yt_app_default_config
- (
- config_name,
- open_id,
- secret,
- app_id,
- app_key,
- app_type,
- ditch_id
- )
- values
- (
- #{configName},
- #{openId},
- #{secret},
- #{appId},
- #{appKey},
- #{appType},
- #{ditchId}
- )
- </insert>
- <update id="updateAppConfig">
- update yt_app_default_config
- <set>
- <if test="canSimulator != null">
- can_simulator = #{canSimulator},
- </if>
- <if test="configName != null">
- config_name = #{configName},
- </if>
- <if test="openId != null">
- open_id = #{openId},
- </if>
- <if test="secret != null">
- secret = #{secret},
- </if>
- <if test="appKey != null">
- app_key = #{appKey},
- </if>
- <if test="appType != null">
- app_type = #{appType},
- </if>
- <if test="takuAppId != null">
- taku_app_id = #{takuAppId},
- </if>
- <if test="takuKey != null">
- taku_key = #{takuKey},
- </if>
- <if test="takuBannerPid != null">
- taku_banner_pid = #{takuBannerPid},
- </if>
- <if test="takuNativePid != null">
- taku_native_pid = #{takuNativePid},
- </if>
- <if test="takuRewardPid != null">
- taku_reward_pid = #{takuRewardPid},
- </if>
- <if test="takuInterstitialPid != null">
- taku_interstitial_pid = #{takuInterstitialPid},
- </if>
- <if test="canUseRoot != null">
- can_use_root = #{canUseRoot},
- </if>
- <if test="canUseAdb != null">
- can_use_adb = #{canUseAdb},
- </if>
- <if test="canUseFloat != null">
- can_use_float = #{canUseFloat},
- </if>
- <if test="canAccumulation != null">
- can_accumulation = #{canAccumulation},
- </if>
- <if test="ditchId != null">
- ditch_id = #{ditchId},
- </if>
- <if test="powerWaitTime != null">
- power_wait_time = #{powerWaitTime},
- </if>
- <if test="interstitialIntervalTime != null">
- interstitial_interval_time = #{interstitialIntervalTime}
- </if>
- <if test="flowIntervalTime != null">
- flow_interval_time = #{flowIntervalTime}
- </if>
- <if test="taskLimitTip != null">
- task_limit_tip = #{taskLimitTip}
- </if>
- <if test="lowValueTip != null">
- low_value_tip = #{lowValueTip}
- </if>
- <if test="brushTip != null">
- brush_tip = #{brushTip}
- </if>
- <if test="startWaitTime != null">
- start_wait_time = #{startWaitTime}
- </if>
- <if test="canCacheVideo != null">
- can_cache_video = #{canCacheVideo}
- </if>
- </set>
- where app_id = #{appId}
- </update>
- <update id="addOnePower">
- update yt_dyz_user set power = power+1 where user_id = #{userId}
- </update>
- <update id="subOnePower">
- update yt_dyz_user set power = power-1 where user_id = #{userId}
- </update>
- <update id="updateUser" parameterType="com.ytpm.app.model.YtDyzUser">
- update yt_dyz_user
- <set>
- <if test="nickName != null">
- nick_name = #{nickName},
- </if>
- <if test="phone != null">
- phone = #{phone},
- </if>
- <if test="deviceId != null">
- device_id = #{deviceId},
- </if>
- <if test="headImg != null">
- head_img = #{headImg},
- </if>
- <if test="power != null">
- power = #{power},
- </if>
- <if test="lastLoginTime != null">
- last_login_time = #{lastLoginTime},
- </if>
- <if test="lastLoginIp != null">
- last_login_ip = #{lastLoginIp},
- </if>
- <if test="loginDays != null">
- login_days = #{loginDays},
- </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="riskReason != null">
- risk_reason = #{riskReason},
- </if>
- <if test="wxOpenId != null">
- wx_open_id = #{wxOpenId},
- </if>
- <if test="phoneJson != null">
- phone_json = #{phoneJson},
- </if>
- <if test="platformId != null">
- platform_id = #{platformId}
- </if>
- </set>
- where user_id = #{userId}
- </update>
- <delete id="delByAppId">
- delete from yt_app_default_config where app_id = #{appId}
- </delete>
- <select id="getYtAppUser" resultType="com.ytpm.app.model.YtDyzUser">
- select
- user_id, app_id,phone,device_id, ditch_id, nick_name,head_img, power, registry_time, last_login_time, last_login_ip, login_days, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, risk_reason, wx_open_id, platform_id
- from yt_dyz_user
- where wx_open_id = #{openid}
- and ditch_id = #{ditchId}
- </select>
- <select id="queryAll" resultType="com.ytpm.app.view.YtAppUserListView">
- select
- user_id,app_id,phone,device_id, ditch_id, nick_name,head_img, power, registry_time, last_login_time, last_login_ip, login_days, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, risk_reason, wx_open_id, platform_id
- from yt_dyz_user
- where 1 = 1
- <if test="userId != null and userId !=''">
- and user_id = #{userId}
- </if>
- <if test="nickName != null and nickName !=''">
- and nick_name like concat('%',#{nickName},'%')
- </if>
- <if test="ditchId != null">
- and ditch_id = #{ditchId}
- </if>
- <if test="userStatus != null">
- and user_status = #{userStatus}
- </if>
- <if test="registryTimeBegin != null">
- and DATE_FORMAT(registry_time, '%Y-%m-%d') <![CDATA[>=]]> DATE_FORMAT(#{registryTimeBegin}, '%Y-%m-%d')
- </if>
- <if test="registryTimeEnd != null">
- and DATE_FORMAT(registry_time, '%Y-%m-%d') <![CDATA[<=]]> DATE_FORMAT(#{registryTimeEnd}, '%Y-%m-%d')
- </if>
- <if test="lastLoginTimeBegin != null">
- and DATE_FORMAT(last_login_time, '%Y-%m-%d') <![CDATA[>=]]> DATE_FORMAT(#{lastLoginTimeBegin}, '%Y-%m-%d')
- </if>
- <if test="lastLoginTimeEnd != null">
- and DATE_FORMAT(last_login_time, '%Y-%m-%d') <![CDATA[<=]]> DATE_FORMAT(#{lastLoginTimeEnd}, '%Y-%m-%d')
- </if>
- <if test="appIds != null and appIds != ''">
- and app_id in
- <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
- #{item}
- </foreach>
- </if>
- order by user_id desc
- </select>
- <select id="selectPrimaryKey" resultType="com.ytpm.app.model.YtDyzUser">
- select
- user_id,app_id,phone,device_id, ditch_id, head_img, nick_name, registry_time, last_login_time, last_login_ip, login_days, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, risk_reason, wx_open_id, platform_id, power
- from yt_dyz_user
- where user_id = #{userId}
- </select>
- <resultMap id="UserMap" type="com.ytpm.app.model.YtDyzUser">
- <id column="user_id" property="userId" />
- <result column="head_img" property="headImg" />
- <result column="nick_name" property="nickName" />
- <result column="phone" property="phone" />
- <result column="device_id" property="deviceId" />
- <result column="registry_time" property="registryTime" />
- <result column="last_login_time" property="lastLoginTime" />
- <result column="last_login_ip" property="lastLoginIp" />
- <result column="login_days" property="loginDays" />
- <result column="total_video" property="totalVideo" />
- <result column="total_income" property="totalIncome" />
- <result column="red_packet_balance" property="redPacketBalance" />
- <result column="red_packet_amount" property="redPacketAmount" />
- <result column="points_balance" property="pointsBalance" />
- <result column="points_total" property="pointsTotal" />
- <result column="withdraw_total" property="withdrawTotal" />
- <result column="sign_days" property="signDays" />
- <result column="user_status" property="userStatus" />
- <result column="risk_reason" property="riskReason" />
- <result column="wx_open_id" property="wxOpenId" />
- <result column="ditch_id" property="ditchId" />
- <result column="app_id" property="appId" />
- <result column="platform_id" property="platformId" />
- <result column="power" property="power" />
- <collection property="loginRecordList" ofType="com.ytpm.app.model.YtDyzLoginRecord">
- <result column="record_id" property="recordId" />
- <result column="user_id" property="userId" />
- <result column="login_time" property="loginTime" />
- <result column="device_brand" property="deviceBrand" />
- <result column="device_model" property="deviceModel" />
- <result column="login_ip" property="loginIp" />
- <result column="operator" property="operator" />
- <result column="ip_addr" property="ipAddr" />
- </collection>
- </resultMap>
- <select id="getUserList" resultMap="UserMap">
- select
- du.user_id,
- du.head_img,
- du.nick_name,
- du.phone,
- du.device_id,
- du.registry_time,
- du.last_login_time,
- du.last_login_ip,
- du.login_days,
- du.total_video,
- du.total_income,
- du.red_packet_balance,
- du.red_packet_amount,
- du.points_balance,
- du.points_total,
- du.withdraw_total,
- du.sign_days,
- du.user_status,
- du.risk_reason,
- du.wx_open_id,
- du.ditch_id,
- du.app_id,
- du.platform_id,
- du.power,
- lr.record_id,
- lr.login_time,
- lr.device_brand,
- lr. device_model,
- lr.login_ip,
- lr.operator,
- lr.ip_addr
- from yt_dyz_user du
- left join yt_dyz_login_record lr on du.user_id = lr.user_id
- <where>
- <if test="userIds != null and userIds != ''">
- and du.user_id in
- <foreach collection="userIds.split(',')" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="loginTimeBegin != null">
- and du.last_login_time <![CDATA[>=]]> #{loginTimeBegin}
- </if>
- <if test="loginTimeEnd != null">
- and du.last_login_time <![CDATA[<=]]> #{loginTimeEnd}
- </if>
- </where>
- group by du.user_id
- </select>
- <select id="queryAllByTime" resultType="com.ytpm.app.model.YtDyzUser">
- SELECT
- user_id,app_id,phone,device_id, nick_name, head_img, power, registry_time,
- last_login_time, last_login_ip, login_days, total_video,
- total_income, red_packet_balance, red_packet_amount,
- points_balance, points_total, withdraw_total, sign_days,
- user_status, risk_reason, wx_open_id, platform_id
- FROM yt_dyz_user
- <where>
- <if test="startTime != null">
- AND registry_time >= #{startTime}
- </if>
- <if test="endTime != null">
- AND registry_time <= #{endTime}
- </if>
- <choose>
- <when test="appIdList == null or appIdList.isEmpty()">
- AND 1 = 0
- </when>
- <otherwise>
- AND app_id IN
- <foreach collection="appIdList" item="item"
- open="(" close=")" separator=",">
- #{item}
- </foreach>
- </otherwise>
- </choose>
- </where>
- ORDER BY registry_time DESC
- </select>
- <select id="countUsersByHour" resultType="com.ytpm.app.view.HourCountView">
- SELECT HOUR(registry_time) AS hour, COUNT(*) AS count
- FROM yt_dyz_user
- WHERE registry_time BETWEEN #{startTime} AND #{endTime}
- <choose>
- <when test="appIdList == null or appIdList.isEmpty()">
- AND 1 = 0
- </when>
- <otherwise>
- AND app_id IN
- <foreach collection="appIdList" item="item"
- open="(" close=")" separator=",">
- #{item}
- </foreach>
- </otherwise>
- </choose>
- GROUP BY HOUR(registry_time)
- </select>
- <select id="queryTodayBanned" resultType="com.ytpm.app.model.YtDyzUser">
- select user_id from yt_dyz_user
- where registry_time BETWEEN #{startTime} AND #{endTime}
- and user_id in
- <foreach collection="userIdList" item="item"
- open="(" close=")" separator=",">
- #{item}
- </foreach>
- </select>
- <select id="getDefaultConfig" resultType="com.ytpm.app.view.WxDefaultConfig">
- select
- config_id, config_name, open_id as app_id, secret, app_id as platformAppId, app_key as platformAppSecret,
- app_type,user_path, login_path,ad_path,answer_path,power_path,can_simulator,
- taku_app_id, taku_key, taku_banner_pid, taku_native_pid, taku_reward_pid, taku_interstitial_pid,
- can_use_root, can_use_adb, can_use_float, can_accumulation,
- ditch_id, power_wait_time, interstitial_interval_time,
- low_value_tip, brush_tip,flow_interval_time,task_limit_tip,start_wait_time,can_cache_video
- from yt_app_default_config
- where app_type = #{appType}
- </select>
- <select id="getDefaultConfigByAppId" resultType="com.ytpm.app.view.WxDefaultConfig">
- select
- config_id, config_name, open_id, secret, app_id, app_key, app_type,user_path,login_path,ad_path,
- answer_path,power_path,can_simulator, taku_app_id, taku_key, taku_banner_pid, taku_native_pid,
- taku_reward_pid, taku_interstitial_pid, can_use_root, can_use_adb, can_use_float, can_accumulation,
- ditch_id, power_wait_time, interstitial_interval_time,
- low_value_tip, brush_tip,flow_interval_time,task_limit_tip,start_wait_time,can_cache_video
- from yt_app_default_config
- where app_id = #{appId}
- </select>
- <select id="getSecretByAppId" resultType="java.lang.String">
- select
- config_id, config_name, open_id, secret, app_id, app_key, app_type,user_path,login_path,ad_path,
- answer_path,power_path,can_simulator, taku_app_id, taku_key, taku_banner_pid, taku_native_pid,
- taku_reward_pid, taku_interstitial_pid, can_use_root, can_use_adb, can_use_float, can_accumulation,
- ditch_id, power_wait_time, interstitial_interval_time,
- low_value_tip, brush_tip, flow_interval_time,task_limit_tip,start_wait_time,can_cache_video
- from yt_app_default_config
- where app_id = #{appId}
- </select>
- <select id="queryByOpenid" resultType="com.ytpm.app.model.YtDyzUser">
- select
- user_id,phone,device_id, head_img, nick_name, registry_time, last_login_time, last_login_ip, login_days, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, risk_reason, wx_open_id, ditch_id, app_id, platform_id, power
- from yt_dyz_user
- where wx_open_id = #{openid}
- </select>
- <select id="getByDeviceId" resultType="java.lang.String">
- select
- platform_id
- from yt_dyz_user
- where device_id = #{deviceId}
- and wx_open_id = #{openid}
- limit 1
- </select>
- <select id="getConfigByIds" resultType="com.ytpm.app.view.WxDefaultConfig">
- select
- config_id, config_name, open_id, secret, app_id, app_key, app_type, user_path, login_path, ad_path,
- answer_path, power_path,taku_app_id, taku_key, taku_banner_pid, taku_native_pid, taku_reward_pid,
- taku_interstitial_pid, can_use_root, can_use_adb, can_use_float, can_accumulation,can_simulator,
- ditch_id, power_wait_time, interstitial_interval_time,
- low_value_tip, brush_tip, flow_interval_time,task_limit_tip,start_wait_time,can_cache_video
- from yt_app_default_config
- where app_id in
- <foreach collection="appIds.split(',')" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </select>
- <select id="getAdCount" resultType="java.lang.Integer">
- select
- sum(total_video)
- from yt_dyz_user
- where app_id in
- <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
- #{item}
- </foreach>
- </select>
- <select id="getRevenueCount" resultType="java.math.BigDecimal">
- select
- sum(total_income)
- from yt_dyz_user
- where app_id in
- <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
- #{item}
- </foreach>
- </select>
- <select id="getAppRanking" resultType="com.ytpm.middle.view.AppRankingListVO">
- SELECT
- u.app_id,
- sum( ar.revenue ) totalRevenue
- FROM
- yt_dyz_ad_record ar
- JOIN yt_dyz_user u ON ar.user_id = u.user_id
- <where>
- <if test="sortBy != null">
- <choose>
- <when test="sortBy == 1">
- DATE_FORMAT( ar.finish_time, '%Y-%m-%d' ) = CURRENT_DATE()
- </when>
- <when test=" sortBy == 2">
- YEARWEEK( ar.finish_time, 1 ) = YEARWEEK(now(),1)
- </when>
- <otherwise>
- DATE_FORMAT( ar.finish_time, '%Y-%m' ) = DATE_FORMAT(NOW(), '%Y-%m')
- </otherwise>
- </choose>
- </if>
- </where>
- GROUP BY
- u.app_id
- ORDER BY
- sum( ar.revenue ) DESC
- LIMIT #{limit}
- </select>
- <select id="getUserRanking" resultType="com.ytpm.middle.view.UserRankingListVO">
- SELECT
- u.user_id,
- u.nick_name,
- u.head_img,
- u.total_video,
- sum( ar.revenue ) totalIncome
- FROM
- yt_dyz_ad_record ar
- JOIN yt_dyz_user u ON ar.user_id = u.user_id
- <where>
- <if test="sortBy != null">
- <choose>
- <when test="sortBy == 1">
- DATE_FORMAT( ar.finish_time, '%Y-%m-%d' ) = CURRENT_DATE()
- </when>
- <when test=" sortBy == 2">
- YEARWEEK( ar.finish_time, 1 ) = YEARWEEK(now(),1)
- </when>
- <otherwise>
- DATE_FORMAT( ar.finish_time, '%Y-%m' ) = DATE_FORMAT(NOW(), '%Y-%m')
- </otherwise>
- </choose>
- </if>
- </where>
- GROUP BY ar.user_id
- ORDER BY
- sum( ar.revenue ) DESC
- limit #{limit}
- </select>
- <select id="countUserByAppIds" resultType="java.lang.Integer">
- select
- count(user_id)
- from yt_dyz_user
- where app_id in
- <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
- #{item}
- </foreach>
- </select>
- <select id="countRevenueByAppIds" resultType="java.math.BigDecimal">
- select
- sum(total_income)
- from yt_dyz_user
- where app_id in
- <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
- #{item}
- </foreach>
- </select>
- <select id="countBannedByAppIds" resultType="java.lang.Integer">
- select
- count(user_id)
- from yt_dyz_user
- where user_status > 1 and app_id in
- <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
- #{item}
- </foreach>
- </select>
- <select id="countRegistryUser" resultType="java.lang.Integer">
- select
- count(user_id)
- from yt_dyz_user
- where app_id = #{appId}
- <if test="type != null and type ==1">
- and DATE(registry_time) = DATE(now())
- </if>
- <if test="type != null and type ==2">
- and DATE(registry_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
- </if>
- <if test="type != null and type ==3">
- and DATE_FORMAT(registry_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
- </if>
- </select>
- <select id="countLoginUser" resultType="java.lang.Integer">
- select
- count(user_id)
- from yt_dyz_user
- where app_id = #{appId}
- <if test="type != null and type ==1">
- and DATE(last_login_time) = DATE(now())
- </if>
- <if test="type != null and type ==2">
- and DATE(last_login_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
- </if>
- <if test="type != null and type ==3">
- and DATE_FORMAT(last_login_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
- </if>
- </select>
- <select id="countRegistryHour" resultType="com.ytpm.middle.view.AppUserHourVO">
- select
- DATE_FORMAT(registry_time,'%Y-%m-%d %H:00:00') as `time`,
- count(user_id) `count`
- from yt_dyz_user
- where app_id = #{appId}
- <if test="type != null and type ==1">
- and DATE(registry_time) = DATE(now())
- </if>
- <if test="type != null and type ==2">
- and DATE(registry_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
- </if>
- <if test="type != null and type ==3">
- and DATE_FORMAT(registry_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
- </if>
- group by `time`
- </select>
- <select id="countLoginHour" resultType="com.ytpm.middle.view.AppUserHourVO">
- select
- DATE_FORMAT(last_login_time,'%Y-%m-%d %H:00:00') as `time`,
- count(user_id) `count`
- from yt_dyz_user
- where app_id = #{appId}
- <if test="type != null and type ==1">
- and DATE(last_login_time) = DATE(now())
- </if>
- <if test="type != null and type ==2">
- and DATE(last_login_time) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
- </if>
- <if test="type != null and type ==3">
- and DATE_FORMAT(last_login_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
- </if>
- group by `time`
- </select>
- <select id="queryByUserIds" resultType="com.ytpm.app.model.YtDyzUser">
- select
- user_id, head_img, nick_name, registry_time, last_login_time, last_login_ip, login_days, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, risk_reason, wx_open_id, ditch_id, app_id, platform_id, power, phone, device_id
- from yt_dyz_user
- where user_id in
- <foreach collection="userIds.split(',')" separator="," item="item" open="(" close=")">
- #{item}
- </foreach>
- </select>
- <resultMap id="UserAdMap" type="com.ytpm.agent.view.AgentAuditCheckVO">
- <id column="user_id" property="userId" />
- <result column="app_id" property="appId" />
- <result column="nick_name" property="nickName" />
- <collection property="adRecordList" ofType="com.ytpm.app.model.YtDyzAdRecord">
- <result column="record_id" property="recordId" />
- <result column="placement_id" property="placementId" />
- <result column="ad_source_id" property="adSourceId" />
- <result column="ad_source_type" property="adSourceType" />
- <result column="ad_source_index" property="adSourceIndex" />
- <result column="revenue" property="revenue" />
- <result column="ecpm" property="ecpm" />
- <result column="network_form_id" property="networkFormId" />
- <result column="network_name" property="networkName" />
- <result column="network_placement_id" property="networkPlacementId" />
- <result column="finish_time" property="finishTime" />
- <result column="begin_time" property="beginTime" />
- </collection>
- </resultMap>
- <select id="queryTodayUserAd" resultMap="UserAdMap">
- select
- u.user_id,
- u.app_id,
- u.nick_name,
- ar.record_id,
- ar.placement_id,
- ar.ad_source_id,
- ar.ad_source_type,
- ar.ad_source_index,
- ar.revenue,
- ar.ecpm,
- ar.network_form_id,
- ar.network_name,
- ar.network_placement_id,
- ar.finish_time,
- ar.begin_time
- from yt_dyz_ad_record ar
- join yt_dyz_user u on ar.user_id = u.user_id
- where ar.ad_source_type = #{adSourceType} and ar.app_id = #{appId} and ar.user_id in
- <foreach collection="userIds.split(',')" separator="," item="item" open="(" close=")">
- #{item}
- </foreach>
- and DATE_FORMAT(ar.finish_time, '%Y-%m-%d') = current_date()
- </select>
- <select id="getMonthRegistryUser" resultType="com.ytpm.app.model.YtDyzUser">
- select
- user_id, head_img, nick_name, registry_time, last_login_time, last_login_ip, login_days, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, risk_reason, wx_open_id, ditch_id, app_id, platform_id, power, phone, device_id
- from yt_dyz_user
- where app_id in
- <foreach collection="appIds.split(',')" separator="," item="item" open="(" close=")">
- #{item}
- </foreach>
- <if test="type != null and type == 1">
- and DATE_FORMAT(registry_time, '%Y-%m') = DATE_FORMAT(now(),'%Y-%m')
- </if>
- <if test="type != null and type == 2">
- and DATE_FORMAT(last_login_time, '%Y-%m') = DATE_FORMAT(now(),'%Y-%m')
- </if>
- </select>
- <select id="countDitch" resultType="java.lang.Integer">
- select
- count( distinct ditch_id)
- from yt_dyz_user
- where device_id = #{deviceId}
- and registry_time > (NOW() - INTERVAL #{hours} HOUR )
- </select>
- <select id="countLoginDitch" resultType="java.lang.Integer">
- select
- count( distinct ditch_id)
- from yt_dyz_user
- where device_id = #{deviceId}
- and last_login_time > (NOW() - INTERVAL #{hours} HOUR )
- </select>
- <select id="getLastRegistryUser" resultType="com.ytpm.app.model.YtDyzUser">
- select
- user_id, head_img, nick_name, registry_time, last_login_time, last_login_ip, login_days, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, risk_reason, wx_open_id, ditch_id, app_id, platform_id, power, phone, device_id, phone_json
- from yt_dyz_user
- where device_id = #{deviceId}
- </select>
- <select id="getByDeviceAndDitch" resultType="com.ytpm.app.model.YtDyzUser">
- select
- user_id, head_img, nick_name, registry_time, last_login_time, last_login_ip, login_days, total_video, total_income, red_packet_balance, red_packet_amount, points_balance, points_total, withdraw_total, sign_days, user_status, risk_reason, wx_open_id, ditch_id, app_id, platform_id, power, phone, device_id, phone_json
- from yt_dyz_user
- where device_id = #{deviceId} and ditch_id = #{ditchId} limit 1
- </select>
- <select id="getPlatformByDeviceId" resultType="java.lang.String">
- select
- platform_id
- from yt_dyz_user
- where device_id = #{deviceId}
- limit 1
- </select>
- <update id="unlockUser">
- update yt_dyz_user
- set user_status = 1
- where user_status > 1
- and user_id in
- <foreach collection="userIds.split(',')" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </update>
- </mapper>
|