| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004 |
- <?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.lemonios.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,
- ios_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},
- #{iosId},
- #{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>
- </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="iosId != null">
- ios_id = #{iosId},
- </if>
- <if test="appId != null">
- app_id = #{appId},
- </if>
- <if test="ditchId != null">
- ditch_id = #{ditchId},
- </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, ios_id, platform_id
- from yt_dyz_user
- where wx_open_id = #{openid}
- and ditch_id = #{ditchId}
- </select>
- <select id="selectById" 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, ios_id, platform_id
- from yt_dyz_user
- where user_id = #{userId}
- </select>
- <select id="selectByIosId" 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, ios_id, platform_id
- from yt_dyz_user
- where ios_id = #{iosId}
- Limit 1
- </select>
- <select id="getYtAppUserForIos" 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, ios_id, platform_id
- from yt_dyz_user
- where ios_id = #{iosId}
- 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, ios_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, 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, ios_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="ios_id" property="iosId" />
- <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, ios_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="getConfigByAppId" resultType="com.ytpm.app.model.YtAppDefaultConfig">
- 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,
- can_allow_auto_refresh
- from yt_app_default_config
- where app_id = #{appId}
- </select>
- <select id="getByAppId" 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,
- can_allow_auto_refresh
- from yt_app_default_config
- where app_id = #{appId}
- </select>
- <select id="getDefaultConfig" 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,
- can_allow_auto_refresh
- from yt_app_default_config
- where app_type = #{appType}
- </select>
- <select id="getDefaultConfigByDitchId" 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,
- can_allow_auto_refresh
- from yt_app_default_config
- where ditch_id = #{ditchId}
- </select>
- <select id="getLastOne" 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,
- can_allow_auto_refresh
- from yt_app_default_config
- where app_id = #{appId}
- limit 1
- </select>
- <select id="getLastDefaultConfig" 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,
- can_allow_auto_refresh
- FROM yt_app_default_config
- ORDER BY config_id DESC
- LIMIT 1
- </select>
- <select id="getSecretByAppId" resultType="java.lang.String">
- select
- secret
- 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="queryByIosId" 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 ios_id = #{iosId}
- </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,
- can_allow_auto_refresh
- 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>
- <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>
|