CmBrandLandingMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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. </sql>
  52. <select id="selectCmBrandLandingList" parameterType="CmBrandLanding" resultMap="CmBrandLandingResult">
  53. <include refid="selectCmBrandLandingVo"/>
  54. <if test="statisticsType != null and statisticsType != ''">
  55. ,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
  56. </if>
  57. from cm_brand_landing a
  58. <where>delFlag = 0
  59. <if test="id != null and id != ''">and id = #{id}</if>
  60. <if test="authUserId != null ">and authUserId = #{authUserId}</if>
  61. <if test="type != null ">and type = #{type}</if>
  62. <if test="levelType != null ">and levelType = #{levelType}</if>
  63. <if test="authorId != null ">and authorId = #{authorId}</if>
  64. <if test="headPcBanner != null and headPcBanner != ''">and headPcBanner = #{headPcBanner}</if>
  65. <if test="headAppBanner != null and headAppBanner != ''">and headAppBanner = #{headAppBanner}</if>
  66. <if test="jumpStatus != null ">and jumpStatus = #{jumpStatus}</if>
  67. <if test="jumpPcPicture != null and jumpPcPicture != ''">and jumpPcPicture = #{jumpPcPicture}</if>
  68. <if test="jumpAppPicture != null and jumpAppPicture != ''">and jumpAppPicture = #{jumpAppPicture}</if>
  69. <if test="jumpLink != null and jumpLink != ''"> and jumpLink = #{jumpLink}</if>
  70. <if test="title != null and title != ''"> and title = #{title}</if>
  71. <if test="content != null and content != ''"> and content = #{content}</if>
  72. <if test="video != null and video != ''"> and video = #{video}</if>
  73. <if test="sort != null "> and sort = #{sort}</if>
  74. <if test="pcStatus != null "> and pcStatus = #{pcStatus}</if>
  75. <if test="appStatus != null "> and appStatus = #{appStatus}</if>
  76. <if test="delFlag != null "> and delFlag = #{delFlag}</if>
  77. <if test="updateTime != null "> and updateTime = #{updateTime}</if>
  78. <if test="addTime != null "> and addTime = #{addTime}</if>
  79. </where>
  80. order by sort desc
  81. </select>
  82. <select id="findList" parameterType="CmBrandLanding" resultMap="CmBrandLandingResult">
  83. <include refid="selectCmBrandLandingVo"/>
  84. <if test="statisticsType != null and statisticsType != ''">
  85. ,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
  86. </if>
  87. from cm_brand_landing a
  88. <where>delFlag = 0
  89. <if test="id != null and id != ''">and id = #{id}</if>
  90. <if test="authUserId != null ">and authUserId = #{authUserId}</if>
  91. <if test="type != null ">and type = #{type}</if>
  92. <if test="levelType != null ">and levelType = #{levelType}</if>
  93. <if test="authorId != null ">and authorId = #{authorId}</if>
  94. <if test="headPcBanner != null and headPcBanner != ''">and headPcBanner = #{headPcBanner}</if>
  95. <if test="headAppBanner != null and headAppBanner != ''">and headAppBanner = #{headAppBanner}</if>
  96. <if test="jumpStatus != null ">and jumpStatus = #{jumpStatus}</if>
  97. <if test="jumpPcPicture != null and jumpPcPicture != ''">and jumpPcPicture = #{jumpPcPicture}</if>
  98. <if test="jumpAppPicture != null and jumpAppPicture != ''">and jumpAppPicture = #{jumpAppPicture}</if>
  99. <if test="jumpLink != null and jumpLink != ''"> and jumpLink = #{jumpLink}</if>
  100. <if test="title != null and title != ''"> and title = #{title}</if>
  101. <if test="content != null and content != ''"> and content = #{content}</if>
  102. <if test="video != null and video != ''"> and video = #{video}</if>
  103. <if test="sort != null "> and sort = #{sort}</if>
  104. <if test="pcStatus != null "> and pcStatus = #{pcStatus}</if>
  105. <if test="appStatus != null "> and appStatus = #{appStatus}</if>
  106. <if test="delFlag != null "> and delFlag = #{delFlag}</if>
  107. <if test="updateTime != null "> and updateTime = #{updateTime}</if>
  108. <if test="addTime != null "> and addTime = #{addTime}</if>
  109. </where>
  110. order by pcStatus desc, sort desc ,addTime desc
  111. </select>
  112. <select id="selectCmBrandLandingById" parameterType="String" resultMap="CmBrandLandingResult">
  113. <include refid="selectCmBrandLandingVo"/>
  114. from cm_brand_landing a
  115. where id = #{id} and delFlag = 0
  116. </select>
  117. <select id="getById" parameterType="CmBrandLanding" resultType="String">
  118. select id
  119. from cm_brand_landing AS cm_brand_landing
  120. <where> cm_brand_landing.delFlag = 0
  121. <if test="id != null and id != ''">
  122. and cm_brand_landing.id
  123. = #{id}
  124. </if>
  125. <if test="type != null and type != ''">
  126. and cm_brand_landing.type
  127. = #{type}
  128. </if>
  129. <if test="authUserId != null "> and cm_brand_landing.authUserId = #{authUserId}</if>
  130. <if test="levelType != null and levelType != ''">
  131. and cm_brand_landing.levelType = #{levelType}
  132. </if>
  133. <if test="authorId != null and authorId != ''"> and cm_brand_landing.authorId = #{authorId}</if>
  134. <if test="headPcBanner != null and headPcBanner != ''"> and cm_brand_landing.headPcBanner = #{headPcBanner}</if>
  135. <if test="headAppBanner != null and headAppBanner != ''"> and cm_brand_landing.headAppBanner = #{headAppBanner}</if>
  136. <if test="jumpStatus != null "> and cm_brand_landing.jumpStatus = #{jumpStatus}</if>
  137. <if test="jumpPcPicture != null and jumpPcPicture != ''"> and cm_brand_landing.jumpPcPicture = #{jumpPcPicture}</if>
  138. <if test="jumpAppPicture != null and jumpAppPicture != ''"> and cm_brand_landing.jumpAppPicture = #{jumpAppPicture}</if>
  139. <if test="jumpLink != null and jumpLink != ''"> and cm_brand_landing.jumpLink = #{jumpLink}</if>
  140. <if test="title != null and title != ''"> and cm_brand_landing.title = #{title}</if>
  141. <if test="content != null and content != ''"> and cm_brand_landing.content = #{content}</if>
  142. <if test="video != null and video != ''"> and cm_brand_landing.video = #{video}</if>
  143. <if test="sort != null "> and cm_brand_landing.sort = #{sort}</if>
  144. <if test="pcStatus != null "> and cm_brand_landing.pcStatus = #{pcStatus}</if>
  145. <if test="appStatus != null "> and cm_brand_landing.appStatus = #{appStatus}</if>
  146. <if test="delFlag != null "> and cm_brand_landing.delFlag = #{delFlag}</if>
  147. <if test="updateTime != null "> and cm_brand_landing.updateTime = #{updateTime}</if>
  148. <if test="addTime != null "> and cm_brand_landing.addTime = #{addTime}</if>
  149. </where>
  150. group by cm_brand_landing.id
  151. order by cm_brand_landing.addTime desc
  152. limit 0,1
  153. </select>
  154. <select id="findBigSort" resultType="java.lang.String">
  155. SELECT sort FROM cm_brand_landing ORDER BY sort DESC LIMIT 1
  156. </select>
  157. <update id="updateSort">
  158. update cm_brand_landing set sort=#{sort}
  159. where id= #{id}
  160. </update>
  161. <insert id="insertCmBrandLanding" parameterType="CmBrandLanding" useGeneratedKeys="true" keyProperty="id">
  162. insert into cm_brand_landing
  163. <trim prefix="(" suffix=")" suffixOverrides=",">
  164. <if test="authUserId != null">authUserId,</if>
  165. <if test="type != null">type,</if>
  166. <if test="levelType != null "> levelType,</if>
  167. <if test="authorId != null "> authorId,</if>
  168. <if test="headPcBanner != null">headPcBanner,</if>
  169. <if test="headAppBanner != null">headAppBanner,</if>
  170. <if test="jumpStatus != null">jumpStatus,</if>
  171. <if test="jumpPcPicture != null">jumpPcPicture,</if>
  172. <if test="jumpAppPicture != null">jumpAppPicture,</if>
  173. <if test="jumpLink != null">jumpLink,</if>
  174. <if test="jumpAppLink != null">jumpAppLink,</if>
  175. <if test="title != null">title,</if>
  176. <if test="content != null">content,</if>
  177. <if test="video != null">video,</if>
  178. <if test="sort != null">sort,</if>
  179. <if test="pcStatus != null">pcStatus,</if>
  180. <if test="appStatus != null">appStatus,</if>
  181. <if test="delFlag != null">delFlag,</if>
  182. <if test="updateTime != null">updateTime,</if>
  183. <if test="addTime != null">addTime,</if>
  184. </trim>
  185. <trim prefix="values (" suffix=")" suffixOverrides=",">
  186. <if test="authUserId != null">#{authUserId},</if>
  187. <if test="type != null">#{type},</if>
  188. <if test="levelType != null "> #{levelType},</if>
  189. <if test="authorId != null "> #{authorId},</if>
  190. <if test="headPcBanner != null">#{headPcBanner},</if>
  191. <if test="headAppBanner != null">#{headAppBanner},</if>
  192. <if test="jumpStatus != null">#{jumpStatus},</if>
  193. <if test="jumpPcPicture != null">#{jumpPcPicture},</if>
  194. <if test="jumpAppPicture != null">#{jumpAppPicture},</if>
  195. <if test="jumpLink != null">#{jumpLink},</if>
  196. <if test="jumpAppLink != null">#{jumpAppLink},</if>
  197. <if test="title != null">#{title},</if>
  198. <if test="content != null">#{content},</if>
  199. <if test="video != null">#{video},</if>
  200. <if test="sort != null">#{sort},</if>
  201. <if test="pcStatus != null">#{pcStatus},</if>
  202. <if test="appStatus != null">#{appStatus},</if>
  203. <if test="delFlag != null">#{delFlag},</if>
  204. <if test="updateTime != null">#{updateTime},</if>
  205. <if test="addTime != null">#{addTime},</if>
  206. </trim>
  207. </insert>
  208. <update id="updateCmBrandLanding" parameterType="CmBrandLanding">
  209. update cm_brand_landing
  210. <trim prefix="SET" suffixOverrides=",">
  211. <if test="authUserId != null">authUserId = #{authUserId},</if>
  212. <if test="type != null">type = #{type},</if>
  213. <if test="levelType != null "> levelType = #{levelType},</if>
  214. <if test="authorId != null "> authorId = #{authorId},</if>
  215. <if test="headPcBanner != null">headPcBanner = #{headPcBanner},</if>
  216. <if test="headAppBanner != null">headAppBanner = #{headAppBanner},</if>
  217. <if test="jumpStatus != null">jumpStatus = #{jumpStatus},</if>
  218. <if test="jumpPcPicture != null">jumpPcPicture = #{jumpPcPicture},</if>
  219. <if test="jumpAppPicture != null">jumpAppPicture = #{jumpAppPicture},</if>
  220. <if test="jumpLink != null">jumpLink = #{jumpLink},</if>
  221. <if test="jumpAppLink != null">jumpAppLink = #{jumpAppLink},</if>
  222. <if test="title != null">title = #{title},</if>
  223. <if test="content != null">content = #{content},</if>
  224. <if test="video != null">video = #{video},</if>
  225. <if test="sort != null">sort = #{sort},</if>
  226. <if test="pcStatus != null">pcStatus = #{pcStatus},</if>
  227. <if test="appStatus != null">appStatus = #{appStatus},</if>
  228. <if test="delFlag != null">delFlag = #{delFlag},</if>
  229. <if test="updateTime != null">updateTime = #{updateTime},</if>
  230. <if test="addTime != null">addTime = #{addTime},</if>
  231. </trim>
  232. where id = #{id}
  233. </update>
  234. <delete id="deleteCmBrandLandingById" parameterType="String">
  235. delete from cm_brand_landing where id = #{id}
  236. </delete>
  237. <delete id="delCmBrandLandingByAuthorId" parameterType="String">
  238. delete from cm_brand_landing where authorId = #{authorId}
  239. </delete>
  240. <delete id="deleteCmBrandLandingByIds" parameterType="String">
  241. delete from cm_brand_landing where id in
  242. <foreach item="id" collection="array" open="(" separator="," close=")">
  243. #{id}
  244. </foreach>
  245. </delete>
  246. </mapper>