后台服务
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

169 linhas
5.4 KiB

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.iformall.mapper.WxUserVisitMapper">
  4. <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxUserVisit">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
  7. <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId"/>
  8. <result column="ref_date" jdbcType="VARCHAR" property="refDate" />
  9. <result column="day_date" jdbcType="TIMESTAMP" property="dayDate" />
  10. <result column="session_cnt" jdbcType="INTEGER" property="sessionCnt" />
  11. <result column="visit_pv" jdbcType="INTEGER" property="visitPv" />
  12. <result column="visit_uv" jdbcType="INTEGER" property="visitUv" />
  13. <result column="visit_uv_new" jdbcType="INTEGER" property="visitUvNew" />
  14. <result column="stay_time_uv" jdbcType="VARCHAR" property="stayTimeUv" />
  15. <result column="stay_time_session" jdbcType="VARCHAR" property="stayTimeSession" />
  16. <result column="visit_depth" jdbcType="VARCHAR" property="visitDepth" />
  17. <result column="app_id" jdbcType="VARCHAR" property="appId" />
  18. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  19. </resultMap>
  20. <sql id="allColumns">
  21. `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`
  22. </sql>
  23. <sql id="dynamicWhereConditions">
  24. where 1 = 1
  25. <if test=" null != id ">
  26. and `id` = #{id}
  27. </if>
  28. <if test=" null != tenantId and '' != tenantId">
  29. and `tenant_id` = #{tenantId}
  30. </if>
  31. <if test=" null != parentTenantId and '' != parentTenantId">
  32. and `parent_tenant_id` = #{parentTenantId}
  33. </if>
  34. <if test=" null != refDate ">
  35. and `ref_date` = #{refDate}
  36. </if>
  37. <if test=" null != dayDate ">
  38. and `day_date` = #{dayDate}
  39. </if>
  40. <if test=" null != sessionCnt ">
  41. and `session_cnt` = #{sessionCnt}
  42. </if>
  43. <if test=" null != visitPv ">
  44. and `visit_pv` = #{visitPv}
  45. </if>
  46. <if test=" null != visitUv ">
  47. and `visit_uv` = #{visitUv}
  48. </if>
  49. <if test=" null != visitUvNew ">
  50. and `visit_uv_new` = #{visitUvNew}
  51. </if>
  52. <if test=" null != stayTimeUv ">
  53. and `stay_time_uv` like concat('%', #{stayTimeUv},'%')
  54. </if>
  55. <if test=" null != stayTimeSession ">
  56. and `stay_time_session` like concat('%', #{stayTimeSession},'%')
  57. </if>
  58. <if test=" null != visitDepth ">
  59. and `visit_depth` like concat('%', #{visitDepth},'%')
  60. </if>
  61. <if test=" null != appId ">
  62. and `app_id` = #{appId}
  63. </if>
  64. <if test=" null != createDate ">
  65. and `create_date` = #{createDate}
  66. </if>
  67. <if test=" null != ids ">
  68. and id in
  69. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  70. #{idItem}
  71. </foreach>
  72. </if>
  73. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  74. </sql>
  75. <select id="findList" parameterType="com.iformall.domain.po.WxUserVisit" resultMap="BaseResultMap">
  76. select
  77. <include refid="allColumns"/>
  78. from wx_user_visit
  79. <include refid="dynamicWhereConditions" />
  80. </select>
  81. <select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo"
  82. parameterType="com.iformall.domain.dto.MarkingCouponDataReportDto">
  83. SELECT DATE_FORMAT(day_date,'%Y-%m-%d') as xTime,IFNULL(sum(visit_pv),0) as pv,IFNULL(sum(visit_uv),0) as uv
  84. from wx_user_visit
  85. where 1=1
  86. <if test=" null != tenantId and '' != tenantId">
  87. and `tenant_id` = #{tenantId}
  88. </if>
  89. <if test=" null != parentTenantId and '' != parentTenantId">
  90. and `parent_tenant_id` = #{parentTenantId}
  91. </if>
  92. <if test="startTime != null">
  93. and day_date &gt;= #{startTime}
  94. </if>
  95. <if test="endTime != null">
  96. and day_date &lt;= #{endTime}
  97. </if>
  98. group by xTime
  99. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  100. <if test=" null == sortColumns"> order by xTime desc </if>
  101. </select>
  102. <select id="touchUsersReportData" parameterType="com.iformall.domain.po.WxUserVisit" resultType="com.iformall.domain.vo.TouchUsersReportVo">
  103. SELECT DATE_FORMAT(day_date,'%m/%d') as xTime,IFNULL(sum(visit_pv),0) as pv,IFNULL(sum(visit_uv),0) as uv
  104. from wx_user_visit
  105. where 1=1
  106. <if test=" null != tenantId and '' != tenantId">
  107. and `tenant_id` = #{tenantId}
  108. </if>
  109. <if test=" null != parentTenantId and '' != parentTenantId">
  110. and `parent_tenant_id` = #{parentTenantId}
  111. </if>
  112. <if test="startTime != null">
  113. and day_date &gt;= #{startTime}
  114. </if>
  115. <if test="endTime != null">
  116. and day_date &lt;= #{endTime}
  117. </if>
  118. group by xTime
  119. order by xTime desc
  120. </select>
  121. <select id="queryVisitUv" parameterType="com.iformall.domain.po.WxUserVisit" resultType="Long">
  122. select IFNULL(sum(visit_uv),0) from wx_user_visit where 1=1
  123. <if test=" null != tenantId and '' != tenantId">
  124. and `tenant_id` = #{tenantId}
  125. </if>
  126. <if test=" null != parentTenantId and '' != parentTenantId">
  127. and `parent_tenant_id` = #{parentTenantId}
  128. </if>
  129. <if test="startTime != null">
  130. and day_date &gt;= #{startTime}
  131. </if>
  132. <if test="endTime != null">
  133. and day_date &lt;= #{endTime}
  134. </if>
  135. </select>
  136. </mapper>