|
@@ -0,0 +1,821 @@
|
|
|
+<?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="cn.com.ctop.job.kuaishou.mapper.AccountInfoMapper">
|
|
|
+
|
|
|
+
|
|
|
+ <delete id="deleteUnitById">
|
|
|
+ DELETE
|
|
|
+ FROM ctop_kuaishou_group
|
|
|
+ where account_id = #{accountId}
|
|
|
+ AND unit_id = #{unitId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <insert id="replaceBatchGroup">
|
|
|
+ replace into ctop_kuaishou_group(
|
|
|
+ id,
|
|
|
+ account_id,
|
|
|
+ campaign_id,
|
|
|
+ unit_id,
|
|
|
+ unit_name,
|
|
|
+ status,
|
|
|
+ put_status,
|
|
|
+ create_channel,
|
|
|
+ review_detail,
|
|
|
+ bid_type,
|
|
|
+ bid,
|
|
|
+ cpa_bid,
|
|
|
+ ocpx_action_type,
|
|
|
+ deep_conversion_type,
|
|
|
+ deep_conversion_bid,
|
|
|
+ day_budget,
|
|
|
+ speed,
|
|
|
+ begin_time,
|
|
|
+ end_time,
|
|
|
+ schedule_time,
|
|
|
+ scene_id,
|
|
|
+ show_mode,
|
|
|
+ unit_type,
|
|
|
+ url_type,
|
|
|
+ url,
|
|
|
+ schema_uri,
|
|
|
+ app_id,
|
|
|
+ app_icon_url,
|
|
|
+ convert_id,
|
|
|
+ use_app_market,
|
|
|
+ app_store,
|
|
|
+ group_create_time,
|
|
|
+ group_update_time,
|
|
|
+ create_time,
|
|
|
+ update_time,
|
|
|
+ study_status,
|
|
|
+ unit_source)
|
|
|
+ values
|
|
|
+ <foreach collection="groups" item="getGroup" separator=",">
|
|
|
+ (
|
|
|
+ #{getGroup.id},
|
|
|
+ #{getGroup.accountId},
|
|
|
+ #{getGroup.campaignId},
|
|
|
+ #{getGroup.unitId},
|
|
|
+ #{getGroup.unitName},
|
|
|
+ #{getGroup.status},
|
|
|
+ #{getGroup.putStatus},
|
|
|
+ #{getGroup.createChannel},
|
|
|
+ #{getGroup.reviewDetail},
|
|
|
+ #{getGroup.bidType},
|
|
|
+ #{getGroup.bid},
|
|
|
+ #{getGroup.cpaBid},
|
|
|
+ #{getGroup.ocpxActionType},
|
|
|
+ #{getGroup.deepConversionType},
|
|
|
+ #{getGroup.deepConversionBid},
|
|
|
+ #{getGroup.dayBudget},
|
|
|
+ #{getGroup.speed},
|
|
|
+ #{getGroup.beginTime},
|
|
|
+ #{getGroup.endTime},
|
|
|
+ #{getGroup.scheduleTime},
|
|
|
+ #{getGroup.sceneId},
|
|
|
+ #{getGroup.showMode},
|
|
|
+ #{getGroup.unitType},
|
|
|
+ #{getGroup.urlType},
|
|
|
+ #{getGroup.url},
|
|
|
+ #{getGroup.schemaUri},
|
|
|
+ #{getGroup.appId},
|
|
|
+ #{getGroup.appIconUrl},
|
|
|
+ #{getGroup.convertId},
|
|
|
+ #{getGroup.useAppMarket},
|
|
|
+ #{getGroup.appStore,},
|
|
|
+ #{getGroup.groupCreateTime},
|
|
|
+ #{getGroup.groupUpdateTime},
|
|
|
+ #{getGroup.createTime},
|
|
|
+ #{getGroup.updateTime},
|
|
|
+ #{getGroup.studyStatus},
|
|
|
+ #{getGroup.unitSource})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="replaceBatchShouSchedule">
|
|
|
+ replace into ctop_kuaishou_schedule(
|
|
|
+ account_id,
|
|
|
+ unit_id,
|
|
|
+ mon,
|
|
|
+ tues,
|
|
|
+ wed,
|
|
|
+ thur,
|
|
|
+ fri,
|
|
|
+ sat,
|
|
|
+ sun,
|
|
|
+ create_time,
|
|
|
+ update_time)
|
|
|
+ values
|
|
|
+ <foreach collection="schedules" item="schedule" separator=",">
|
|
|
+ (
|
|
|
+ #{schedule.accountId},
|
|
|
+ #{schedule.unitId},
|
|
|
+ #{schedule.mon},
|
|
|
+ #{schedule.tues},
|
|
|
+ #{schedule.wed},
|
|
|
+ #{schedule.thur},
|
|
|
+ #{schedule.fri},
|
|
|
+ #{schedule.sat},
|
|
|
+ #{schedule.sun},
|
|
|
+ #{schedule.createTime},
|
|
|
+ #{schedule.updateTime})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="replaceBatchAppInfo">
|
|
|
+ replace into ctop_kuaishou_app_info(
|
|
|
+ account_id,
|
|
|
+ unit_id,
|
|
|
+ app_package_name,
|
|
|
+ app_name,
|
|
|
+ device_os_type,
|
|
|
+ create_time,
|
|
|
+ update_time)
|
|
|
+ values
|
|
|
+ <foreach collection="appInfos" item="appInfo" separator=",">
|
|
|
+ (#{appInfo.accountId},
|
|
|
+ #{appInfo.unitId},
|
|
|
+ #{appInfo.appPackageName},
|
|
|
+ #{appInfo.appName},
|
|
|
+ #{appInfo.deviceOsType},
|
|
|
+ #{appInfo.createTime},
|
|
|
+ #{appInfo.updateTime})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="replaceBatchGroupTarget">
|
|
|
+ replace into ctop_kuaishou_group_target(
|
|
|
+ account_id ,
|
|
|
+ unit_id,
|
|
|
+ region,
|
|
|
+ age_min,
|
|
|
+ age_max,
|
|
|
+ ages_range,
|
|
|
+ gender,
|
|
|
+ platform_os,
|
|
|
+ android_osv,
|
|
|
+ ios_osv,
|
|
|
+ network,
|
|
|
+ device_brand,
|
|
|
+ device_price,
|
|
|
+ business_interest_type,
|
|
|
+ business_interest,
|
|
|
+ fans_star,
|
|
|
+ interest_video,
|
|
|
+ app_interest,
|
|
|
+ app_ids,
|
|
|
+ population,
|
|
|
+ exclude_population,
|
|
|
+ third_platform_code,
|
|
|
+ filter_converted_level,
|
|
|
+ is_open,
|
|
|
+ no_age_break,
|
|
|
+ no_gender_break,
|
|
|
+ no_area_break,
|
|
|
+ keyword,
|
|
|
+ label,
|
|
|
+ interest_label,
|
|
|
+ time_type,
|
|
|
+ strength_type,
|
|
|
+ scene_type
|
|
|
+ )
|
|
|
+ values
|
|
|
+ <foreach collection="targets" item="targets" separator=",">
|
|
|
+ (
|
|
|
+ #{targets.accountId},
|
|
|
+ #{targets.unitId},
|
|
|
+ #{targets.region},
|
|
|
+ #{targets.ageMin},
|
|
|
+ #{targets.ageMax},
|
|
|
+ #{targets.agesRange},
|
|
|
+ #{targets.gender},
|
|
|
+ #{targets.platformOs},
|
|
|
+ #{targets.androidOsv},
|
|
|
+ #{targets.iosOsv},
|
|
|
+ #{targets.network},
|
|
|
+ #{targets.deviceBrand},
|
|
|
+ #{targets.devicePrice},
|
|
|
+ #{targets.businessInterestType},
|
|
|
+ #{targets.businessInterest},
|
|
|
+ #{targets.fansStar},
|
|
|
+ #{targets.interestVideo},
|
|
|
+ #{targets.appInterest},
|
|
|
+ #{targets.appIds},
|
|
|
+ #{targets.population},
|
|
|
+ #{targets.excludePopulation},
|
|
|
+ #{targets.thirdPlatformCode},
|
|
|
+ #{targets.filterConvertedLevel},
|
|
|
+ #{targets.isOpen},
|
|
|
+ #{targets.noAgeBreak},
|
|
|
+ #{targets.noGenderBreak},
|
|
|
+ #{targets.noAreaBreak},
|
|
|
+ #{targets.keyword},
|
|
|
+ #{targets.label},
|
|
|
+ #{targets.interestLabel},
|
|
|
+ #{targets.timeType},
|
|
|
+ #{targets.strengthType},
|
|
|
+ #{targets.sceneType}
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <select id="queryEveryhourlyDataForAccount"
|
|
|
+ resultType="cn.com.ctop.job.kuaishou.entity.EtlKuaishouReportAccountHourly">
|
|
|
+ SELECT stat_date,
|
|
|
+ account_id,
|
|
|
+ DATE_FORMAT(now(), '%H') as 'statHour',
|
|
|
+ SUM(charge) as 'charge',
|
|
|
+ SUM(photo_show) as 'photoShow',
|
|
|
+ SUM(photo_click) as 'photoClick',
|
|
|
+ SUM(aclick) as 'aclick',
|
|
|
+ SUM(bclick) as 'bclick',
|
|
|
+ SUM(share) as 'photoShare',
|
|
|
+ SUM(comment) as 'photoComment',
|
|
|
+ SUM(photo_like) as 'photoLike',
|
|
|
+ SUM(follow) as 'follow',
|
|
|
+ SUM(cancel_follow) as 'cancelFollow',
|
|
|
+ SUM(report) as 'report',
|
|
|
+ SUM(block) as 'block',
|
|
|
+ SUM(negative) as 'negative',
|
|
|
+ SUM(download_started) as 'downloadStarted',
|
|
|
+ SUM(download_completed) as 'downloadCompleted',
|
|
|
+ SUM(activation) as 'activation',
|
|
|
+ SUM(submit) as 'submit',
|
|
|
+ SUM(event_pay_first_day) as 'eventPayFirstDay',
|
|
|
+ SUM(event_pay_purchase_amount_first_day) as 'eventPayPurchaseAmountFirstDay',
|
|
|
+ SUM(event_pay) as 'eventPay',
|
|
|
+ SUM(event_pay_purchase_amount) as 'eventPayPurchaseAmount',
|
|
|
+ SUM(event_register) as 'eventRegister',
|
|
|
+ SUM(event_jin_jian_app) as 'eventJinJianApp',
|
|
|
+ SUM(event_credit_grant_app) as 'eventCreditGrantApp',
|
|
|
+ SUM(event_order_paid) as 'eventOrderPaid',
|
|
|
+ SUM(event_order_paid_purchase_amount) as 'eventOrderPaidPurchaseAmount',
|
|
|
+ SUM(event_jin_jian_landing_page) as 'eventJinJianLandingPage',
|
|
|
+ SUM(event_credit_grant_landing_page) as 'eventCreditGrantLandingPage',
|
|
|
+ SUM(event_next_day_stay) as 'eventNextDayStay',
|
|
|
+ SUM(form_count) as 'formCount',
|
|
|
+ SUM(play_3s_ratio * aclick) as 'play3sCount'
|
|
|
+ FROM ctop_kuaishou_report_hourly_account
|
|
|
+ WHERE stat_date = DATE_FORMAT(now(), '%Y-%m-%d')
|
|
|
+ AND stat_hour <= DATE_FORMAT(now(), '%H')
|
|
|
+ GROUP BY account_id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="replaceBatchEtlHourlyAccount">
|
|
|
+ replace into ctop_etl_kuaishou_report_account_hourly(
|
|
|
+ stat_date,
|
|
|
+ stat_hour,
|
|
|
+ account_id,
|
|
|
+ charge,
|
|
|
+ photo_show,
|
|
|
+ photo_click,
|
|
|
+ aclick,
|
|
|
+ bclick,
|
|
|
+ photo_share,
|
|
|
+ photo_comment,
|
|
|
+ photo_like,
|
|
|
+ follow,
|
|
|
+ cancel_follow,
|
|
|
+ report,
|
|
|
+ block,
|
|
|
+ negative,
|
|
|
+ download_started,
|
|
|
+ download_completed,
|
|
|
+ activation,
|
|
|
+ submit,
|
|
|
+ event_pay_first_day,
|
|
|
+ event_pay_purchase_amount_first_day,
|
|
|
+ event_pay,
|
|
|
+ event_pay_purchase_amount,
|
|
|
+ event_register,
|
|
|
+ event_jin_jian_app,
|
|
|
+ event_credit_grant_app,
|
|
|
+ event_order_paid,
|
|
|
+ event_order_paid_purchase_amount,
|
|
|
+ event_jin_jian_landing_page,
|
|
|
+ event_credit_grant_landing_page,
|
|
|
+ event_next_day_stay,
|
|
|
+ form_count,
|
|
|
+ play_3s_count
|
|
|
+ )
|
|
|
+ values
|
|
|
+ <foreach collection="list" item="appInfo" separator=",">
|
|
|
+ (
|
|
|
+ #{appInfo.statDate},
|
|
|
+ #{appInfo.statHour},
|
|
|
+ #{appInfo.accountId},
|
|
|
+ #{appInfo.charge},
|
|
|
+ #{appInfo.photoShow},
|
|
|
+ #{appInfo.photoClick},
|
|
|
+ #{appInfo.aclick},
|
|
|
+ #{appInfo.bclick},
|
|
|
+ #{appInfo.photoShare},
|
|
|
+ #{appInfo.photoComment},
|
|
|
+ #{appInfo.photoLike},
|
|
|
+ #{appInfo.follow},
|
|
|
+ #{appInfo.cancelFollow},
|
|
|
+ #{appInfo.report},
|
|
|
+ #{appInfo.block},
|
|
|
+ #{appInfo.negative},
|
|
|
+ #{appInfo.downloadStarted},
|
|
|
+ #{appInfo.downloadCompleted},
|
|
|
+ #{appInfo.activation},
|
|
|
+ #{appInfo.submit},
|
|
|
+ #{appInfo.eventPayFirstDay},
|
|
|
+ #{appInfo.eventPayPurchaseAmountFirstDay},
|
|
|
+ #{appInfo.eventPay},
|
|
|
+ #{appInfo.eventPayPurchaseAmount},
|
|
|
+ #{appInfo.eventRegister},
|
|
|
+ #{appInfo.eventJinJianApp},
|
|
|
+ #{appInfo.eventCreditGrantApp},
|
|
|
+ #{appInfo.eventOrderPaid},
|
|
|
+ #{appInfo.eventOrderPaidPurchaseAmount},
|
|
|
+ #{appInfo.eventJinJianLandingPage},
|
|
|
+ #{appInfo.eventCreditGrantLandingPage},
|
|
|
+ #{appInfo.eventNextDayStay},
|
|
|
+ #{appInfo.formCount},
|
|
|
+ #{appInfo.play3sCount}
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="replaceBatchEtlDailyAccount">
|
|
|
+ replace into ctop_etl_kuaishou_report_account_daily(
|
|
|
+ stat_date,
|
|
|
+ account_id,
|
|
|
+ charge,
|
|
|
+ photo_show,
|
|
|
+ photo_click,
|
|
|
+ aclick,
|
|
|
+ bclick,
|
|
|
+ photo_share,
|
|
|
+ photo_comment,
|
|
|
+ photo_like,
|
|
|
+ follow,
|
|
|
+ cancel_follow,
|
|
|
+ report,
|
|
|
+ block,
|
|
|
+ negative,
|
|
|
+ download_started,
|
|
|
+ download_completed,
|
|
|
+ activation,
|
|
|
+ submit,
|
|
|
+ event_pay_first_day,
|
|
|
+ event_pay_purchase_amount_first_day,
|
|
|
+ event_pay,
|
|
|
+ event_pay_purchase_amount,
|
|
|
+ event_register,
|
|
|
+ event_jin_jian_app,
|
|
|
+ event_credit_grant_app,
|
|
|
+ event_order_paid,
|
|
|
+ event_order_paid_purchase_amount,
|
|
|
+ event_jin_jian_landing_page,
|
|
|
+ event_credit_grant_landing_page,
|
|
|
+ event_next_day_stay,
|
|
|
+ form_count,
|
|
|
+ play_3s_count
|
|
|
+ )
|
|
|
+ values
|
|
|
+ <foreach collection="list" item="appInfo" separator=",">
|
|
|
+ (
|
|
|
+ #{appInfo.statDate},
|
|
|
+ #{appInfo.accountId},
|
|
|
+ #{appInfo.charge},
|
|
|
+ #{appInfo.photoShow},
|
|
|
+ #{appInfo.photoClick},
|
|
|
+ #{appInfo.aclick},
|
|
|
+ #{appInfo.bclick},
|
|
|
+ #{appInfo.photoShare},
|
|
|
+ #{appInfo.photoComment},
|
|
|
+ #{appInfo.photoLike},
|
|
|
+ #{appInfo.follow},
|
|
|
+ #{appInfo.cancelFollow},
|
|
|
+ #{appInfo.report},
|
|
|
+ #{appInfo.block},
|
|
|
+ #{appInfo.negative},
|
|
|
+ #{appInfo.downloadStarted},
|
|
|
+ #{appInfo.downloadCompleted},
|
|
|
+ #{appInfo.activation},
|
|
|
+ #{appInfo.submit},
|
|
|
+ #{appInfo.eventPayFirstDay},
|
|
|
+ #{appInfo.eventPayPurchaseAmountFirstDay},
|
|
|
+ #{appInfo.eventPay},
|
|
|
+ #{appInfo.eventPayPurchaseAmount},
|
|
|
+ #{appInfo.eventRegister},
|
|
|
+ #{appInfo.eventJinJianApp},
|
|
|
+ #{appInfo.eventCreditGrantApp},
|
|
|
+ #{appInfo.eventOrderPaid},
|
|
|
+ #{appInfo.eventOrderPaidPurchaseAmount},
|
|
|
+ #{appInfo.eventJinJianLandingPage},
|
|
|
+ #{appInfo.eventCreditGrantLandingPage},
|
|
|
+ #{appInfo.eventNextDayStay},
|
|
|
+ #{appInfo.formCount},
|
|
|
+ #{appInfo.play3sCount}
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="replaceBatchKuaishouReportHourlyAccount">
|
|
|
+ replace into ctop_kuaishou_report_hourly_account(
|
|
|
+ id,
|
|
|
+ account_id,
|
|
|
+ charge,
|
|
|
+ photo_show,
|
|
|
+ aclick,
|
|
|
+ bclick,
|
|
|
+ share,
|
|
|
+ comment,
|
|
|
+ photo_like,
|
|
|
+ follow,
|
|
|
+ cancel_follow,
|
|
|
+ report,
|
|
|
+ block,
|
|
|
+ negative,
|
|
|
+ download_started,
|
|
|
+ download_completed,
|
|
|
+ activation,
|
|
|
+ submit,
|
|
|
+ stat_date,
|
|
|
+ stat_hour,
|
|
|
+ photo_click,
|
|
|
+ photo_click_ratio,
|
|
|
+ action_ratio,
|
|
|
+ impression_1k_cost,
|
|
|
+ photo_click_cost,
|
|
|
+ action_cost,
|
|
|
+ event_pay_first_day,
|
|
|
+ event_pay_purchase_amount_first_day,
|
|
|
+ event_pay_first_day_roi,
|
|
|
+ event_pay,
|
|
|
+ event_pay_purchase_amount,
|
|
|
+ event_pay_roi,
|
|
|
+ event_register,
|
|
|
+ event_register_cost,
|
|
|
+ event_jin_jian_app,
|
|
|
+ event_jin_jian_app_cost,
|
|
|
+ event_credit_grant_app,
|
|
|
+ event_credit_grant_app_cost,
|
|
|
+ event_credit_grant_app_ratio,
|
|
|
+ event_order_paid,
|
|
|
+ event_order_paid_purchase_amount,
|
|
|
+ event_jin_jian_landing_page,
|
|
|
+ event_jin_jian_landing_page_cost,
|
|
|
+ event_credit_grant_landing_page,
|
|
|
+ event_credit_grant_landing_page_cost,
|
|
|
+ form_action_ratio,
|
|
|
+ event_order_paid_cost,
|
|
|
+ event_next_day_stay,
|
|
|
+ form_cost,
|
|
|
+ form_count,
|
|
|
+ play_3s_ratio,
|
|
|
+ play_5s_ratio,
|
|
|
+ play_end_ratio,
|
|
|
+ event_app_invoked,
|
|
|
+ event_new_user_pay,
|
|
|
+ event_new_user_pay_cost,
|
|
|
+ event_new_user_pay_ratio,
|
|
|
+ key_action)
|
|
|
+ values
|
|
|
+ <foreach collection="addList" item="add" separator=",">
|
|
|
+ (
|
|
|
+ #{add.id},
|
|
|
+ #{add.accountId},
|
|
|
+ #{add.charge},
|
|
|
+ #{add.photoShow},
|
|
|
+ #{add.aclick},
|
|
|
+ #{add.bclick},
|
|
|
+ #{add.share},
|
|
|
+ #{add.comment},
|
|
|
+ #{add.photoLike},
|
|
|
+ #{add.follow},
|
|
|
+ #{add.cancelFollow},
|
|
|
+ #{add.report},
|
|
|
+ #{add.block},
|
|
|
+ #{add.negative},
|
|
|
+ #{add.downloadStarted},
|
|
|
+ #{add.downloadCompleted},
|
|
|
+ #{add.activation},
|
|
|
+ #{add.submit},
|
|
|
+ #{add.statDate},
|
|
|
+ #{add.statHour},
|
|
|
+ #{add.photoClick},
|
|
|
+ #{add.photoClickRatio},
|
|
|
+ #{add.actionRatio},
|
|
|
+ #{add.impression1kCost},
|
|
|
+ #{add.photoClickCost},
|
|
|
+ #{add.actionCost},
|
|
|
+ #{add.eventPayFirstDay},
|
|
|
+ #{add.eventPayPurchaseAmountFirstDay},
|
|
|
+ #{add.eventPayFirstDayRoi},
|
|
|
+ #{add.eventPay},
|
|
|
+ #{add.eventPayPurchaseAmount},
|
|
|
+ #{add.eventPayRoi},
|
|
|
+ #{add.eventRegister},
|
|
|
+ #{add.eventRegisterCost},
|
|
|
+ #{add.eventJinJianApp},
|
|
|
+ #{add.eventJinJianAppCost},
|
|
|
+ #{add.eventCreditGrantApp},
|
|
|
+ #{add.eventCreditGrantAppCost},
|
|
|
+ #{add.eventCreditGrantAppRatio},
|
|
|
+ #{add.eventOrderPaid},
|
|
|
+ #{add.eventOrderPaidPurchaseAmount},
|
|
|
+ #{add.eventJinJianLandingPage},
|
|
|
+ #{add.eventJinJianLandingPageCost},
|
|
|
+ #{add.eventCreditGrantLandingPage},
|
|
|
+ #{add.eventCreditGrantLandingPageCost},
|
|
|
+ #{add.formActionRatio},
|
|
|
+ #{add.eventOrderPaidCost},
|
|
|
+ #{add.eventNextDayStay},
|
|
|
+ #{add.formCost},
|
|
|
+ #{add.formCount},
|
|
|
+ #{add.play3sRatio},
|
|
|
+ #{add.play5sRatio},
|
|
|
+ #{add.playEndRatio},
|
|
|
+ #{add.eventAppInvoked},
|
|
|
+ #{add.eventNewUserPay},
|
|
|
+ #{add.eventNewUserPayCost},
|
|
|
+ #{add.eventNewUserPayRatio},
|
|
|
+ #{add.keyAction}
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <select id="selectMaxHour" resultType="java.lang.Integer">
|
|
|
+ select max(stat_hour)
|
|
|
+ from ctop_kuaishou_report_hourly_account
|
|
|
+ where account_id = #{accountId}
|
|
|
+ and stat_date = #{statDate}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getkuaishouReportHourlyCost" resultType="java.math.BigDecimal">
|
|
|
+ select charge
|
|
|
+ from ctop_kuaishou_report_hourly_account
|
|
|
+ where account_id = #{accountId}
|
|
|
+ and stat_date = #{statDate}
|
|
|
+ and stat_hour = #{statHour}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="replaceBatchKuaiShouDailyAgent">
|
|
|
+ replace into ctop_kuaishou_daily_agent(
|
|
|
+ agent_id,
|
|
|
+ account_id,
|
|
|
+ date_time,
|
|
|
+ user_id,
|
|
|
+ account_name,
|
|
|
+ total_charged_in_yuan,
|
|
|
+ total_balance_in_yuan,
|
|
|
+ real_charged_in_yuan,
|
|
|
+ total_rebate_real_charged_in_yuan,
|
|
|
+ contract_rebate_real_charged_in_yuan,
|
|
|
+ direct_rebate_real_charged_in_yuan,
|
|
|
+ credit_real_charged_in_yuan,
|
|
|
+ charge_day_on_day_percent,
|
|
|
+ ad_photo_impression,
|
|
|
+ ad_photo_click,
|
|
|
+ ad_item_impression,
|
|
|
+ ad_item_click,
|
|
|
+ photo_click_ratio,
|
|
|
+ item_click_ratio,
|
|
|
+ charged_campaign_count,
|
|
|
+ product_name,
|
|
|
+ corporation_name,
|
|
|
+ first_cost_day,
|
|
|
+ industry,
|
|
|
+ second_industry
|
|
|
+ )
|
|
|
+ values
|
|
|
+ <foreach collection="list" item="agent" separator=",">
|
|
|
+ (
|
|
|
+ #{agent.agentId},
|
|
|
+ #{agent.accountId},
|
|
|
+ #{agent.dateTime},
|
|
|
+ #{agent.userId},
|
|
|
+ #{agent.accountName},
|
|
|
+ #{agent.totalChargedInYuan},
|
|
|
+ #{agent.totalBalanceInYuan},
|
|
|
+ #{agent.realChargedInYuan},
|
|
|
+ #{agent.totalRebateRealChargedInYuan},
|
|
|
+ #{agent.contractRebateRealChargedInYuan},
|
|
|
+ #{agent.directRebateRealChargedInYuan},
|
|
|
+ #{agent.creditRealChargedInYuan},
|
|
|
+ #{agent.chargeDayOnDayPercent},
|
|
|
+ #{agent.adPhotoImpression},
|
|
|
+ #{agent.adPhotoClick},
|
|
|
+ #{agent.adItemImpression},
|
|
|
+ #{agent.adItemClick},
|
|
|
+ #{agent.photoClickRatio},
|
|
|
+ #{agent.itemClickRatio},
|
|
|
+ #{agent.chargedCampaignCount},
|
|
|
+ #{agent.productName},
|
|
|
+ #{agent.corporationName},
|
|
|
+ #{agent.firstCostDay},
|
|
|
+ #{agent.industry},
|
|
|
+ #{agent.secondIndustry}
|
|
|
+ )
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getKuaiShouGroup" resultType="Map">
|
|
|
+ SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.unit_id as
|
|
|
+ 'unitId',t.group_create_time as 'groupCreatTime',DATE_FORMAT(DATE_ADD(t.group_create_time,INTERVAL 7
|
|
|
+ DAY),'%Y-%m-%d') as 'afterTime'
|
|
|
+ from ctop_user_allocation t1 LEFT JOIN ctop_kuaishou_group t on t1.account_id=t.account_id
|
|
|
+ <where>
|
|
|
+ and t.account_id=#{accountId}
|
|
|
+ <choose>
|
|
|
+ <when test="date!= null and date!=''">
|
|
|
+ and t.group_create_time >= DATE_SUB(#{date},INTERVAL 7 DAY)
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and t.group_create_time >= DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 YEAR),'%Y-%m-%d')
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getKuaiShouGroupNow" resultType="Map">
|
|
|
+ SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.unit_id as
|
|
|
+ 'unitId',t.group_create_time as 'groupCreatTime',DATE_FORMAT(DATE_ADD(t.group_create_time,INTERVAL 7
|
|
|
+ DAY),'%Y-%m-%d') as 'afterTime'
|
|
|
+ from ctop_user_allocation t1 LEFT JOIN ctop_kuaishou_group t on t1.account_id=t.account_id
|
|
|
+ <where>
|
|
|
+ and t.account_id=#{accountId}
|
|
|
+ and t.group_create_time >= #{date}
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getGroupCharge" resultType="java.math.BigDecimal">
|
|
|
+ select sum(charge)
|
|
|
+ from ctop_kuaishou_report_daily_group t
|
|
|
+ where t.stat_date < #{afterDate}
|
|
|
+ and t.unit_id = #{unitId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getMonitorGroupByUnitId" resultType="String">
|
|
|
+ select t.effective
|
|
|
+ from ctop_new_monitor_group t
|
|
|
+ where t.unit_id = #{unitId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <update id="updateMonitorGroupByUnitId">
|
|
|
+ update ctop_new_monitor_group t
|
|
|
+ set t.effective=#{effective}
|
|
|
+ where t.unit_id = #{unitId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <insert id="saveMonitorGroup">
|
|
|
+ insert into ctop_new_monitor_group
|
|
|
+ (account_id,
|
|
|
+ account_name,
|
|
|
+ operating_name,
|
|
|
+ unit_id,
|
|
|
+ create_time,
|
|
|
+ project_type,
|
|
|
+ effective)
|
|
|
+ values (#{accountId},
|
|
|
+ #{accountName},
|
|
|
+ #{operatingName},
|
|
|
+ #{unitId},
|
|
|
+ #{createTime},
|
|
|
+ #{projectType},
|
|
|
+ #{effective})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <select id="getKuaiShouCampaign" resultType="Map">
|
|
|
+ SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.campaign_id as
|
|
|
+ 'campaignId',t.put_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.put_create_time,INTERVAL 7
|
|
|
+ DAY),'%Y-%m-%d') as 'afterTime'
|
|
|
+ from ctop_user_allocation t1 LEFT JOIN ctop_kuaishou_campaign t on t1.account_id=t.account_id
|
|
|
+ <where>
|
|
|
+ and t.account_id=#{accountId}
|
|
|
+ <choose>
|
|
|
+ <when test="date != null and date !=''">
|
|
|
+ and t.put_create_time >= DATE_SUB(#{date},INTERVAL 7 DAY)
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and t.put_create_time >= DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 YEAR),'%Y-%m-%d')
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getKuaiShouCampaignNow" resultType="Map">
|
|
|
+ SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.campaign_id as
|
|
|
+ 'campaignId',t.put_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.put_create_time,INTERVAL 7
|
|
|
+ DAY),'%Y-%m-%d') as 'afterTime'
|
|
|
+ from ctop_user_allocation t1 LEFT JOIN ctop_kuaishou_campaign t on t1.account_id=t.account_id
|
|
|
+ <where>
|
|
|
+ and t.account_id=#{accountId}
|
|
|
+ and t.put_create_time >=#{date}
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getCampaignCharge" resultType="java.math.BigDecimal">
|
|
|
+ select sum(charge)
|
|
|
+ from ctop_kuaishou_report_daily_campaign t
|
|
|
+ where t.stat_date < #{afterDate}
|
|
|
+ and t.campaign_id = #{campaignId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getMonitorPlanByCampaignId" resultType="String">
|
|
|
+ select t.effective
|
|
|
+ from ctop_new_monitor_campaign t
|
|
|
+ where t.campaign_id = #{campaignId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <update id="updateMonitorPlanByCampaignId">
|
|
|
+ update ctop_new_monitor_campaign t
|
|
|
+ set t.effective=#{effective}
|
|
|
+ where t.campaign_id = #{campaignId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <insert id="saveMonitorCampaign">
|
|
|
+ insert into ctop_new_monitor_campaign
|
|
|
+ (account_id,
|
|
|
+ account_name,
|
|
|
+ operating_name,
|
|
|
+ campaign_id,
|
|
|
+ create_time,
|
|
|
+ project_type,
|
|
|
+ effective)
|
|
|
+ values (#{accountId},
|
|
|
+ #{accountName},
|
|
|
+ #{operatingName},
|
|
|
+ #{campaignId},
|
|
|
+ #{createTime},
|
|
|
+ #{projectType},
|
|
|
+ #{effective})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="getTouTiaoCampaign" resultType="Map">
|
|
|
+ SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.id as
|
|
|
+ 'campaignId',t.ad_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.ad_create_time,INTERVAL 7
|
|
|
+ DAY),'%Y-%m-%d') as 'afterTime'
|
|
|
+ from ctop_user_allocation t1 LEFT JOIN ctop_bytedance_advertise_plan t on t1.account_id=t.account_id
|
|
|
+ <where>
|
|
|
+ and t.account_id=#{accountId}
|
|
|
+ <choose>
|
|
|
+ <when test="date != null and date !=''">
|
|
|
+ and t.ad_create_time >= DATE_SUB(#{date},INTERVAL 7 DAY)
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ and t.ad_create_time >= DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 YEAR),'%Y-%m-%d')
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getTouTiaoCampaignNow" resultType="Map">
|
|
|
+ SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.id as
|
|
|
+ 'campaignId',t.ad_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.ad_create_time,INTERVAL 7
|
|
|
+ DAY),'%Y-%m-%d') as 'afterTime'
|
|
|
+ from ctop_user_allocation t1 LEFT JOIN ctop_bytedance_advertise_plan t on t1.account_id=t.account_id
|
|
|
+ <where>
|
|
|
+ and t.account_id=#{accountId}
|
|
|
+ and t.ad_create_time >= #{date}
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getCampaignChargeTouTiao" resultType="java.math.BigDecimal">
|
|
|
+ select sum(cost)
|
|
|
+ from ctop_bytedance_report_plan_daily t
|
|
|
+ where t.stat_datetime < #{afterDate}
|
|
|
+ and t.ad_id = #{campaignId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getCampaignByAccountId" resultType="cn.com.ctop.job.kuaishou.entity.KuaiShouCampaign">
|
|
|
+ SELECT *
|
|
|
+ FROM ctop_kuaishou_campaign
|
|
|
+ WHERE account_id = #{accountId}
|
|
|
+ ORDER BY put_create_time DESC limit 15
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getGroupOneByUnitId" resultType="cn.com.ctop.job.kuaishou.entity.KuaiShouGroup">
|
|
|
+ SELECT *
|
|
|
+ FROM ctop_kuaishou_group
|
|
|
+ WHERE unit_id = #{unitId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getTargetOneByUnitId" resultType="cn.com.ctop.job.kuaishou.entity.KuaiShouGroupTarget">
|
|
|
+ SELECT *
|
|
|
+ FROM ctop_kuaishou_group_target
|
|
|
+ WHERE unit_id = #{unitId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getAllAccountId" resultType="String">
|
|
|
+ SELECT a.account_id
|
|
|
+ FROM ctop_agent_account a
|
|
|
+ LEFT JOIN ctop_user_allocation u ON a.account_id = u.account_id
|
|
|
+ WHERE a.state = 0
|
|
|
+ AND u.account_status = 0
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getAccountIdByMedia" resultType="String">
|
|
|
+ SELECT account_id
|
|
|
+ FROM ctop_user_allocation
|
|
|
+ WHERE account_status = 0
|
|
|
+ AND media_id = #{mediaId}
|
|
|
+ </select>
|
|
|
+</mapper>
|