RoosInformationMapper.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  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.user.mapper.RoosInformationMapper">
  4. <select id="selIsClick" resultType="integer">
  5. SELECT isClick FROM cm_roos_information cri
  6. left join cm_shop_product csp on csp.id = cri.shopProductId
  7. left join cm_shop_statistics css on css.id = csp.statisticsId
  8. <if test="infoId != null">
  9. LEFT JOIN cm_shop_info csi ON csi.shopProductId = csp.id
  10. </if>
  11. <if test="keyword != null and keyword != ''">
  12. left join shop s on s.shopId = cri.shopId
  13. LEFT JOIN cm_shop_keyword csk ON csk.shopProductId = csp.id
  14. left join cm_user_search_frequency cusf on cusf.id = csk.searchId
  15. </if>
  16. <where>
  17. cri.IP = #{IP} and cri.createTime LIKE concat('%',#{createTime},'%')
  18. <if test="shopId != null">
  19. and css.shopId = #{shopId}
  20. </if>
  21. <if test="productId != null">
  22. and csp.productId = #{productId}
  23. </if>
  24. <if test="infoId != null">
  25. and csi.status = 0
  26. and csi.infoId = #{infoId}
  27. </if>
  28. <if test="keyword != null and keyword != ''">
  29. and ((csk.status = 0 and cusf.keyword like concat('%',#{keyword},'%') ) or s.name like concat('%',#{keyword},'%'))
  30. </if>
  31. </where>
  32. </select>
  33. <select id="getShopStatus" resultType="java.lang.Integer">
  34. select csp.status
  35. from cm_shop_statistics css
  36. left join cm_shop_product csp on csp.statisticsId = css.id
  37. <if test="infoId != null">
  38. LEFT JOIN cm_shop_info csi ON csi.shopProductId = csp.id
  39. </if>
  40. <if test="keyword != null and keyword != ''">
  41. left join shop s on s.shopId = css.shopId
  42. LEFT JOIN cm_shop_keyword csk ON csk.shopProductId = csp.id
  43. left join cm_user_search_frequency cusf on cusf.id = csk.searchId
  44. </if>
  45. <where>
  46. css.delFlag = 0 AND csp.delFlag = 0
  47. <if test="shopId != null">
  48. and css.shopId = #{shopId}
  49. </if>
  50. <if test="productId != null">
  51. and csp.productId = #{productId}
  52. </if>
  53. <if test="infoId != null">
  54. and csi.status = 0
  55. and csi.infoId = #{infoId}
  56. </if>
  57. <if test="keyword != null and keyword != ''">
  58. and (csk.status = 0 and cusf.keyword like concat('%',#{keyword},'%') ) or s.name like concat('%',#{keyword},'%')
  59. </if>
  60. </where>
  61. limit 1
  62. </select>
  63. <select id="getShopProductIds" resultType="java.lang.Integer">
  64. SELECT
  65. csp.productId
  66. FROM cm_shop_product csp
  67. LEFT JOIN cm_shop_statistics css ON css.id = csp.statisticsId
  68. WHERE css.shopId = #{shopId} AND csp.delFlag = 0
  69. </select>
  70. <select id="getShopAdvert" resultType="com.caimei365.user.model.vo.cmShopAdvertisingImage">
  71. select csa.* from cm_shop_advertisingImage csa
  72. left join cm_shop_statistics cps on csa.shopId = cps.shopId
  73. where cps.status = 0 and csa.status = 0 and csa.delFlag = 0
  74. <if test="shopIds.size()>0">
  75. and csa.shopId in
  76. <foreach collection="shopIds" item="shopId" open="(" separator="," close=")">
  77. #{shopId}
  78. </foreach>
  79. </if>
  80. order by csa.sort asc, csa.addTime desc
  81. </select>
  82. <select id="getShopPop" resultType="com.caimei365.user.model.vo.CmShopPopUpVo">
  83. SELECT
  84. csp.id,
  85. css.shopId,
  86. csp.image,
  87. csp.guidingOne,
  88. csp.guidingTwo,
  89. csp.addTime
  90. FROM cm_shop_popUp csp
  91. left join cm_shop_product cspd on cspd.id = csp.shopProductId
  92. left join cm_shop_statistics css on cspd.statisticsId = css.id
  93. <if test="infoId != null">
  94. LEFT JOIN cm_shop_info csi ON csi.shopProductId = cspd.id
  95. </if>
  96. <if test="keyword != null and keyword != ''">
  97. LEFT JOIN cm_shop_keyword csk ON csk.shopId = cspd.id
  98. left join cm_user_search_frequency cusf on cusf.id = csk.searchId
  99. </if>
  100. <where>
  101. css.status = 0 and cspd.status = 0 and cspd.delFlag = 0
  102. <if test="productId != null">
  103. and cspd.productId = #{productId}
  104. </if>
  105. <if test="infoId != null">
  106. and csi.status = 0
  107. and csi.infoId = #{infoId}
  108. </if>
  109. <if test="keyword != null and keyword != ''">
  110. and csk.status = 0
  111. and cusf.keyword like concat('%',#{keyword},'%')
  112. </if>
  113. </where>
  114. limit 1
  115. </select>
  116. <select id="getProductPop" resultType="com.caimei365.user.model.vo.CmShopPopUpVo">
  117. SELECT
  118. csp.id,
  119. css.shopId,
  120. csp.image,
  121. csp.guidingOne,
  122. csp.guidingTwo,
  123. csp.addTime
  124. FROM cm_shop_popUp csp
  125. left join cm_shop_product cspd on cspd.id = csp.shopProductId
  126. left join cm_shop_statistics css on css.id = cspd.statisticsId
  127. where css.shopId = #{shopId}
  128. AND cspd.delFlag = 0
  129. limit 1
  130. </select>
  131. <insert id="insRoosInformation">
  132. INSERT INTO cm_roos_information
  133. (
  134. IP,
  135. shopId,
  136. <if test="consultName != null and consultName != ''">
  137. consultName,
  138. </if>
  139. <if test="consultMobile != null and consultMobile != ''">
  140. consultMobile,
  141. </if>
  142. isClick,
  143. createTime
  144. )
  145. VALUES(
  146. #{ip},
  147. #{shopId},
  148. <if test="consultName != null and consultName != ''">
  149. #{consultName},
  150. </if>
  151. <if test="consultMobile != null and consultMobile != ''">
  152. #{consultMobile},
  153. </if>
  154. #{isClick},
  155. #{createTime}
  156. )
  157. </insert>
  158. <select id="getShopId" resultType="java.lang.Integer">
  159. select shopId from cm_shop_statistics where status = 0 and delFlag = 0
  160. </select>
  161. <select id="getShopProductId" resultType="java.lang.Integer">
  162. select productId from product where shopId = #{shopId}
  163. </select>
  164. <select id="getShopInfoId" resultType="java.lang.Integer">
  165. select
  166. csi.infoId
  167. FROM cm_shop_info csi
  168. LEFT JOIN cm_shop_product csp ON csp.id = csi.shopProductId
  169. LEFT JOIN cm_shop_statistics css ON css.id = csp.statisticsId
  170. WHERE css.shopId = #{shopId}
  171. AND csi.status = 0 AND csi.delFlag = 0
  172. AND csp.status = 0 AND csp.delFlag = 0
  173. AND css.status = 0 AND css.delFlag = 0
  174. </select>
  175. <select id="getShopKeyword" resultType="java.lang.String">
  176. SELECT cusf.keyword
  177. FROM cm_shop_keyword csk
  178. LEFT JOIN cm_user_search_frequency cusf ON cusf.id = csk.searchId
  179. LEFT JOIN cm_shop_product csp ON csp.id = csk.shopProductId
  180. LEFT JOIN cm_shop_statistics css ON css.id = csp.statisticsId
  181. WHERE css.shopId = #{shopId}
  182. AND csk.status = 0 AND csk.delFlag = 0
  183. AND csp.status = 0 AND csp.delFlag = 0
  184. AND css.status = 0 AND css.delFlag = 0
  185. </select>
  186. <select id="getBehavior" resultType="java.lang.Integer">
  187. SELECT recordID
  188. from cm_behavior_record
  189. <where>
  190. delFlag = 0 and accessDate = #{accessDate}
  191. <if test="pageType != null">
  192. and pageType = #{pageType}
  193. </if>
  194. <if test="pageType != 8">
  195. <if test="pagePath != null and pagePath != ''">
  196. and pagePath like concat('%',#{pagePath},'%')
  197. </if>
  198. </if>
  199. <if test="pageType == 8">
  200. and pageLabel = #{pagePath}
  201. </if>
  202. <if test="userId != 0">
  203. AND userID = #{userId}
  204. </if>
  205. <if test="userId == 0">
  206. AND IP = #{ip}
  207. </if>
  208. </where>
  209. </select>
  210. </mapper>