|
- <?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.iformall.mapper.WxUserVisitMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxUserVisit">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
- <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
- <result column="ref_date" jdbcType="VARCHAR" property="refDate" />
- <result column="day_date" jdbcType="TIMESTAMP" property="dayDate" />
- <result column="session_cnt" jdbcType="INTEGER" property="sessionCnt" />
- <result column="visit_pv" jdbcType="INTEGER" property="visitPv" />
- <result column="visit_uv" jdbcType="INTEGER" property="visitUv" />
- <result column="visit_uv_new" jdbcType="INTEGER" property="visitUvNew" />
- <result column="stay_time_uv" jdbcType="VARCHAR" property="stayTimeUv" />
- <result column="stay_time_session" jdbcType="VARCHAR" property="stayTimeSession" />
- <result column="visit_depth" jdbcType="VARCHAR" property="visitDepth" />
- <result column="app_id" jdbcType="VARCHAR" property="appId" />
- <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`ref_date`,`day_date`,`session_cnt`,`visit_pv`,`visit_uv`,`visit_uv_new`,`stay_time_uv`,`stay_time_session`,`visit_depth`,`app_id`,`create_date`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 1
-
- <if test=" null != id ">
- and `id` = #{id}
-
- </if>
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
-
- <if test=" null != refDate ">
- and `ref_date` = #{refDate}
-
- </if>
-
- <if test=" null != dayDate ">
- and `day_date` = #{dayDate}
-
- </if>
-
- <if test=" null != sessionCnt ">
- and `session_cnt` = #{sessionCnt}
-
- </if>
-
- <if test=" null != visitPv ">
- and `visit_pv` = #{visitPv}
-
- </if>
-
- <if test=" null != visitUv ">
- and `visit_uv` = #{visitUv}
-
- </if>
-
- <if test=" null != visitUvNew ">
- and `visit_uv_new` = #{visitUvNew}
-
- </if>
-
- <if test=" null != stayTimeUv ">
- and `stay_time_uv` like concat('%', #{stayTimeUv},'%')
-
- </if>
-
- <if test=" null != stayTimeSession ">
- and `stay_time_session` like concat('%', #{stayTimeSession},'%')
-
- </if>
-
- <if test=" null != visitDepth ">
- and `visit_depth` like concat('%', #{visitDepth},'%')
-
- </if>
-
- <if test=" null != appId ">
- and `app_id` = #{appId}
-
- </if>
-
- <if test=" null != createDate ">
- and `create_date` = #{createDate}
-
- </if>
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns"> order by ${sortColumns} </if>
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxUserVisit" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_user_visit
- <include refid="dynamicWhereConditions" />
- </select>
-
- <select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo"
- parameterType="com.iformall.domain.dto.MarkingCouponDataReportDto">
- SELECT DATE_FORMAT(day_date,'%Y-%m-%d') as xTime,IFNULL(sum(visit_pv),0) as pv,IFNULL(sum(visit_uv),0) as uv
- from wx_user_visit
- where 1=1
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test="startTime != null">
- and day_date >= #{startTime}
- </if>
- <if test="endTime != null">
- and day_date <= #{endTime}
- </if>
-
- group by xTime
- <if test=" null != sortColumns"> order by ${sortColumns} </if>
- <if test=" null == sortColumns"> order by xTime desc </if>
- </select>
-
- <select id="touchUsersReportData" parameterType="com.iformall.domain.po.WxUserVisit" resultType="com.iformall.domain.vo.TouchUsersReportVo">
- SELECT DATE_FORMAT(day_date,'%m/%d') as xTime,IFNULL(sum(visit_pv),0) as pv,IFNULL(sum(visit_uv),0) as uv
- from wx_user_visit
- where 1=1
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test="startTime != null">
- and day_date >= #{startTime}
- </if>
- <if test="endTime != null">
- and day_date <= #{endTime}
- </if>
- group by xTime
- order by xTime desc
- </select>
-
- <select id="queryVisitUv" parameterType="com.iformall.domain.po.WxUserVisit" resultType="Long">
- select IFNULL(sum(visit_uv),0) from wx_user_visit where 1=1
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </if>
- <if test="startTime != null">
- and day_date >= #{startTime}
- </if>
- <if test="endTime != null">
- and day_date <= #{endTime}
- </if>
- </select>
-
- </mapper>
|