123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- <?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.fs.bdAdv.mapper.FsAdvSemMapper">
- <resultMap type="FsAdvSem" id="FsAdvSemResult">
- <result property="id" column="id" />
- <result property="imei" column="imei" />
- <result property="idfa" column="idfa" />
- <result property="oaid" column="oaid" />
- <result property="androidId" column="android_id" />
- <result property="akey" column="akey" />
- <result property="aType" column="a_type" />
- <result property="aValue" column="a_value" />
- <result property="joinType" column="join_type" />
- <result property="ip" column="ip" />
- <result property="ua" column="ua" />
- <result property="osVersion" column="os_version" />
- <result property="model" column="model" />
- <result property="osType" column="os_type" />
- <result property="deviceId" column="device_id" />
- <result property="aid" column="aid" />
- <result property="pid" column="pid" />
- <result property="uid" column="uid" />
- <result property="clickId" column="click_id" />
- <result property="callbackUrl" column="callback_url" />
- <result property="advType" column="adv_type" />
- <result property="cmdType" column="cmd_type" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="userId" column="user_id" />
- </resultMap>
- <sql id="selectFsAdvSemVo">
- select id, imei, idfa, oaid,user_id, android_id, akey, a_type, a_value, join_type, ip, ua, os_version, model, os_type, device_id, aid, pid, uid, click_id, callback_url, adv_type,cmd_type, create_time, update_time from fs_adv_sem
- </sql>
- <select id="selectFsAdvSemList" parameterType="FsAdvSem" resultMap="FsAdvSemResult">
- <include refid="selectFsAdvSemVo"/>
- <where>
- <if test="imei != null and imei != ''"> and imei = #{imei}</if>
- <if test="idfa != null and idfa != ''"> and idfa = #{idfa}</if>
- <if test="oaid != null and oaid != ''"> and oaid = #{oaid}</if>
- <if test="androidId != null and androidId != ''"> and android_id = #{androidId}</if>
- <if test="akey != null and akey != ''"> and akey = #{akey}</if>
- <if test="aType != null and aType != ''"> and a_type = #{aType}</if>
- <if test="aValue != null and aValue != ''"> and a_value = #{aValue}</if>
- <if test="joinType != null and joinType != ''"> and join_type = #{joinType}</if>
- <if test="ip != null and ip != ''"> and ip = #{ip}</if>
- <if test="ua != null and ua != ''"> and ua = #{ua}</if>
- <if test="osVersion != null and osVersion != ''"> and os_version = #{osVersion}</if>
- <if test="model != null and model != ''"> and model = #{model}</if>
- <if test="osType != null "> and os_type = #{osType}</if>
- <if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
- <if test="aid != null and aid != ''"> and aid = #{aid}</if>
- <if test="pid != null and pid != ''"> and pid = #{pid}</if>
- <if test="uid != null and uid != ''"> and uid = #{uid}</if>
- <if test="clickId != null and clickId != ''"> and click_id = #{clickId}</if>
- <if test="callbackUrl != null and callbackUrl != ''"> and callback_url = #{callbackUrl}</if>
- <if test="advType != null "> and adv_type = #{advType}</if>
- </where>
- </select>
- <select id="selectFsAdvSemById" parameterType="Long" resultMap="FsAdvSemResult">
- <include refid="selectFsAdvSemVo"/>
- where id = #{id}
- </select>
- <select id="selectFsAdvSemStatisticsByDayVo" parameterType="com.fs.bdAdv.param.FsAdvSemStatisticsByDayParam" resultType="com.fs.bdAdv.vo.FsAdvSemStatisticsByDayVo">
- SELECT * FROM (
- SELECT
- DATE(create_time) AS date,
- adv_type,
- COUNT(CASE WHEN cmd_type = 0 THEN 1 END) AS activation_count,
- COUNT(CASE WHEN cmd_type = 1 THEN 1 END) AS registration_count,
- COUNT(CASE WHEN cmd_type = 4 THEN 1 END) AS jump_count,
- COUNT(CASE WHEN cmd_type = 5 THEN 1 END) AS binding_count,
- COUNT(*) AS total_count,
- ROUND(COUNT(CASE WHEN cmd_type = 0 THEN 1 END) / COUNT(*) * 100, 2) AS activation_rate,
- ROUND(COUNT(CASE WHEN cmd_type = 1 THEN 1 END) / COUNT(*) * 100, 2) AS registration_rate,
- ROUND(COUNT(CASE WHEN cmd_type = 4 THEN 1 END) / COUNT(*) * 100, 2) AS jump_rate,
- ROUND(COUNT(CASE WHEN cmd_type = 5 THEN 1 END) / COUNT(*) * 100, 2) AS binding_rate
- FROM
- fs_adv_sem
- WHERE
- create_time IS NOT NULL
- <if test="advType != null">
- and adv_type = #{advType}
- </if>
- GROUP BY
- DATE(create_time) ,adv_type
- ORDER BY
- DATE(create_time)) a
- <where>
- <if test="totalCountMax != null">
- a.total_count <= #{totalCountMax}
- </if>
- <if test="totalCountMin != null">
- a.total_count >= #{totalCountMin}
- </if>
- <if test="activationCountMax != null">
- a.activation_count <= #{activationCountMax}
- </if>
- <if test="activationCountMin != null">
- a.activation_count >= #{activationCountMin}
- </if>
- <if test="registrationCountMax != null">
- a.registration_count <= #{registrationCountMax}
- </if>
- <if test="registrationCountMin != null">
- a.registration_count >= #{registrationCountMin}
- </if>
- <if test="jumpCountMax != null">
- a.jump_count <= #{jumpCountMax}
- </if>
- <if test="jumpCountMin != null">
- a.jump_count >= #{jumpCountMin}
- </if>
- <if test="bindingCountMax != null">
- a.binding_count <= #{bindingCountMax}
- </if>
- <if test="bindingCountMin != null">
- a.binding_count >= #{bindingCountMin}
- </if>
- <if test="activationRateMax != null">
- a.activation_rate <= #{activationRateMax}
- </if>
- <if test="activationRateMin != null">
- a.activation_rate >= #{activationRateMin}
- </if>
- <if test="registrationRateMax != null">
- a.registration_rate <= #{registrationRateMax}
- </if>
- <if test="registrationRateMin != null">
- a.registration_rate >= #{registrationRateMin}
- </if>
- <if test="jumpRateMax != null">
- a.jump_rate <= #{jumpRateMax}
- </if>
- <if test="jumpRateMin != null">
- a.jump_rate >= #{jumpRateMin}
- </if>
- <if test="bindingRateMax != null">
- a.binding_rate <= #{bindingRateMax}
- </if>
- <if test="bindingRateMin != null">
- a.binding_rate >= #{bindingRateMin}
- </if>
- <if test="dateMax != null and dateMax != ''">
- and date_format(a.date,'%y%m%d') <= date_format(#{dateMax},'%y%m%d')
- </if>
- <if test="dateMin != null and dateMin != ''">
- and date_format(a.date,'%y%m%d') >= date_format(#{dateMin},'%y%m%d')
- </if>
- </where>
- ${params.dataScope}
- </select>
- <insert id="insertFsAdvSem" parameterType="FsAdvSem" useGeneratedKeys="true" keyProperty="id">
- insert into fs_adv_sem
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="imei != null">imei,</if>
- <if test="idfa != null">idfa,</if>
- <if test="oaid != null">oaid,</if>
- <if test="androidId != null">android_id,</if>
- <if test="akey != null">akey,</if>
- <if test="aType != null">a_type,</if>
- <if test="aValue != null">a_value,</if>
- <if test="joinType != null">join_type,</if>
- <if test="ip != null">ip,</if>
- <if test="ua != null">ua,</if>
- <if test="osVersion != null">os_version,</if>
- <if test="model != null">model,</if>
- <if test="osType != null">os_type,</if>
- <if test="deviceId != null">device_id,</if>
- <if test="aid != null">aid,</if>
- <if test="pid != null">pid,</if>
- <if test="uid != null">uid,</if>
- <if test="clickId != null">click_id,</if>
- <if test="callbackUrl != null">callback_url,</if>
- <if test="advType != null">adv_type,</if>
- <if test="cmdType != null">cmd_type,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="userId != null">user_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="imei != null">#{imei},</if>
- <if test="idfa != null">#{idfa},</if>
- <if test="oaid != null">#{oaid},</if>
- <if test="androidId != null">#{androidId},</if>
- <if test="akey != null">#{akey},</if>
- <if test="aType != null">#{aType},</if>
- <if test="aValue != null">#{aValue},</if>
- <if test="joinType != null">#{joinType},</if>
- <if test="ip != null">#{ip},</if>
- <if test="ua != null">#{ua},</if>
- <if test="osVersion != null">#{osVersion},</if>
- <if test="model != null">#{model},</if>
- <if test="osType != null">#{osType},</if>
- <if test="deviceId != null">#{deviceId},</if>
- <if test="aid != null">#{aid},</if>
- <if test="pid != null">#{pid},</if>
- <if test="uid != null">#{uid},</if>
- <if test="clickId != null">#{clickId},</if>
- <if test="callbackUrl != null">#{callbackUrl},</if>
- <if test="advType != null">#{advType},</if>
- <if test="cmdType != null">#{cmdType},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="userId != null">#{userId},</if>
- </trim>
- </insert>
- <update id="updateFsAdvSem" parameterType="FsAdvSem">
- update fs_adv_sem
- <trim prefix="SET" suffixOverrides=",">
- <if test="imei != null">imei = #{imei},</if>
- <if test="idfa != null">idfa = #{idfa},</if>
- <if test="oaid != null">oaid = #{oaid},</if>
- <if test="androidId != null">android_id = #{androidId},</if>
- <if test="akey != null">akey = #{akey},</if>
- <if test="aType != null">a_type = #{aType},</if>
- <if test="aValue != null">a_value = #{aValue},</if>
- <if test="joinType != null">join_type = #{joinType},</if>
- <if test="ip != null">ip = #{ip},</if>
- <if test="ua != null">ua = #{ua},</if>
- <if test="osVersion != null">os_version = #{osVersion},</if>
- <if test="model != null">model = #{model},</if>
- <if test="osType != null">os_type = #{osType},</if>
- <if test="deviceId != null">device_id = #{deviceId},</if>
- <if test="aid != null">aid = #{aid},</if>
- <if test="pid != null">pid = #{pid},</if>
- <if test="uid != null">uid = #{uid},</if>
- <if test="clickId != null">click_id = #{clickId},</if>
- <if test="callbackUrl != null">callback_url = #{callbackUrl},</if>
- <if test="advType != null">adv_type = #{advType},</if>
- <if test="cmdType != null">cmd_type = #{cmdType},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="userId != null">user_id = #{userId},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteFsAdvSemById" parameterType="Long">
- delete from fs_adv_sem where id = #{id}
- </delete>
- <delete id="deleteFsAdvSemByIds" parameterType="String">
- delete from fs_adv_sem where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|