<?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="org.jeecg.ctop.material.mapper.KuaishouOperationRecordMapper">


<!-- 查询快手组 时报 消耗前10 -->
    <select id="getKuaishouUnitReportHourly" resultType="org.jeecg.ctop.material.entity.KuaishouUnitReportHourlyPojo">
        SELECT
            *,
            CONCAT(ROUND(download_started / bclick * 100,2) ,'%') as downloadStartRate,
            ROUND(download_started / bclick * 100,2) as downloadStartCost,
            CONCAT(ROUND(download_completed / download_started * 100,2) ,'%') as downloadFinishRate,
            ROUND(charge / download_completed * 100,2) as downloadFinishCost,
            ROUND(charge / activation * 100,2) as activeCost,
            CONCAT(ROUND(activation / download_completed * 100,2) ,'%') as activeRate,
            ROUND(charge / event_pay_first_day * 100,2) as firstDayPayCost
        FROM
            media_api.`kuaishou_unit_report_hourly`
        WHERE
         stat_date >= #{startTime}
        AND stat_date &lt;= #{endTime}
        AND advertiser_id = #{advertiserId}
        ORDER BY charge DESC
        LIMIT 10
    </select>



    <!-- 查询快手组 日报 消耗前10  -->
    <select id="getKuaishouUnitReportDaily" resultType="org.jeecg.ctop.material.entity.KuaishouUnitReportHourlyPojo">
        SELECT
            *,
            CONCAT(ROUND(download_started / bclick * 100,2) ,'%') as downloadStartRate,
            ROUND(download_started / bclick * 100,2) as downloadStartCost,
            CONCAT(ROUND(download_completed / download_started * 100,2) ,'%') as downloadFinishRate,
            ROUND(charge / download_completed * 100,2) as downloadFinishCost,
            ROUND(charge / activation * 100,2) as activeCost,
            CONCAT(ROUND(activation / download_completed * 100,2) ,'%') as activeRate,
            ROUND(charge / event_pay_first_day * 100,2) as firstDayPayCost
        FROM
            media_api.`kuaishou_unit_report_daily`
        WHERE
            stat_date &gt;= #{startTime}
          AND stat_date &lt;= #{endTime}
          AND advertiser_id = #{advertiserId}
        ORDER BY charge DESC
            LIMIT 10
    </select>


    <!-- 查看账户操作记录 -->
    <select id="getKuaishouOperationRecordByAdvertiserId" resultType="com.alibaba.fastjson.JSONObject">
        SELECT
            advertiser_id,
            object_id,
            object_name,
            operation_type,
            operation_target,
            role_type,
            operation_time,
            content_log,
            create_time
        FROM
            media_api.`kuaishou_tools_advertiser_operation_record_list`
        WHERE
            advertiser_id = #{advertiserId}
            AND operation_type = #{operationType}
            AND object_id = #{objectId}
            AND operation_time &gt;= #{startTime}
            AND operation_time &lt;= #{endTime}


    </select>




</mapper>
