You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

141 lines
4.3 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="ref_date" jdbcType="VARCHAR" property="refDate" />
  8. <result column="day_date" jdbcType="TIMESTAMP" property="dayDate" />
  9. <result column="session_cnt" jdbcType="INTEGER" property="sessionCnt" />
  10. <result column="visit_pv" jdbcType="INTEGER" property="visitPv" />
  11. <result column="visit_uv" jdbcType="INTEGER" property="visitUv" />
  12. <result column="visit_uv_new" jdbcType="INTEGER" property="visitUvNew" />
  13. <result column="stay_time_uv" jdbcType="VARCHAR" property="stayTimeUv" />
  14. <result column="stay_time_session" jdbcType="VARCHAR" property="stayTimeSession" />
  15. <result column="visit_depth" jdbcType="VARCHAR" property="visitDepth" />
  16. <result column="app_id" jdbcType="VARCHAR" property="appId" />
  17. <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
  18. </resultMap>
  19. <sql id="allColumns">
  20. `id`,`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`
  21. </sql>
  22. <sql id="dynamicWhereConditions">
  23. where 1 = 1
  24. <if test=" null != id ">
  25. and `id` = #{id}
  26. </if>
  27. <if test=" null != tenantId ">
  28. and `tenant_id` =#{tenantId}
  29. </if>
  30. <if test=" null != refDate ">
  31. and `ref_date` = #{refDate}
  32. </if>
  33. <if test=" null != dayDate ">
  34. and `day_date` = #{dayDate}
  35. </if>
  36. <if test=" null != sessionCnt ">
  37. and `session_cnt` = #{sessionCnt}
  38. </if>
  39. <if test=" null != visitPv ">
  40. and `visit_pv` = #{visitPv}
  41. </if>
  42. <if test=" null != visitUv ">
  43. and `visit_uv` = #{visitUv}
  44. </if>
  45. <if test=" null != visitUvNew ">
  46. and `visit_uv_new` = #{visitUvNew}
  47. </if>
  48. <if test=" null != stayTimeUv ">
  49. and `stay_time_uv` like concat('%', #{stayTimeUv},'%')
  50. </if>
  51. <if test=" null != stayTimeSession ">
  52. and `stay_time_session` like concat('%', #{stayTimeSession},'%')
  53. </if>
  54. <if test=" null != visitDepth ">
  55. and `visit_depth` like concat('%', #{visitDepth},'%')
  56. </if>
  57. <if test=" null != appId ">
  58. and `app_id` = #{appId}
  59. </if>
  60. <if test=" null != createDate ">
  61. and `create_date` = #{createDate}
  62. </if>
  63. <if test=" null != ids ">
  64. and id in
  65. <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
  66. #{idItem}
  67. </foreach>
  68. </if>
  69. <if test=" null != sortColumns"> order by ${sortColumns} </if>
  70. </sql>
  71. <select id="findList" parameterType="com.iformall.domain.po.WxUserVisit" resultMap="BaseResultMap">
  72. select <include refid="allColumns" /> from wx_user_visit
  73. <include refid="dynamicWhereConditions" />
  74. </select>
  75. <select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="hashmap">
  76. SELECT DATE_FORMAT(day_date,'%Y-%m-%d') as xTime,visit_pv as pv,visit_uv as uv
  77. from wx_user_visit
  78. where tenant_id=#{tenantId}
  79. <if test="startTime != null">
  80. and day_date &gt;= #{startTime}
  81. </if>
  82. <if test="endTime != null">
  83. and day_date &lt;= #{endTime}
  84. </if>
  85. order by day_date desc
  86. </select>
  87. <select id="touchUsersReportData" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="hashmap">
  88. SELECT DATE_FORMAT(day_date,'%m/%d') as xTime,visit_pv as pv,visit_uv as uv
  89. from wx_user_visit
  90. where tenant_id=#{tenantId}
  91. <if test="startTime != null">
  92. and day_date &gt;= #{startTime}
  93. </if>
  94. <if test="endTime != null">
  95. and day_date &lt;= #{endTime}
  96. </if>
  97. order by day_date desc
  98. </select>
  99. <select id="queryVisitUv" resultType="Long" parameterType="hashmap">
  100. select count(visit_uv) from wx_user_visit where tenant_id=#{tenantId}
  101. <if test="startTime != null">
  102. and day_date &gt;= #{startTime}
  103. </if>
  104. <if test="endTime != null">
  105. and day_date &lt;= #{endTime}
  106. </if>
  107. </select>
  108. </mapper>