CmBrandLandingMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.caimei.modules.landing.mapper.CmBrandLandingMapper">
  6. <resultMap type="CmBrandLanding" id="CmBrandLandingResult">
  7. <result property="id" column="id" />
  8. <result property="authUserId" column="authUserId" />
  9. <result property="type" column="type" />
  10. <result property="levelType" column="levelType" />
  11. <result property="authorId" column="authorId" />
  12. <result property="headPcBanner" column="headPcBanner" />
  13. <result property="headAppBanner" column="headAppBanner" />
  14. <result property="jumpStatus" column="jumpStatus" />
  15. <result property="jumpPcPicture" column="jumpPcPicture" />
  16. <result property="jumpAppPicture" column="jumpAppPicture" />
  17. <result property="jumpLink" column="jumpLink" />
  18. <result property="title" column="title" />
  19. <result property="content" column="content" />
  20. <result property="video" column="video" />
  21. <result property="sort" column="sort" />
  22. <result property="pcStatus" column="pcStatus" />
  23. <result property="appStatus" column="appStatus" />
  24. <result property="delFlag" column="delFlag" />
  25. <result property="updateTime" column="updateTime" />
  26. <result property="addTime" column="addTime" />
  27. <result property="pv" column="pv"/>
  28. </resultMap>
  29. <sql id="selectCmBrandLandingVo">
  30. select a.id,
  31. a.authUserId,
  32. a.type,
  33. a.levelType,
  34. a.authorId,
  35. a.headPcBanner,
  36. a.headAppBanner,
  37. a.jumpStatus,
  38. a.jumpPcPicture,
  39. a.jumpAppPicture,
  40. a.jumpLink,
  41. a.jumpAppLink,
  42. a.title,
  43. a.content,
  44. a.video,
  45. a.sort,
  46. a.pcStatus,
  47. a.appStatus,
  48. a.delFlag,
  49. a.updateTime,
  50. a.addTime,
  51. a.productId,
  52. a.bookStatus,
  53. a.bookStartDate,
  54. a.bookEndDate,
  55. a.auditStatus,
  56. a.auditTime,
  57. a.failReason,
  58. a.publishSource
  59. </sql>
  60. <select id="selectCmBrandLandingList" parameterType="CmBrandLanding" resultMap="CmBrandLandingResult">
  61. <include refid="selectCmBrandLandingVo"/>
  62. <if test="statisticsType != null and statisticsType != ''">
  63. ,IFNULL((select sum(c.pv) from cm_praise_statistics c where c.delFlag = 0 and c.type = #{statisticsType} and a.id = c.authorId <if test="startPvCreateTime != null ">AND c.createTime >= #{startPvCreateTime} </if><if test="endPvCreateTime != null ">AND c.createTime <![CDATA[ <= ]]> #{endPvCreateTime} </if>), 0) as pv
  64. </if>
  65. from cm_brand_landing a
  66. <where>delFlag = 0
  67. <if test="id != null and id != ''">and id = #{id}</if>
  68. <if test="authUserId != null ">and authUserId = #{authUserId}</if>
  69. <if test="type != null ">and type = #{type}</if>
  70. <if test="levelType != null ">and levelType = #{levelType}</if>
  71. <if test="authorId != null ">and authorId = #{authorId}</if>
  72. <if test="headPcBanner != null and headPcBanner != ''">and headPcBanner = #{headPcBanner}</if>
  73. <if test="headAppBanner != null and headAppBanner != ''">and headAppBanner = #{headAppBanner}</if>
  74. <if test="jumpStatus != null ">and jumpStatus = #{jumpStatus}</if>
  75. <if test="jumpPcPicture != null and jumpPcPicture != ''">and jumpPcPicture = #{jumpPcPicture}</if>
  76. <if test="jumpAppPicture != null and jumpAppPicture != ''">and jumpAppPicture = #{jumpAppPicture}</if>
  77. <if test="jumpLink != null and jumpLink != ''"> and jumpLink = #{jumpLink}</if>
  78. <if test="title != null and title != ''"> and title = #{title}</if>
  79. <if test="content != null and content != ''"> and content = #{content}</if>
  80. <if test="video != null and video != ''"> and video = #{video}</if>
  81. <if test="sort != null "> and sort = #{sort}</if>
  82. <if test="pcStatus != null "> and pcStatus = #{pcStatus}</if>
  83. <if test="appStatus != null "> and appStatus = #{appStatus}</if>
  84. <if test="delFlag != null "> and delFlag = #{delFlag}</if>
  85. <if test="updateTime != null "> and updateTime = #{updateTime}</if>
  86. <if test="addTime != null "> and addTime = #{addTime}</if>
  87. <if test="publishSource != null "> and publishSource = #{publishSource}</if>
  88. </where>
  89. order by sort desc
  90. </select>
  91. <select id="findList" parameterType="CmBrandLanding" resultMap="CmBrandLandingResult">
  92. <include refid="selectCmBrandLandingVo"/>
  93. <if test="statisticsType != null and statisticsType != ''">
  94. ,IFNULL((select sum(c.pv) from cm_praise_statistics c where c.delFlag = 0 and c.type = #{statisticsType} and a.id = c.authorId <if test="startPvCreateTime != null ">AND c.createTime >= #{startPvCreateTime} </if><if test="endPvCreateTime != null ">AND c.createTime <![CDATA[ <= ]]> #{endPvCreateTime} </if>), 0) as pv
  95. </if>
  96. ,(select s.name from shop s where s.userId=a.authUserId) as shopName
  97. from cm_brand_landing a
  98. <where>delFlag = 0
  99. <if test="id != null and id != ''">and id = #{id}</if>
  100. <if test="authUserId != null ">and authUserId = #{authUserId}</if>
  101. <if test="type != null ">and type = #{type}</if>
  102. <if test="levelType != null ">and levelType = #{levelType}</if>
  103. <if test="authorId != null ">and authorId = #{authorId}</if>
  104. <if test="headPcBanner != null and headPcBanner != ''">and headPcBanner = #{headPcBanner}</if>
  105. <if test="headAppBanner != null and headAppBanner != ''">and headAppBanner = #{headAppBanner}</if>
  106. <if test="jumpStatus != null ">and jumpStatus = #{jumpStatus}</if>
  107. <if test="jumpPcPicture != null and jumpPcPicture != ''">and jumpPcPicture = #{jumpPcPicture}</if>
  108. <if test="jumpAppPicture != null and jumpAppPicture != ''">and jumpAppPicture = #{jumpAppPicture}</if>
  109. <if test="jumpLink != null and jumpLink != ''"> and jumpLink = #{jumpLink}</if>
  110. <if test="title != null and title != ''"> and title = #{title}</if>
  111. <if test="content != null and content != ''"> and content = #{content}</if>
  112. <if test="video != null and video != ''"> and video = #{video}</if>
  113. <if test="sort != null "> and sort = #{sort}</if>
  114. <if test="pcStatus != null "> and pcStatus = #{pcStatus}</if>
  115. <if test="appStatus != null "> and appStatus = #{appStatus}</if>
  116. <if test="delFlag != null "> and delFlag = #{delFlag}</if>
  117. <if test="updateTime != null "> and updateTime = #{updateTime}</if>
  118. <if test="addTime != null "> and addTime = #{addTime}</if>
  119. <if test="publishSource != null "> and publishSource = #{publishSource}</if>
  120. </where>
  121. order by pcStatus desc, sort desc ,addTime desc
  122. </select>
  123. <select id="selectCmBrandLandingById" parameterType="String" resultMap="CmBrandLandingResult">
  124. <include refid="selectCmBrandLandingVo"/>
  125. ,p.name productName,p.mainImage productImage
  126. FROM cm_brand_landing a
  127. left join product p on p.productId=a.productId
  128. where id = #{id} and delFlag = 0
  129. </select>
  130. <select id="getById" parameterType="CmBrandLanding" resultType="String">
  131. select id
  132. from cm_brand_landing AS cm_brand_landing
  133. <where> cm_brand_landing.delFlag = 0
  134. <if test="id != null and id != ''">
  135. and cm_brand_landing.id
  136. = #{id}
  137. </if>
  138. <if test="type != null and type != ''">
  139. and cm_brand_landing.type
  140. = #{type}
  141. </if>
  142. <if test="authUserId != null "> and cm_brand_landing.authUserId = #{authUserId}</if>
  143. <if test="levelType != null and levelType != ''">
  144. and cm_brand_landing.levelType = #{levelType}
  145. </if>
  146. <if test="authorId != null and authorId != ''"> and cm_brand_landing.authorId = #{authorId}</if>
  147. <if test="headPcBanner != null and headPcBanner != ''"> and cm_brand_landing.headPcBanner = #{headPcBanner}</if>
  148. <if test="headAppBanner != null and headAppBanner != ''"> and cm_brand_landing.headAppBanner = #{headAppBanner}</if>
  149. <if test="jumpStatus != null "> and cm_brand_landing.jumpStatus = #{jumpStatus}</if>
  150. <if test="jumpPcPicture != null and jumpPcPicture != ''"> and cm_brand_landing.jumpPcPicture = #{jumpPcPicture}</if>
  151. <if test="jumpAppPicture != null and jumpAppPicture != ''"> and cm_brand_landing.jumpAppPicture = #{jumpAppPicture}</if>
  152. <if test="jumpLink != null and jumpLink != ''"> and cm_brand_landing.jumpLink = #{jumpLink}</if>
  153. <if test="title != null and title != ''"> and cm_brand_landing.title = #{title}</if>
  154. <if test="content != null and content != ''"> and cm_brand_landing.content = #{content}</if>
  155. <if test="video != null and video != ''"> and cm_brand_landing.video = #{video}</if>
  156. <if test="sort != null "> and cm_brand_landing.sort = #{sort}</if>
  157. <if test="pcStatus != null "> and cm_brand_landing.pcStatus = #{pcStatus}</if>
  158. <if test="appStatus != null "> and cm_brand_landing.appStatus = #{appStatus}</if>
  159. <if test="delFlag != null "> and cm_brand_landing.delFlag = #{delFlag}</if>
  160. <if test="updateTime != null "> and cm_brand_landing.updateTime = #{updateTime}</if>
  161. <if test="addTime != null "> and cm_brand_landing.addTime = #{addTime}</if>
  162. </where>
  163. group by cm_brand_landing.id
  164. order by cm_brand_landing.addTime desc
  165. limit 0,1
  166. </select>
  167. <select id="findBigSort" resultType="java.lang.String">
  168. SELECT sort FROM cm_brand_landing ORDER BY sort DESC LIMIT 1
  169. </select>
  170. <select id="getLandingCount" resultType="int">
  171. SELECT count(1)
  172. FROM cm_brand_landing
  173. where auditStatus=2 and pcStatus!=0 and appStatus!=0
  174. AND bookStartDate <![CDATA[ >= ]]> #{bookStartDate} AND bookEndDate <![CDATA[ <= ]]> #{bookEndDate}
  175. <if test="type != null"> and type =#{type}</if>
  176. <if test="id != null"> and id !=#{id}</if>
  177. </select>
  178. <update id="updateSort">
  179. update cm_brand_landing set sort=#{sort}
  180. where id= #{id}
  181. </update>
  182. <insert id="insertCmBrandLanding" parameterType="CmBrandLanding" useGeneratedKeys="true" keyProperty="id">
  183. insert into cm_brand_landing
  184. <trim prefix="(" suffix=")" suffixOverrides=",">
  185. <if test="authUserId != null">authUserId,</if>
  186. <if test="type != null">type,</if>
  187. <if test="levelType != null "> levelType,</if>
  188. <if test="authorId != null "> authorId,</if>
  189. <if test="headPcBanner != null">headPcBanner,</if>
  190. <if test="headAppBanner != null">headAppBanner,</if>
  191. <if test="jumpStatus != null">jumpStatus,</if>
  192. <if test="jumpPcPicture != null">jumpPcPicture,</if>
  193. <if test="jumpAppPicture != null">jumpAppPicture,</if>
  194. <if test="jumpLink != null">jumpLink,</if>
  195. <if test="jumpAppLink != null">jumpAppLink,</if>
  196. <if test="title != null">title,</if>
  197. <if test="content != null">content,</if>
  198. <if test="video != null">video,</if>
  199. <if test="sort != null">sort,</if>
  200. <if test="pcStatus != null">pcStatus,</if>
  201. <if test="appStatus != null">appStatus,</if>
  202. <if test="delFlag != null">delFlag,</if>
  203. <if test="updateTime != null">updateTime,</if>
  204. <if test="addTime != null">addTime,</if>
  205. <if test="productId != null">productId,</if>
  206. <if test="bookStatus != null">bookStatus,</if>
  207. <if test="bookStartDate != null">bookStartDate,</if>
  208. <if test="bookEndDate != null">bookEndDate,</if>
  209. <if test="auditStatus != null">auditStatus,</if>
  210. <if test="auditTime != null">auditTime,</if>
  211. <if test="failReason != null and failReason != ''">failReason,</if>
  212. <if test="publishSource != null">publishSource,</if>
  213. </trim>
  214. <trim prefix="values (" suffix=")" suffixOverrides=",">
  215. <if test="authUserId != null">#{authUserId},</if>
  216. <if test="type != null">#{type},</if>
  217. <if test="levelType != null "> #{levelType},</if>
  218. <if test="authorId != null "> #{authorId},</if>
  219. <if test="headPcBanner != null">#{headPcBanner},</if>
  220. <if test="headAppBanner != null">#{headAppBanner},</if>
  221. <if test="jumpStatus != null">#{jumpStatus},</if>
  222. <if test="jumpPcPicture != null">#{jumpPcPicture},</if>
  223. <if test="jumpAppPicture != null">#{jumpAppPicture},</if>
  224. <if test="jumpLink != null">#{jumpLink},</if>
  225. <if test="jumpAppLink != null">#{jumpAppLink},</if>
  226. <if test="title != null">#{title},</if>
  227. <if test="content != null">#{content},</if>
  228. <if test="video != null">#{video},</if>
  229. <if test="sort != null">#{sort},</if>
  230. <if test="pcStatus != null">#{pcStatus},</if>
  231. <if test="appStatus != null">#{appStatus},</if>
  232. <if test="delFlag != null">#{delFlag},</if>
  233. <if test="updateTime != null">#{updateTime},</if>
  234. <if test="addTime != null">#{addTime},</if>
  235. <if test="productId != null">#{productId},</if>
  236. <if test="bookStatus != null">#{bookStatus},</if>
  237. <if test="bookStartDate != null">#{bookStartDate},</if>
  238. <if test="bookEndDate != null">#{bookEndDate},</if>
  239. <if test="auditStatus != null">#{auditStatus},</if>
  240. <if test="auditTime != null">#{auditTime},</if>
  241. <if test="failReason != null and failReason != ''">#{failReason},</if>
  242. <if test="publishSource != null">#{publishSource},</if>
  243. </trim>
  244. </insert>
  245. <update id="updateCmBrandLanding" parameterType="CmBrandLanding">
  246. update cm_brand_landing
  247. <trim prefix="SET" suffixOverrides=",">
  248. <if test="authUserId != null">authUserId = #{authUserId},</if>
  249. <if test="type != null">type = #{type},</if>
  250. <if test="levelType != null "> levelType = #{levelType},</if>
  251. <if test="authorId != null "> authorId = #{authorId},</if>
  252. <if test="headPcBanner != null">headPcBanner = #{headPcBanner},</if>
  253. <if test="headAppBanner != null">headAppBanner = #{headAppBanner},</if>
  254. <if test="jumpStatus != null">jumpStatus = #{jumpStatus},</if>
  255. <if test="jumpPcPicture != null">jumpPcPicture = #{jumpPcPicture},</if>
  256. <if test="jumpAppPicture != null">jumpAppPicture = #{jumpAppPicture},</if>
  257. <if test="jumpLink != null">jumpLink = #{jumpLink},</if>
  258. <if test="jumpAppLink != null">jumpAppLink = #{jumpAppLink},</if>
  259. <if test="title != null">title = #{title},</if>
  260. <if test="content != null">content = #{content},</if>
  261. <if test="video != null">video = #{video},</if>
  262. <if test="sort != null">sort = #{sort},</if>
  263. <if test="pcStatus != null">pcStatus = #{pcStatus},</if>
  264. <if test="appStatus != null">appStatus = #{appStatus},</if>
  265. <if test="delFlag != null">delFlag = #{delFlag},</if>
  266. <if test="updateTime != null">updateTime = #{updateTime},</if>
  267. <if test="addTime != null">addTime = #{addTime},</if>
  268. <if test="productId != null">productId = #{productId},</if>
  269. <if test="bookStatus != null">bookStatus = #{bookStatus},</if>
  270. <if test="bookStartDate != null">bookStartDate = #{bookStartDate},</if>
  271. <if test="bookEndDate != null">bookEndDate = #{bookEndDate},</if>
  272. <if test="auditStatus != null">auditStatus = #{auditStatus},</if>
  273. <if test="auditTime != null">auditTime = #{auditTime},</if>
  274. <if test="failReason != null and failReason != ''">failReason = #{failReason},</if>
  275. <if test="publishSource != null">publishSource = #{publishSource},</if>
  276. </trim>
  277. where id = #{id}
  278. </update>
  279. <delete id="deleteCmBrandLandingById" parameterType="String">
  280. delete from cm_brand_landing where id = #{id}
  281. </delete>
  282. <delete id="delCmBrandLandingByAuthorId" parameterType="String">
  283. delete from cm_brand_landing where authorId = #{authorId}
  284. </delete>
  285. <delete id="deleteCmBrandLandingByIds" parameterType="String">
  286. delete from cm_brand_landing where id in
  287. <foreach item="id" collection="array" open="(" separator="," close=")">
  288. #{id}
  289. </foreach>
  290. </delete>
  291. </mapper>