123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- <?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.tzld.piaoquan.api.dao.mapper.contentplatform.ext.ContentPlatformDataStatMapperExt">
- <select id="getGzhAccountDatastatCount" resultType="java.lang.Integer">
- select count(1)
- from content_platform_gzh_datastat cpgd
- join content_platform_gzh_account cpgza on cpgd.account_id = cpgza.id
- where cpgza.create_account_id = #{createAccountId}
- <if test="param.accountId!= null and param.accountId!= ''">
- and cpgza.account_id = #{param.accountId}
- </if>
- </select>
- <select id="getGzhAccountDatastatList"
- resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhDataStat">
- select cpgd.*
- from content_platform_gzh_datastat cpgd
- join content_platform_gzh_account cpgza on cpgd.account_id = cpgza.id
- where cpgza.create_account_id = #{createAccountId}
- <if test="param.accountId!= null and param.accountId!= ''">
- and cpgza.account_id = #{param.accountId}
- </if>
- order by cpgd.date_str desc
- limit #{offset}, #{pageSize}
- </select>
- <select id="getGzhTotalDatastatCount" resultType="java.lang.Integer">
- select count(1)
- from content_platform_gzh_datastat_total cpgdt
- join content_platform_account cpa on cpgdt.channel = cpa.channel
- where cpa.id = #{createAccountId}
- </select>
- <select id="getGzhTotalDatastatList"
- resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhDataStat">
- select date_str, fans_increase_count, first_level_count, score
- from content_platform_gzh_datastat_total cpgdt
- join content_platform_account cpa on cpgdt.channel = cpa.channel
- where cpa.id = #{createAccountId}
- order by cpgdt.date_str desc
- limit #{offset}, #{pageSize}
- </select>
- <select id="getFwhAccountDatastatCount" resultType="java.lang.Integer">
- select count(1)
- from content_platform_fwh_datastat cpgd
- join content_platform_gzh_account cpgza on cpgd.account_id = cpgza.id
- where cpgza.create_account_id = #{createAccountId}
- <if test="param.accountId!= null and param.accountId!= ''">
- and cpgza.account_id = #{param.accountId}
- </if>
- </select>
- <select id="getFwhAccountDatastatList"
- resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhDataStat">
- select cpfd.*
- from content_platform_fwh_datastat cpfd
- join content_platform_gzh_account cpgza on cpfd.account_id = cpgza.id
- where cpgza.create_account_id = #{createAccountId}
- <if test="param.accountId!= null and param.accountId!= ''">
- and cpgza.account_id = #{param.accountId}
- </if>
- order by cpfd.date_str desc
- limit #{offset}, #{pageSize}
- </select>
- <select id="getFwhTotalDatastatCount" resultType="java.lang.Integer">
- select count(1)
- from content_platform_fwh_datastat_total cpfdt
- join content_platform_account cpa on cpfdt.channel = cpa.channel
- where cpa.id = #{createAccountId}
- </select>
- <select id="getFwhTotalDatastatList"
- resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformGzhDataStat">
- select date_str, fans_increase_count, first_level_count, score
- from content_platform_fwh_datastat_total cpfdt
- join content_platform_account cpa on cpfdt.channel = cpa.channel
- where cpa.id = #{createAccountId}
- order by cpfdt.date_str desc
- limit #{offset}, #{pageSize}
- </select>
- <select id="getQwRootSourceIdDatastatCount" resultType="java.lang.Integer">
- select count(1)
- from content_platform_qw_datastat cpqd
- join content_platform_qw_plan cpqp on cpqp.root_source_id = cpqd.root_source_id
- where cpqp.create_account_id = #{createAccountId}
- </select>
- <select id="getQwRootSourceIdDatastatList"
- resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwDataStat">
- select cpqd.*
- from content_platform_qw_datastat cpqd
- join content_platform_qw_plan cpqp on cpqp.root_source_id = cpqd.root_source_id
- where cpqp.create_account_id = #{createAccountId}
- order by cpqd.date_str desc
- limit #{offset}, #{pageSize}
- </select>
- <select id="getQwTotalDatastatCount" resultType="java.lang.Integer">
- select count(1)
- from content_platform_qw_datastat_total
- where channel = #{channel}
- </select>
- <select id="getQwTotalDatastatList"
- resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwDataStatTotal">
- select date_str, channel, first_level_count, score
- from content_platform_qw_datastat_total
- where channel = #{channel}
- order by date_str desc
- limit #{offset}, #{pageSize}
- </select>
- <select id="getQwReplyTotalDatastatCount" resultType="java.lang.Integer">
- select count(1)
- from content_platform_qw_datastat_reply_total
- where channel = #{channel}
- </select>
- <select id="getQwReplyTotalDatastatList"
- resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwDataStatReplyTotal">
- select date_str, channel, first_level_count, score
- from content_platform_qw_datastat_reply_total
- where channel = #{channel}
- order by date_str desc
- limit #{offset}, #{pageSize}
- </select>
- <select id="getQwSubChannelDatastatCount" resultType="java.lang.Integer">
- select count(1)
- from content_platform_qw_datastat_sub_channel
- where create_account_id = #{channel}
- </select>
- <select id="getQwSubChannelDatastatList"
- resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwDataStatReplyTotal">
- select date_str, sub_channel, first_level_count, score
- from content_platform_qw_datastat_sub_channel
- where channel = #{channel}
- order by date_str desc
- limit #{offset}, #{pageSize}
- </select>
- <select id="getQwSceneDatastatCount" resultType="java.lang.Integer">
- select count(1)
- from (select cpqd.date_str
- from content_platform_qw_datastat cpqd
- join content_platform_qw_plan cpqp on cpqp.root_source_id = cpqd.root_source_id
- where cpqp.create_account_id = #{createAccountId}
- and cpqp.scene = #{scene}
- group by cpqd.date_str) t
- </select>
- <select id="getQwSceneDatastatList"
- resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwDataStat">
- select cpqd.date_str, sum(cpqd.first_level_count) as first_level_count, avg(cpqd.score) as score
- from content_platform_qw_datastat cpqd
- join content_platform_qw_plan cpqp on cpqp.root_source_id = cpqd.root_source_id
- where cpqp.create_account_id = #{createAccountId}
- and cpqp.scene = #{scene}
- group by cpqd.date_str
- order by cpqd.date_str desc
- limit #{offset}, #{pageSize}
- </select>
- <select id="getQwReplyDatastatCount" resultType="java.lang.Integer">
- select count(1)
- from (select cpqd.date_str
- from content_platform_qw_datastat cpqd
- join content_platform_qw_plan cpqp on cpqp.root_source_id = cpqd.root_source_id
- where cpqp.create_account_id = #{createAccountId}
- and cpqp.type = 1
- group by cpqd.date_str) t
- </select>
- <select id="getReplyDatastatList"
- resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwDataStat">
- select cpqd.date_str, sum(cpqd.first_level_count) as first_level_count, avg(cpqd.score) as score
- from content_platform_qw_datastat cpqd
- join content_platform_qw_plan cpqp on cpqp.root_source_id = cpqd.root_source_id
- where cpqp.create_account_id = #{createAccountId}
- and cpqp.type = 1
- group by cpqd.date_str
- order by cpqd.date_str desc
- limit #{offset}, #{pageSize}
- </select>
- <insert id="batchInsertGzhDatastat">
- insert into content_platform_gzh_datastat (date_str, account_id, fans_increase_count, first_level_count, score,
- create_timestamp)
- values
- <foreach collection="records" item="item" separator=",">
- (#{item.dateStr}, #{item.accountId}, #{item.fansIncreaseCount}, #{item.firstLevelCount}, #{item.score},
- #{item.createTimestamp})
- </foreach>
- </insert>
- <insert id="batchInsertGzhDatastatTotal">
- insert into content_platform_gzh_datastat_total (date_str, channel, fans_increase_count, first_level_count, score,
- create_timestamp)
- values
- <foreach collection="records" item="item" separator=",">
- (#{item.dateStr}, #{item.channel}, #{item.fansIncreaseCount}, #{item.firstLevelCount}, #{item.score},
- #{item.createTimestamp})
- </foreach>
- </insert>
- <insert id="batchInsertFwhDatastat">
- insert into content_platform_fwh_datastat (date_str, account_id, fans_increase_count, first_level_count, score,
- create_timestamp)
- values
- <foreach collection="records" item="item" separator=",">
- (#{item.dateStr}, #{item.accountId}, #{item.fansIncreaseCount}, #{item.firstLevelCount}, #{item.score},
- #{item.createTimestamp})
- </foreach>
- </insert>
- <insert id="batchInsertFwhDatastatTotal">
- insert into content_platform_fwh_datastat_total (date_str, channel, fans_increase_count, first_level_count, score,
- create_timestamp)
- values
- <foreach collection="records" item="item" separator=",">
- (#{item.dateStr}, #{item.channel}, #{item.fansIncreaseCount}, #{item.firstLevelCount}, #{item.score},
- #{item.createTimestamp})
- </foreach>
- </insert>
- <insert id="batchInsertQwDatastat">
- insert into content_platform_qw_datastat (date_str, root_source_id, first_level_count, score, create_timestamp)
- values
- <foreach collection="records" item="item" separator=",">
- (#{item.dateStr}, #{item.rootSourceId}, #{item.firstLevelCount}, #{item.score}, #{item.createTimestamp})
- </foreach>
- </insert>
- <insert id="batchInsertQwDatastatTotal">
- insert into content_platform_qw_datastat_total (date_str, channel, first_level_count, score, create_timestamp)
- values
- <foreach collection="records" item="item" separator=",">
- (#{item.dateStr}, #{item.channel}, #{item.firstLevelCount}, #{item.score}, #{item.createTimestamp})
- </foreach>
- </insert>
- <insert id="batchInsertQwDatastatReplyTotal">
- insert into content_platform_qw_datastat_reply_total (date_str, channel, first_level_count, score, create_timestamp)
- values
- <foreach collection="records" item="item" separator=",">
- (#{item.dateStr}, #{item.channel}, #{item.firstLevelCount}, #{item.score}, #{item.createTimestamp})
- </foreach>
- </insert>
- <insert id="batchInsertQwDatastatSubChannel">
- insert into content_platform_qw_datastat_sub_channel (date_str, sub_channel, first_level_count, score,
- create_account_id, create_timestamp)
- values
- <foreach collection="records" item="item" separator=",">
- (#{item.dateStr}, #{item.subChannel}, #{item.firstLevelCount}, #{item.score}, #{item.createAccountId},
- #{item.createTimestamp})
- </foreach>
- </insert>
- <select id="getQwTotalDatastatScoreList"
- resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwDataStatTotal">
- select cpa.channel, round(avg(cpqd.score), 2) as score
- from content_platform_qw_datastat cpqd
- join content_platform_qw_plan cpqp on cpqp.root_source_id = cpqd.root_source_id
- join content_platform_account cpa on cpa.id = cpqp.create_account_id
- where cpqd.date_str = #{dt}
- group by cpa.channel
- </select>
- <select id="getQwTotalDatastatReplyScoreList"
- resultType="com.tzld.piaoquan.api.model.po.contentplatform.ContentPlatformQwDataStatReplyTotal">
- select cpa.channel, round(avg(cpqd.score), 2) as score
- from content_platform_qw_datastat cpqd
- join content_platform_qw_plan cpqp on cpqp.root_source_id = cpqd.root_source_id
- join content_platform_account cpa on cpa.id = cpqp.create_account_id
- where cpqd.date_str = #{dt} and cpqp.type = 1
- group by cpa.channel
- </select>
- <delete id="deleteQwDatastatTotal">
- delete from content_platform_qw_datastat_total where date_str = #{dt}
- </delete>
- <delete id="deleteQwDatastatReplyTotal">
- delete from content_platform_qw_datastat_reply_total where date_str = #{dt}
- </delete>
- <delete id="deleteQwDatastatSubChannel">
- delete from content_platform_qw_datastat_sub_channel where date_str = #{dt}
- </delete>
- <delete id="deleteGzhDatastatTotal">
- delete from content_platform_gzh_datastat_total where date_str = #{dt}
- </delete>
- <delete id="deleteFwhDatastatTotal">
- delete from content_platform_fwh_datastat_total where date_str = #{dt}
- </delete>
- </mapper>
|