ProductCommentImageMapper.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  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.izouma.awesomeadmin.dao.ProductCommentImageMapper" >
  4. <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.ProductCommentImage" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="del_flag" property="delFlag" jdbcType="CHAR" />
  7. <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
  8. <result column="update_user" property="updateUser" jdbcType="VARCHAR" />
  9. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  10. <result column="create_user" property="createUser" jdbcType="VARCHAR" />
  11. <result column="product_id" property="productId" jdbcType="VARCHAR" />
  12. <result column="order_id" property="orderId" jdbcType="VARCHAR" />
  13. <result column="user_id" property="userId" jdbcType="VARCHAR" />
  14. <result column="store_id" property="storeId" jdbcType="VARCHAR" />
  15. <result column="comment_id" property="commentId" jdbcType="VARCHAR" />
  16. <result column="image_url" property="imageUrl" jdbcType="VARCHAR" />
  17. <result column="image_size" property="imageSize" jdbcType="VARCHAR" />
  18. </resultMap>
  19. <sql id="Base_Column_List" >
  20. <trim suffixOverrides="," >
  21. id,
  22. del_flag,
  23. update_time,
  24. update_user,
  25. create_time,
  26. create_user,
  27. product_id,
  28. order_id,
  29. user_id,
  30. store_id,
  31. comment_id,
  32. image_url,
  33. image_size,
  34. </trim>
  35. </sql>
  36. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  37. select
  38. <include refid="Base_Column_List" />
  39. from product_comment_image
  40. where id = #{id,jdbcType=INTEGER}
  41. </select>
  42. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  43. delete from product_comment_image
  44. where id = #{id,jdbcType=INTEGER}
  45. </delete>
  46. <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.ProductCommentImage" useGeneratedKeys="true" keyProperty="id">
  47. insert into product_comment_image
  48. <trim prefix="(" suffix=")" suffixOverrides="," >
  49. <if test="id!= null" >
  50. id,
  51. </if>
  52. <if test="delFlag!= null" >
  53. del_flag,
  54. </if>
  55. <if test="updateTime!= null" >
  56. update_time,
  57. </if>
  58. <if test="updateUser!= null" >
  59. update_user,
  60. </if>
  61. <if test="createTime!= null" >
  62. create_time,
  63. </if>
  64. <if test="createUser!= null" >
  65. create_user,
  66. </if>
  67. <if test="productId!= null" >
  68. product_id,
  69. </if>
  70. <if test="orderId!= null" >
  71. order_id,
  72. </if>
  73. <if test="userId!= null" >
  74. user_id,
  75. </if>
  76. <if test="storeId!= null" >
  77. store_id,
  78. </if>
  79. <if test="commentId!= null" >
  80. comment_id,
  81. </if>
  82. <if test="imageUrl!= null" >
  83. image_url,
  84. </if>
  85. <if test="imageSize!= null" >
  86. image_size,
  87. </if>
  88. </trim>
  89. <trim prefix="values (" suffix=")" suffixOverrides="," >
  90. <if test="id != null" >
  91. #{id,jdbcType=INTEGER},
  92. </if>
  93. <if test="delFlag != null" >
  94. #{delFlag,jdbcType=CHAR},
  95. </if>
  96. <if test="updateTime != null" >
  97. #{updateTime,jdbcType=TIMESTAMP},
  98. </if>
  99. <if test="updateUser != null" >
  100. #{updateUser,jdbcType=VARCHAR},
  101. </if>
  102. <if test="createTime != null" >
  103. #{createTime,jdbcType=TIMESTAMP},
  104. </if>
  105. <if test="createUser != null" >
  106. #{createUser,jdbcType=VARCHAR},
  107. </if>
  108. <if test="productId != null" >
  109. #{productId,jdbcType=VARCHAR},
  110. </if>
  111. <if test="orderId != null" >
  112. #{orderId,jdbcType=VARCHAR},
  113. </if>
  114. <if test="userId != null" >
  115. #{userId,jdbcType=VARCHAR},
  116. </if>
  117. <if test="storeId != null" >
  118. #{storeId,jdbcType=VARCHAR},
  119. </if>
  120. <if test="commentId != null" >
  121. #{commentId,jdbcType=VARCHAR},
  122. </if>
  123. <if test="imageUrl != null" >
  124. #{imageUrl,jdbcType=VARCHAR},
  125. </if>
  126. <if test="imageSize != null" >
  127. #{imageSize,jdbcType=VARCHAR},
  128. </if>
  129. </trim>
  130. </insert>
  131. <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.ProductCommentImage" >
  132. update product_comment_image
  133. <set >
  134. <if test="id != null" >
  135. id= #{id,jdbcType=INTEGER},
  136. </if>
  137. <if test="delFlag != null" >
  138. del_flag= #{delFlag,jdbcType=CHAR},
  139. </if>
  140. <if test="updateTime != null" >
  141. update_time= #{updateTime,jdbcType=TIMESTAMP},
  142. </if>
  143. <if test="updateUser != null" >
  144. update_user= #{updateUser,jdbcType=VARCHAR},
  145. </if>
  146. <if test="createTime != null" >
  147. create_time= #{createTime,jdbcType=TIMESTAMP},
  148. </if>
  149. <if test="createUser != null" >
  150. create_user= #{createUser,jdbcType=VARCHAR},
  151. </if>
  152. <if test="productId != null" >
  153. product_id= #{productId,jdbcType=VARCHAR},
  154. </if>
  155. <if test="orderId != null" >
  156. order_id= #{orderId,jdbcType=VARCHAR},
  157. </if>
  158. <if test="userId != null" >
  159. user_id= #{userId,jdbcType=VARCHAR},
  160. </if>
  161. <if test="storeId != null" >
  162. store_id= #{storeId,jdbcType=VARCHAR},
  163. </if>
  164. <if test="commentId != null" >
  165. comment_id= #{commentId,jdbcType=VARCHAR},
  166. </if>
  167. <if test="imageUrl != null" >
  168. image_url= #{imageUrl,jdbcType=VARCHAR},
  169. </if>
  170. <if test="imageSize != null" >
  171. image_size= #{imageSize,jdbcType=VARCHAR},
  172. </if>
  173. </set>
  174. where id = #{id,jdbcType=INTEGER}
  175. </update>
  176. <select id="queryProductCommentImageByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductCommentImage">
  177. select <include refid="Base_Column_List"/> from product_comment_image
  178. <where>
  179. and del_flag = 'N'
  180. <if test="record.id != null and !&quot;&quot;.equals(record.id)">
  181. and id = #{record.id}
  182. </if>
  183. <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
  184. and del_flag = #{record.delFlag}
  185. </if>
  186. <if test="record.updateTime != null and !&quot;&quot;.equals(record.updateTime)">
  187. and update_time = #{record.updateTime}
  188. </if>
  189. <if test="record.updateUser != null and !&quot;&quot;.equals(record.updateUser)">
  190. and update_user = #{record.updateUser}
  191. </if>
  192. <if test="record.createTime != null and !&quot;&quot;.equals(record.createTime)">
  193. and create_time = #{record.createTime}
  194. </if>
  195. <if test="record.createUser != null and !&quot;&quot;.equals(record.createUser)">
  196. and create_user = #{record.createUser}
  197. </if>
  198. <if test="record.productId != null and !&quot;&quot;.equals(record.productId)">
  199. and product_id = #{record.productId}
  200. </if>
  201. <if test="record.orderId != null and !&quot;&quot;.equals(record.orderId)">
  202. and order_id = #{record.orderId}
  203. </if>
  204. <if test="record.userId != null and !&quot;&quot;.equals(record.userId)">
  205. and user_id = #{record.userId}
  206. </if>
  207. <if test="record.storeId != null and !&quot;&quot;.equals(record.storeId)">
  208. and store_id = #{record.storeId}
  209. </if>
  210. <if test="record.commentId != null and !&quot;&quot;.equals(record.commentId)">
  211. and comment_id = #{record.commentId}
  212. </if>
  213. <if test="record.imageUrl != null and !&quot;&quot;.equals(record.imageUrl)">
  214. and image_url = #{record.imageUrl}
  215. </if>
  216. <if test="record.imageSize != null and !&quot;&quot;.equals(record.imageSize)">
  217. and image_size = #{record.imageSize}
  218. </if>
  219. <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
  220. <trim prefix="and (" suffix=")" prefixOverrides="OR" >
  221. OR product_id LIKE concat('%',#{record.searchKey},'%')
  222. OR order_id LIKE concat('%',#{record.searchKey},'%')
  223. OR user_id LIKE concat('%',#{record.searchKey},'%')
  224. OR store_id LIKE concat('%',#{record.searchKey},'%')
  225. OR comment_id LIKE concat('%',#{record.searchKey},'%')
  226. OR image_url LIKE concat('%',#{record.searchKey},'%')
  227. OR image_size LIKE concat('%',#{record.searchKey},'%')
  228. </trim>
  229. </if>
  230. <if test="record.advancedQuery != null and !&quot;&quot;.equals(record.advancedQuery)">
  231. <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
  232. <choose>
  233. <when test="item.indexOf('like') != -1">
  234. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  235. <if test="detailIndex == 3">
  236. concat('%',#{itemDetail},'%')
  237. </if>
  238. <if test="detailIndex &lt; 3">
  239. ${itemDetail}
  240. </if>
  241. </foreach>
  242. </when>
  243. <otherwise>
  244. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  245. <if test="detailIndex == 3">
  246. #{itemDetail}
  247. </if>
  248. <if test="detailIndex &lt; 3">
  249. ${itemDetail}
  250. </if>
  251. </foreach>
  252. </otherwise>
  253. </choose>
  254. </foreach>
  255. </if>
  256. </where>
  257. order by
  258. <if test="record.orderByStr != null and !&quot;&quot;.equals(record.orderByStr)">
  259. <trim suffixOverrides=",">
  260. <foreach item="item" index="index" separator="," collection="record.orderByStr.split('_;')">
  261. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  262. ${itemDetail}
  263. </foreach>
  264. </foreach>
  265. </trim>
  266. ,
  267. </if>
  268. id desc
  269. </select>
  270. <select id="queryAllProductCommentImage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductCommentImage">
  271. select <include refid="Base_Column_List"/> from product_comment_image
  272. <where>
  273. and del_flag = 'N'
  274. <if test="id != null and !&quot;&quot;.equals(id)">
  275. and id = #{id}
  276. </if>
  277. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  278. and del_flag = #{delFlag}
  279. </if>
  280. <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
  281. and update_time = #{updateTime}
  282. </if>
  283. <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
  284. and update_user = #{updateUser}
  285. </if>
  286. <if test="createTime != null and !&quot;&quot;.equals(createTime)">
  287. and create_time = #{createTime}
  288. </if>
  289. <if test="createUser != null and !&quot;&quot;.equals(createUser)">
  290. and create_user = #{createUser}
  291. </if>
  292. <if test="productId != null and !&quot;&quot;.equals(productId)">
  293. and product_id = #{productId}
  294. </if>
  295. <if test="orderId != null and !&quot;&quot;.equals(orderId)">
  296. and order_id = #{orderId}
  297. </if>
  298. <if test="userId != null and !&quot;&quot;.equals(userId)">
  299. and user_id = #{userId}
  300. </if>
  301. <if test="storeId != null and !&quot;&quot;.equals(storeId)">
  302. and store_id = #{storeId}
  303. </if>
  304. <if test="commentId != null and !&quot;&quot;.equals(commentId)">
  305. and comment_id = #{commentId}
  306. </if>
  307. <if test="imageUrl != null and !&quot;&quot;.equals(imageUrl)">
  308. and image_url = #{imageUrl}
  309. </if>
  310. <if test="imageSize != null and !&quot;&quot;.equals(imageSize)">
  311. and image_size = #{imageSize}
  312. </if>
  313. <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
  314. <trim prefix="and (" suffix=")" prefixOverrides="OR" >
  315. OR product_id LIKE concat('%',#{searchKey},'%')
  316. OR order_id LIKE concat('%',#{searchKey},'%')
  317. OR user_id LIKE concat('%',#{searchKey},'%')
  318. OR store_id LIKE concat('%',#{searchKey},'%')
  319. OR comment_id LIKE concat('%',#{searchKey},'%')
  320. OR image_url LIKE concat('%',#{searchKey},'%')
  321. OR image_size LIKE concat('%',#{searchKey},'%')
  322. </trim>
  323. </if>
  324. <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
  325. <foreach item="item" index="index" collection="advancedQuery.split('_;')">
  326. <choose>
  327. <when test="item.indexOf('like') != -1">
  328. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  329. <if test="detailIndex == 3">
  330. concat('%',#{itemDetail},'%')
  331. </if>
  332. <if test="detailIndex &lt; 3">
  333. ${itemDetail}
  334. </if>
  335. </foreach>
  336. </when>
  337. <otherwise>
  338. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  339. <if test="detailIndex == 3">
  340. #{itemDetail}
  341. </if>
  342. <if test="detailIndex &lt; 3">
  343. ${itemDetail}
  344. </if>
  345. </foreach>
  346. </otherwise>
  347. </choose>
  348. </foreach>
  349. </if>
  350. </where>
  351. order by
  352. <if test="orderByStr != null and !&quot;&quot;.equals(orderByStr)">
  353. <trim suffixOverrides=",">
  354. <foreach item="item" index="index" separator="," collection="orderByStr.split('_;')">
  355. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  356. ${itemDetail}
  357. </foreach>
  358. </foreach>
  359. </trim>
  360. ,
  361. </if>
  362. id desc
  363. </select>
  364. <select id="queryProductCommentImage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductCommentImage">
  365. select <include refid="Base_Column_List"/> from product_comment_image
  366. <where>
  367. and del_flag = 'N'
  368. <if test="id != null and !&quot;&quot;.equals(id)">
  369. and id = #{id}
  370. </if>
  371. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  372. and del_flag = #{delFlag}
  373. </if>
  374. <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
  375. and update_time = #{updateTime}
  376. </if>
  377. <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
  378. and update_user = #{updateUser}
  379. </if>
  380. <if test="createTime != null and !&quot;&quot;.equals(createTime)">
  381. and create_time = #{createTime}
  382. </if>
  383. <if test="createUser != null and !&quot;&quot;.equals(createUser)">
  384. and create_user = #{createUser}
  385. </if>
  386. <if test="productId != null and !&quot;&quot;.equals(productId)">
  387. and product_id = #{productId}
  388. </if>
  389. <if test="orderId != null and !&quot;&quot;.equals(orderId)">
  390. and order_id = #{orderId}
  391. </if>
  392. <if test="userId != null and !&quot;&quot;.equals(userId)">
  393. and user_id = #{userId}
  394. </if>
  395. <if test="storeId != null and !&quot;&quot;.equals(storeId)">
  396. and store_id = #{storeId}
  397. </if>
  398. <if test="commentId != null and !&quot;&quot;.equals(commentId)">
  399. and comment_id = #{commentId}
  400. </if>
  401. <if test="imageUrl != null and !&quot;&quot;.equals(imageUrl)">
  402. and image_url = #{imageUrl}
  403. </if>
  404. <if test="imageSize != null and !&quot;&quot;.equals(imageSize)">
  405. and image_size = #{imageSize}
  406. </if>
  407. </where>
  408. LIMIT 1
  409. </select>
  410. <update id="delete">
  411. UPDATE product_comment_image SET del_flag = 'Y'
  412. <where>
  413. AND id = #{id}
  414. </where>
  415. </update>
  416. <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ProductCommentImage">
  417. select <include refid="Base_Column_List"/> from product_comment_image
  418. <where>
  419. and del_flag = 'N'
  420. </where>
  421. order by id desc
  422. </select>
  423. </mapper>