| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- <?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.zanxiang.game.data.serve.dao.mapper.PromoteAgentStatDayMapper">
- <select id="getDayDate" resultType="com.zanxiang.game.data.serve.pojo.vo.GamePromoteVO">
- select
- concat(toString(stat_day),toString(agent_id)) as id,
- agent_id as agentId,
- promote_account_name as accountName,
- promote_account_id as accountId,
- put_agent as putAgent,
- promote_status as promoteStatus,
- sys_user_name as sysUserName,
- cp_id as cpId,
- cp_name as cpName,
- game_id as gameId,
- game_name as gameName,
- game_type as gameType,
- stat_day as costDay,
- sys_user_id as sysUserId,
- cost_today as cost,
- ad_count_today as adCount,
- ad_plan_count_today as adPlanCount,
- cost_back_today as costBack,
- cost_real_today as costReal,
- view_count_today as viewCount,
- click_count_today as clickCount,
- convert_count_today as convertCount,
- if(clickCount == 0,0,floor(convertCount/clickCount, 4)) as convertRate,
- if(convertCount == 0,0,floor(toFloat64(costReal)/convertCount, 4)) as avgConvertCost,
- deep_convert_count_today as deepConvertCount,
- if(deepConvertCount == 0,0,floor(toFloat64(costReal)/deepConvertCount, 4)) as deepConvertCost,
- if(convertCount == 0,0,floor(deepConvertCount/convertCount, 4)) as deepConvertRate,
- if(viewCount == 0,0,floor(toFloat64(costReal)/viewCount, 4)*1000) as thousandViewCost,
- if(viewCount == 0,0,floor(clickCount/viewCount, 4)) as clickRate,
- if(clickCount == 0,0,floor(toFloat64(costReal)/clickCount, 4)) as avgClickCost,
- app_download_count_today as appDownloadCount,
- if(appDownloadCount == 0,0,floor(toFloat64(costReal)/appDownloadCount, 4)) as appDownloadCost,
- if(clickCount == 0,0,floor(appDownloadCount/clickCount, 4)) as appDownloadRate,
- download_finish_today as downloadFinish,
- app_install_count_today as appInstallCount,
- if(appInstallCount == 0,0,floor(toFloat64(costReal)/appInstallCount, 4)) as appInstallCost,
- if(downloadFinish == 0,0,floor(appInstallCount/downloadFinish, 4)) as appInstallRate,
- if(downloadFinish == 0,0,floor(toFloat64(costReal)/downloadFinish, 4)) as downloadFinishCost,
- if(appDownloadCount == 0,0,floor(downloadFinish/appDownloadCount, 4)) as downloadFinishRate,
- app_active_count_today as appActiveCount,
- if(appActiveCount == 0,0,floor(toFloat64(costReal)/appActiveCount, 4)) as appActiveCost,
- if(clickCount == 0,0,floor(appActiveCount/clickCount, 4)) as appActiveRate,
- reg_user_count_today as regUserCount,
- active_user_count_today as activeUserCount,
- user_count_of_create_role_today as userCountOfCreateRole,
- first_user_count_of_first_create_role_today as firstUserCountOfFirstCreateRole,
- create_role_count_today as createRoleCount,
- first_create_role_count_today as firstCreateRoleCount,
- role_count_of_first_user_today as roleCountOfFirstUser,
- if(regUserCount == 0,0,floor(toFloat64(costReal)/regUserCount, 4)) as regCost,
- if(firstCreateRoleCount == 0,0,floor(toFloat64(costReal)/firstCreateRoleCount, 4)) as firstCreateRoleCost,
- if(roleCountOfFirstUser == 0,0,floor(toFloat64(costReal)/roleCountOfFirstUser, 4)) as firstUserCreateRoleCost,
- if(regUserCount == 0,0,floor(roleCountOfFirstUser/regUserCount, 4)) as firstCreateRoleRate,
- <!-- todayActiveUserLTV,-->
- <!-- todayAdCashROI,-->
- first_user_recharge_count_today as firstUserRechargeCount,
- first_user_recharge_user_today as firstUserRechargeUser,
- first_user_recharge_money_today as firstUserRechargeMoney,
- old_user_recharge_count_today as oldUserRechargeCount,
- old_user_recharge_user_today as oldUserRechargeUser,
- old_user_recharge_money_today as oldUserRechargeMoney,
- show_recharge_count_today as showRechargeCount,
- show_recharge_user_today as showRechargeUser,
- show_recharge_money_today as showRechargeMoney,
- new_user_recharge_count_today as newUserRechargeCount,
- new_user_recharge_user_today as newUserRechargeUser,
- new_user_recharge_money_today as newUserRechargeMoney,
- if(costReal == 0,0,floor(toFloat64(firstUserRechargeMoney)/toFloat64(costReal), 4)) as firstRecoveryRate,
- if(costReal == 0,0,floor(toFloat64(newUserRechargeMoney)/toFloat64(costReal), 4)) as buyRecoveryRate,
- newUserRechargeMoney-costReal as grossMargin,
- if(costReal == 0,0,floor(toFloat64(new_user_recharge_money_day3)/toFloat64(costReal), 4)) as threeDayROI,
- if(costReal == 0,0,floor(toFloat64(new_user_recharge_money_day5)/toFloat64(costReal), 4)) as fiveDayROI,
- if(costReal == 0,0,floor(toFloat64(new_user_recharge_money_day7)/toFloat64(costReal), 4)) as sevenDayROI,
- if(costReal == 0,0,floor(toFloat64(new_user_recharge_money_day15)/toFloat64(costReal), 4)) as fifteenDayROI,
- if(costReal == 0,0,floor(toFloat64(new_user_recharge_money_day30)/toFloat64(costReal), 4)) as thirtyDayROI,
- if(costReal == 0,0,floor(toFloat64(new_user_recharge_money_day60)/toFloat64(costReal), 4)) as sixtyDayROI,
- if(costReal == 0,0,floor(toFloat64(new_user_recharge_money_day180)/toFloat64(costReal), 4)) as oneHundredAndEightyDayROI,
- if(costReal == 0,0,floor(toFloat64(new_user_recharge_money_day365)/toFloat64(costReal), 4)) as oneYearROI,
- if(regUserCount == 0,0,floor(firstUserRechargeUser/regUserCount, 4)) as firstRechargeRate,
- if(regUserCount == 0,0,floor(newUserRechargeUser/regUserCount, 4)) as buyUserRechargeRate,
- if(showRechargeUser == 0,0,floor(firstUserRechargeUser/showRechargeUser, 4)) as newUserRechargeRate,
- if(activeUserCount == 0,0,floor(firstUserRechargeUser/activeUserCount, 4)) as activeUserRechargeRate,
- if(firstUserRechargeCount == 0,0,floor(toFloat64(firstUserRechargeMoney)/firstUserRechargeCount, 4)) as avgFirstUserRecharge,
- if(newUserRechargeCount == 0,0,floor(toFloat64(newUserRechargeMoney)/newUserRechargeCount, 4)) as avgBuyUserRecharge,
- if(showRechargeCount == 0,0,floor(toFloat64(showRechargeMoney)/showRechargeCount, 4)) as avgShowUserRecharge,
- if(firstUserRechargeUser == 0,0,floor(toFloat64(costReal)/firstUserRechargeUser, 4)) as firstRechargeCost,
- if(newUserRechargeUser == 0,0,floor(toFloat64(costReal)/newUserRechargeUser, 4)) as buyUserRechargeCost,
- if(newUserRechargeUser == 0,0,floor(first_user_repeat_recharge_count/newUserRechargeUser, 4)) as repeatRechargeRate,
- if(active_user_count == 0,0,floor(recharge_user_count/active_user_count, 4)) as avgActiveRechargeRate,
- if(regUserCount == 0,0,floor(toFloat64(newUserRechargeMoney)/regUserCount, 4)) as newRegARPU,
- if(activeUserCount == 0,0,floor(toFloat64(firstUserRechargeMoney)/activeUserCount, 4)) as activeARPU,
- if(firstUserRechargeUser == 0,0,floor(toFloat64(firstUserRechargeMoney)/firstUserRechargeUser, 4)) as firstRechargeARPU,
- if(newUserRechargeUser == 0,0,floor(toFloat64(newUserRechargeMoney)/newUserRechargeUser, 4)) as todayRechargeARPU,
- if(showRechargeUser == 0,0,floor(toFloat64(showRechargeMoney)/showRechargeUser, 4)) as showRechargeARPU,
- new_user_recharge_money_dc_day1 as newUserRechargeMoneyDcDay1,
- new_user_recharge_money_dc_day2 as newUserRechargeMoneyDcDay2,
- new_user_recharge_money_dc_day3 as newUserRechargeMoneyDcDay3,
- new_user_recharge_money_dc_day4 as newUserRechargeMoneyDcDay4,
- new_user_recharge_money_dc_day5 as newUserRechargeMoneyDcDay5,
- new_user_recharge_money_dc_day6 as newUserRechargeMoneyDcDay6,
- new_user_recharge_money_dc_day7 as newUserRechargeMoneyDcDay7,
- new_user_recharge_money_dc_day14 as newUserRechargeMoneyDcDay14,
- new_user_recharge_money_dc_day15 as newUserRechargeMoneyDcDay15,
- new_user_recharge_money_dc_day29 as newUserRechargeMoneyDcDay29,
- new_user_recharge_money_dc_day30 as newUserRechargeMoneyDcDay30,
- new_user_recharge_money_dc_day59 as newUserRechargeMoneyDcDay59,
- new_user_recharge_money_dc_day60 as newUserRechargeMoneyDcDay60,
- new_user_recharge_money_dc_day89 as newUserRechargeMoneyDcDay89,
- new_user_recharge_money_dc_day90 as newUserRechargeMoneyDcDay90,
- new_user_recharge_user_dc_day1 as newUserRechargeUserDcDay1,
- new_user_recharge_user_dc_day2 as newUserRechargeUserDcDay2,
- new_user_recharge_user_dc_day3 as newUserRechargeUserDcDay3,
- new_user_recharge_user_dc_day4 as newUserRechargeUserDcDay4,
- new_user_recharge_user_dc_day5 as newUserRechargeUserDcDay5,
- new_user_recharge_user_dc_day6 as newUserRechargeUserDcDay6,
- new_user_recharge_user_dc_day7 as newUserRechargeUserDcDay7,
- new_user_recharge_user_dc_day14 as newUserRechargeUserDcDay14,
- new_user_recharge_user_dc_day15 as newUserRechargeUserDcDay15,
- new_user_recharge_user_dc_day29 as newUserRechargeUserDcDay29,
- new_user_recharge_user_dc_day30 as newUserRechargeUserDcDay30,
- new_user_recharge_user_dc_day59 as newUserRechargeUserDcDay59,
- new_user_recharge_user_dc_day60 as newUserRechargeUserDcDay60,
- new_user_recharge_user_dc_day89 as newUserRechargeUserDcDay89,
- new_user_recharge_user_dc_day90 as newUserRechargeUserDcDay90,
- new_user_recharge_money_day3 as newUserRechargeMoneyDay3,
- new_user_recharge_money_day5 as newUserRechargeMoneyDay5,
- new_user_recharge_money_day7 as newUserRechargeMoneyDay7,
- new_user_recharge_money_day15 as newUserRechargeMoneyDay15,
- new_user_recharge_money_day30 as newUserRechargeMoneyDay30,
- new_user_recharge_money_day60 as newUserRechargeMoneyDay60,
- new_user_recharge_money_day90 as newUserRechargeMoneyDay90,
- cost as totalCost
- <!-- oneDayLTV-->
- <!-- oneDayRetentionRate-->
- from t_promote_agent_stat_day
- <where>
- <if test="dto.sysUserId != null and dto.sysUserId != ''">
- and sys_user_id = #{dto.sysUserId}
- </if>
- <if test="dto.accountName != null and dto.accountName != ''">
- and promote_account_name = #{dto.accountName}
- </if>
- <if test="dto.accountId != null and dto.accountId != ''">
- and promote_account_id = #{dto.accountId}
- </if>
- <if test="dto.putAgent != null and dto.putAgent != ''">
- and put_agent = #{dto.putAgent}
- </if>
- <if test="dto.promoteStatus != null and dto.promoteStatus != ''">
- and promote_status = #{dto.promoteStatus}
- </if>
- <if test="dto.sysUserName != null and dto.sysUserName != ''">
- and sys_user_name = #{dto.sysUserName}
- </if>
- <if test="dto.cpId != null and dto.cpId != ''">
- and cp_id = #{dto.cpId}
- </if>
- <if test="dto.cpName != null and dto.cpName != ''">
- and cp_name = #{dto.cpName}
- </if>
- <if test="dto.gameId != null and dto.gameId != ''">
- and game_id = #{dto.gameId}
- </if>
- <if test="dto.gameName != null and dto.gameName != ''">
- and game_name = #{dto.gameName}
- </if>
- <if test="dto.gameType != null and dto.gameType != ''">
- and game_type = #{dto.gameType}
- </if>
- <if test="dto.beginDay != null and dto.beginDay != ''">
- and stat_day >= #{dto.beginDay}
- </if>
- <if test="dto.endDay != null and dto.endDay != ''">
- and stat_day <= #{dto.endDay}
- </if>
- </where>
- order by stat_day
- </select>
- </mapper>
|