|
|
<?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.yoho.unions.dal.IUnionLogsDAO">
|
|
|
<resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UnionLogs">
|
|
|
<id column="id" property="id" jdbcType="INTEGER" />
|
|
|
<result column="app_id" property="appId" jdbcType="VARCHAR" />
|
|
|
<result column="udid" property="udid" jdbcType="VARCHAR" />
|
|
|
<result column="idfa" property="idfa" jdbcType="VARCHAR" />
|
|
|
<result column="imei" property="imei" jdbcType="VARCHAR" />
|
|
|
<result column="is_activate" property="isActivate" jdbcType="TINYINT" />
|
|
|
<result column="union_type" property="unionType" jdbcType="VARCHAR" />
|
|
|
<result column="add_params" property="addParams" jdbcType="VARCHAR" />
|
|
|
<result column="activate_params" property="activateParams"
|
|
|
jdbcType="VARCHAR" />
|
|
|
<result column="create_time" property="createTime" jdbcType="INTEGER" />
|
|
|
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
|
|
|
<result column="client_type" property="clientType" jdbcType="VARCHAR" />
|
|
|
<result column="td" property="td" jdbcType="VARCHAR" />
|
|
|
<result column="app_key" property="appKey" jdbcType="VARCHAR" />
|
|
|
<result column="interface_type" property="interfaceType" jdbcType="VARCHAR" />
|
|
|
<result column="union_name" property="unionName" jdbcType="VARCHAR" />
|
|
|
</resultMap>
|
|
|
<resultMap id="ActivateMap" type="com.yoho.service.model.union.response.ActivateDeviceIdRspBO">
|
|
|
<result column="union_type" property="unionType" jdbcType="VARCHAR" />
|
|
|
<result column="union_name" property="unionName" jdbcType="VARCHAR" />
|
|
|
<result column="idfa_count" property="idfaCount" jdbcType="INTEGER" />
|
|
|
<result column="imei_count" property="imeiCount" jdbcType="INTEGER" />
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List">
|
|
|
<resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UnionLogs">
|
|
|
<id column="id" property="id" jdbcType="INTEGER"/>
|
|
|
<result column="app_id" property="appId" jdbcType="VARCHAR"/>
|
|
|
<result column="udid" property="udid" jdbcType="VARCHAR"/>
|
|
|
<result column="idfa" property="idfa" jdbcType="VARCHAR"/>
|
|
|
<result column="imei" property="imei" jdbcType="VARCHAR"/>
|
|
|
<result column="is_activate" property="isActivate" jdbcType="TINYINT"/>
|
|
|
<result column="union_type" property="unionType" jdbcType="VARCHAR"/>
|
|
|
<result column="add_params" property="addParams" jdbcType="VARCHAR"/>
|
|
|
<result column="activate_params" property="activateParams"
|
|
|
jdbcType="VARCHAR"/>
|
|
|
<result column="create_time" property="createTime" jdbcType="INTEGER"/>
|
|
|
<result column="update_time" property="updateTime" jdbcType="INTEGER"/>
|
|
|
<result column="client_type" property="clientType" jdbcType="VARCHAR"/>
|
|
|
<result column="td" property="td" jdbcType="VARCHAR"/>
|
|
|
<result column="app_key" property="appKey" jdbcType="VARCHAR"/>
|
|
|
<result column="interface_type" property="interfaceType" jdbcType="VARCHAR"/>
|
|
|
<result column="union_name" property="unionName" jdbcType="VARCHAR"/>
|
|
|
</resultMap>
|
|
|
<resultMap id="ActivateMap" type="com.yoho.service.model.union.response.ActivateDeviceIdRspBO">
|
|
|
<result column="union_type" property="unionType" jdbcType="VARCHAR"/>
|
|
|
<result column="union_name" property="unionName" jdbcType="VARCHAR"/>
|
|
|
<result column="idfa_count" property="idfaCount" jdbcType="INTEGER"/>
|
|
|
<result column="imei_count" property="imeiCount" jdbcType="INTEGER"/>
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List">
|
|
|
id, app_id, udid, idfa, imei, is_activate, union_type, add_params,
|
|
|
activate_params,
|
|
|
create_time, update_time, client_type, td, app_key,interface_type,union_name
|
|
|
</sql>
|
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
|
|
parameterType="java.lang.Integer">
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from union_logs
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
|
|
parameterType="java.lang.Integer">
|
|
|
select
|
|
|
<include refid="Base_Column_List"/>
|
|
|
from union_logs
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
|
delete from union_logs
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</delete>
|
|
|
<insert id="insert" parameterType="com.yoho.unions.dal.model.UnionLogs">
|
|
|
<insert id="insert" parameterType="com.yoho.unions.dal.model.UnionLogs">
|
|
|
insert into union_logs (id, app_id, udid,
|
|
|
idfa, imei, is_activate,
|
|
|
union_type, add_params, activate_params,
|
...
|
...
|
@@ -54,7 +54,7 @@ |
|
|
#{activateParams,jdbcType=VARCHAR},
|
|
|
#{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER}, #{clientType}, #{td}, #{appKey}, #{interfaceType},#{unionName})
|
|
|
</insert>
|
|
|
<update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionLogs">
|
|
|
<update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionLogs">
|
|
|
update union_logs
|
|
|
set app_id = #{appId,jdbcType=VARCHAR},
|
|
|
udid = #{udid,jdbcType=VARCHAR},
|
...
|
...
|
@@ -71,79 +71,89 @@ |
|
|
union_name=#{unionName}
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
<update id="updateUnionLogs">
|
|
|
<update id="updateUnionLogs">
|
|
|
update union_logs set udid=#{udid}, idfa=#{idfa}, imei=#{imei}, is_activate=#{isActivate}, activate_params=#{activateParams}, update_time=#{updateTime} where id=#{id}
|
|
|
</update>
|
|
|
<select id="selectByClientType" resultMap="BaseResultMap">
|
|
|
select <include refid="Base_Column_List" />
|
|
|
from union_logs where update_time + 7776000 >= UNIX_TIMESTAMP()
|
|
|
<if test="clientType=='ios'">
|
|
|
and idfa=#{idfa}
|
|
|
</if>
|
|
|
<if test="clientType=='android'">
|
|
|
and imei=#{imei}
|
|
|
</if>
|
|
|
<if test="appKey!=null">
|
|
|
and app_key=#{appKey}
|
|
|
</if>
|
|
|
limit 1
|
|
|
</select>
|
|
|
<select id="selectUnionList" resultMap="BaseResultMap">
|
|
|
select <include refid="Base_Column_List" />
|
|
|
from union_logs where app_id = #{appId} and client_type=#{clientType} and union_type=#{unionType}
|
|
|
<if test="clientType == 'ios'">
|
|
|
and idfa=#{idfa}
|
|
|
</if>
|
|
|
<if test="clientType == 'android'">
|
|
|
and imei=#{imei}
|
|
|
</if>
|
|
|
and update_time + 7776000 >= UNIX_TIMESTAMP() limit 1
|
|
|
</select>
|
|
|
|
|
|
<select id="selectIOS" resultMap="BaseResultMap" parameterType="com.yoho.unions.dal.model.UnionLogs">
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from union_logs
|
|
|
where app_id = #{appId,jdbcType=VARCHAR} and
|
|
|
idfa = #{idfa,jdbcType=VARCHAR} and
|
|
|
client_type=#{clientType}
|
|
|
<if test="appKey!=null">
|
|
|
and app_key=#{appKey}
|
|
|
</if>
|
|
|
and union_type=#{unionType} limit 1
|
|
|
</select>
|
|
|
<select id="selectAndroid" resultMap="BaseResultMap" parameterType="com.yoho.unions.dal.model.UnionLogs">
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from union_logs
|
|
|
where app_id = #{appId,jdbcType=VARCHAR} and
|
|
|
imei = #{imei,jdbcType=VARCHAR} and
|
|
|
client_type=#{clientType} and union_type=#{unionType}
|
|
|
<if test="appKey!=null">
|
|
|
and app_key=#{appKey}
|
|
|
</if>
|
|
|
limit 1
|
|
|
</select>
|
|
|
<select id="selectListCountByParam" resultType="java.lang.Integer" parameterType="com.yoho.service.model.union.request.ActivateDeviceIdReqBO">
|
|
|
select count(DISTINCT union_type)
|
|
|
from union_logs where 1=1
|
|
|
<if test="interfaceType != null and interfaceType !='' " >
|
|
|
and interface_type=#{interfaceType}
|
|
|
</if>
|
|
|
<if test="activateTimeStr != null and activateTimeStr>0" >
|
|
|
and create_time>=#{activateTimeStr,jdbcType=INTEGER} and create_time-777600 <=#{activateTimeStr,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="selectListByParam" resultMap="ActivateMap" parameterType="com.yoho.service.model.union.request.ActivateDeviceIdReqBO">
|
|
|
select union_type,union_name,count(idfa) as idfa_count,count(imei) as imei_count
|
|
|
from union_logs
|
|
|
where 1=1
|
|
|
<if test="interfaceType != null and interfaceType !='' " >
|
|
|
and interface_type=#{interfaceType}
|
|
|
</if>
|
|
|
<if test="activateTimeStr != null and activateTimeStr>0" >
|
|
|
and create_time>=#{activateTimeStr,jdbcType=INTEGER} and create_time-777600 <=#{activateTimeStr,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
group by union_type limit #{start,jdbcType=INTEGER}, #{size,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
<select id="selectByClientType" resultMap="BaseResultMap">
|
|
|
select
|
|
|
<include refid="Base_Column_List"/>
|
|
|
from union_logs where update_time + 7776000 >= UNIX_TIMESTAMP()
|
|
|
<if test="clientType=='ios'">
|
|
|
and idfa=#{idfa}
|
|
|
</if>
|
|
|
<if test="clientType=='android'">
|
|
|
and imei=#{imei}
|
|
|
</if>
|
|
|
<if test="appKey!=null">
|
|
|
and app_key=#{appKey}
|
|
|
</if>
|
|
|
limit 1
|
|
|
</select>
|
|
|
<select id="selectUnionList" resultMap="BaseResultMap">
|
|
|
select
|
|
|
<include refid="Base_Column_List"/>
|
|
|
from union_logs where app_id = #{appId} and client_type=#{clientType} and union_type=#{unionType}
|
|
|
<if test="clientType == 'ios'">
|
|
|
and idfa=#{idfa}
|
|
|
</if>
|
|
|
<if test="clientType == 'android'">
|
|
|
and imei=#{imei}
|
|
|
</if>
|
|
|
and update_time + 7776000 >= UNIX_TIMESTAMP() limit 1
|
|
|
</select>
|
|
|
|
|
|
<select id="selectIOS" resultMap="BaseResultMap" parameterType="com.yoho.unions.dal.model.UnionLogs">
|
|
|
select
|
|
|
<include refid="Base_Column_List"/>
|
|
|
from union_logs
|
|
|
where app_id = #{appId,jdbcType=VARCHAR} and
|
|
|
idfa = #{idfa,jdbcType=VARCHAR} and
|
|
|
client_type=#{clientType}
|
|
|
<if test="appKey!=null">
|
|
|
and app_key=#{appKey}
|
|
|
</if>
|
|
|
and union_type=#{unionType} limit 1
|
|
|
</select>
|
|
|
<select id="selectAndroid" resultMap="BaseResultMap" parameterType="com.yoho.unions.dal.model.UnionLogs">
|
|
|
select
|
|
|
<include refid="Base_Column_List"/>
|
|
|
from union_logs
|
|
|
where app_id = #{appId,jdbcType=VARCHAR} and
|
|
|
imei = #{imei,jdbcType=VARCHAR} and
|
|
|
client_type=#{clientType} and union_type=#{unionType}
|
|
|
<if test="appKey!=null">
|
|
|
and app_key=#{appKey}
|
|
|
</if>
|
|
|
limit 1
|
|
|
</select>
|
|
|
<select id="selectListCountByParam" resultType="java.lang.Integer"
|
|
|
parameterType="com.yoho.service.model.union.request.ActivateDeviceIdReqBO">
|
|
|
select count(DISTINCT union_type)
|
|
|
from union_logs where 1=1
|
|
|
<if test="interfaceType != null and interfaceType !='' ">
|
|
|
and interface_type=#{interfaceType}
|
|
|
</if>
|
|
|
<if test="activateTimeStr != null and activateTimeStr>0">
|
|
|
and create_time>=#{activateTimeStr,jdbcType=INTEGER} and create_time-86400 <=#{activateTimeStr,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
<if test="unionType !=null and unionType !='' ">
|
|
|
and union_type = #{unionType}
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="selectListByParam" resultMap="ActivateMap"
|
|
|
parameterType="com.yoho.service.model.union.request.ActivateDeviceIdReqBO">
|
|
|
select union_type,union_name,count(idfa) as idfa_count,count(imei) as imei_count
|
|
|
from union_logs
|
|
|
where 1=1
|
|
|
<if test="interfaceType != null and interfaceType !='' ">
|
|
|
and interface_type=#{interfaceType}
|
|
|
</if>
|
|
|
<if test="activateTimeStr != null and activateTimeStr>0">
|
|
|
and create_time>=#{activateTimeStr,jdbcType=INTEGER} and create_time-86400 <=#{activateTimeStr,jdbcType=INTEGER}
|
|
|
</if>
|
|
|
<if test="unionType !=null and unionType !='' ">
|
|
|
and union_type = #{unionType}
|
|
|
</if>
|
|
|
group by union_type limit #{start,jdbcType=INTEGER}, #{size,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
</mapper> |
|
|
\ No newline at end of file |
...
|
...
|
|