CmBehaciorRecordDao.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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.caimei365.manager.dao.user.CmBehaviorRecordDao">
  4. <sql id="behaviorRecord">
  5. b.recordID,
  6. b.IP as ip,
  7. b.userID as userId,
  8. b.pagePath,
  9. b.pageType,
  10. b.pageLabel,
  11. b.productID as productId,
  12. b.accessTime,
  13. b.accessDate
  14. </sql>
  15. <select id="findList" resultType="com.caimei365.manager.entity.caimei.CmBehaviorRecord">
  16. SELECT
  17. IP as ip,
  18. userID as userId,
  19. clubID as clubId,
  20. lastAccessTime,
  21. companyType,
  22. corporateName,
  23. contacts,
  24. phoneNumber,
  25. spName,
  26. number as numbers,
  27. consultName,
  28. consultMobile,
  29. productID,
  30. accessTime,
  31. accessDuration,
  32. accessDate,
  33. accessClient,
  34. region,
  35. label,
  36. relevanceShop,
  37. addTime
  38. FROM cm_behavior_record_index
  39. <where>
  40. delFlag = 0
  41. <if test="ip != null and ip != ''">
  42. AND IP = #{ip}
  43. </if>
  44. <if test="corporateName != null and corporateName != ''">
  45. AND corporateName like concat('%',#{corporateName},'%')
  46. </if>
  47. <if test="companyType != null and companyType != ''">
  48. AND companyType = #{companyType}
  49. </if>
  50. <if test="accessClient != null and accessClient != ''">
  51. AND accessClient =#{accessClient}
  52. </if>
  53. <if test="contacts != null and contacts != ''">
  54. AND contacts = #{contacts}
  55. </if>
  56. <if test="phoneNumber != null and phoneNumber != ''">
  57. AND phoneNumber = #{phoneNumber}
  58. </if>
  59. <if test="spName != null and spName != ''">
  60. AND spName = #{spName}
  61. </if>
  62. <if test="relevanceShop != null and relevanceShop != ''">
  63. AND relevanceShop like concat('%',#{relevanceShop},'%')
  64. <if test="behaviorType == 2">
  65. or behaviorType = #{behaviorType}
  66. </if>
  67. </if>
  68. <if test="labels != null and labels.size > 0">
  69. AND
  70. <foreach collection="labels" open="(" close=")" separator="or" item="label">
  71. label like concat('%',#{label},'%')
  72. </foreach>
  73. </if>
  74. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  75. AND accessDate between #{startTime} and #{endTime}
  76. </if>
  77. </where>
  78. ORDER BY accessTime DESC
  79. </select>
  80. <select id="findListToday" resultType="com.caimei365.manager.entity.caimei.CmBehaviorRecord">
  81. SELECT
  82. IP as ip,
  83. userID as userId,
  84. clubID as clubId,
  85. lastAccessTime,
  86. companyType,
  87. corporateName,
  88. contacts,
  89. phoneNumber,
  90. spName,
  91. number as numbers,
  92. consultName,
  93. consultMobile,
  94. accessTime,
  95. accessDuration,
  96. accessDate,
  97. accessClient,
  98. region,
  99. relevanceShop,
  100. label,
  101. relevanceShop,
  102. addTime
  103. FROM cm_behavior_record_today
  104. <where>
  105. <if test="ip != null and ip != ''">
  106. AND IP = #{ip}
  107. </if>
  108. <if test="corporateName != null and corporateName != ''">
  109. AND corporateName like concat('%',#{corporateName},'%')
  110. </if>
  111. <if test="companyType != null and companyType != ''">
  112. AND companyType = #{companyType}
  113. </if>
  114. <if test="accessClient != null and accessClient != ''">
  115. AND accessClient =#{accessClient}
  116. </if>
  117. <if test="contacts != null and contacts != ''">
  118. AND contacts = #{contacts}
  119. </if>
  120. <if test="phoneNumber != null and phoneNumber != ''">
  121. AND phoneNumber = #{phoneNumber}
  122. </if>
  123. <if test="spName != null and spName != ''">
  124. AND spName = #{spName}
  125. </if>
  126. <if test="relevanceShop != null and relevanceShop != ''">
  127. AND relevanceShop like concat('%',#{relevanceShop},'%')
  128. </if>
  129. <if test="labels != null and labels.size > 0">
  130. AND
  131. <foreach collection="labels" open="(" close=")" separator="or" item="label">
  132. label like concat('%',#{label},'%')
  133. </foreach>
  134. </if>
  135. <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
  136. AND accessDate between #{startTime} and #{endTime}
  137. </if>
  138. </where>
  139. ORDER BY accessTime DESC
  140. </select>
  141. <select id="selRegion" resultType="com.caimei365.manager.entity.caimei.CmBehaviorRecord">
  142. SELECT * FROM cm_behavior_record_ref where accessTime like concat('%',#{accessDate},'%')
  143. </select>
  144. <select id="recordList" resultType="com.caimei365.manager.entity.caimei.CmBehaviorRecord">
  145. SELECT
  146. <include refid="behaviorRecord"/>
  147. ,b.accessDuration,
  148. b.accessSource,
  149. b.accessClient,
  150. u.userIdentity,
  151. c.name,
  152. c.clubId,
  153. c.linkMan,
  154. c.contractMobile,
  155. s.name AS sname,
  156. s.linkMan AS slinkMan,
  157. s.contractMobile AS sncontractMobile,
  158. p.name AS productName,
  159. p.mainImage AS productImage,
  160. pt.pagetype AS pageTypes
  161. FROM cm_behavior_record b
  162. LEFT JOIN USER u ON b.userID = u.userID
  163. LEFT JOIN club c ON b.userID = c.userID
  164. LEFT JOIN shop s ON b.userID = s.userID
  165. LEFT JOIN product p ON b.productID = p.productID
  166. LEFT JOIN cm_page_type pt ON b.pageType = pt.id
  167. <where>
  168. b.accessDate = #{accessDate} AND b.IP != '106.55.202.118' AND b.delFlag = 0
  169. <if test="userId != null">
  170. AND b.userID = #{userId} AND b.IP = #{ip}
  171. </if>
  172. </where>
  173. ORDER BY accessTime DESC
  174. </select>
  175. <select id="searchList" resultType="com.caimei365.manager.entity.caimei.RetuenEntity">
  176. select id , keyword as value from cm_user_search_frequency where trueStatus = 1
  177. </select>
  178. <select id="behaviorShopNameList" resultType="com.caimei365.manager.entity.caimei.CmBehaviorRecord">
  179. SELECT cbs.recordID, cbs.shopID, s.name FROM cm_behavior_shopId cbs LEFT JOIN shop s ON cbs.shopID = s.shopID
  180. </select>
  181. </mapper>