ImageUploadLogMapper.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  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.ImageUploadLogMapper">
  4. <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.ImageUploadLog">
  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="image_name" property="imageName" jdbcType="VARCHAR"/>
  12. <result column="url" property="url" jdbcType="VARCHAR"/>
  13. <result column="store_id" property="storeId" jdbcType="VARCHAR"/>
  14. <result column="order_id" property="orderId" jdbcType="VARCHAR"/>
  15. <result column="user_id" property="userId" jdbcType="VARCHAR"/>
  16. <result column="type_flag" property="typeFlag" jdbcType="VARCHAR"/>
  17. <result column="image_size" property="imageSize" jdbcType="DECIMAL"/>
  18. <result column="use_flag" property="useFlag" jdbcType="CHAR"/>
  19. <result column="artwork_url" property="artworkUrl" jdbcType="VARCHAR"/>
  20. </resultMap>
  21. <sql id="Base_Column_List">
  22. <trim suffixOverrides=",">
  23. id,
  24. del_flag,
  25. update_time,
  26. update_user,
  27. create_time,
  28. create_user,
  29. image_name,
  30. url,
  31. store_id,
  32. order_id,
  33. user_id,
  34. type_flag,
  35. image_size,
  36. use_flag,
  37. artwork_url,
  38. </trim>
  39. </sql>
  40. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
  41. select
  42. <include refid="Base_Column_List"/>
  43. from image_upload_log
  44. where id = #{id,jdbcType=INTEGER}
  45. </select>
  46. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  47. delete from image_upload_log
  48. where id = #{id,jdbcType=INTEGER}
  49. </delete>
  50. <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.ImageUploadLog" useGeneratedKeys="true"
  51. keyProperty="id">
  52. insert into image_upload_log
  53. <trim prefix="(" suffix=")" suffixOverrides=",">
  54. <if test="id!= null">
  55. id,
  56. </if>
  57. <if test="delFlag!= null">
  58. del_flag,
  59. </if>
  60. <if test="updateTime!= null">
  61. update_time,
  62. </if>
  63. <if test="updateUser!= null">
  64. update_user,
  65. </if>
  66. <if test="createTime!= null">
  67. create_time,
  68. </if>
  69. <if test="createUser!= null">
  70. create_user,
  71. </if>
  72. <if test="imageName!= null">
  73. image_name,
  74. </if>
  75. <if test="url!= null">
  76. url,
  77. </if>
  78. <if test="storeId!= null">
  79. store_id,
  80. </if>
  81. <if test="orderId!= null">
  82. order_id,
  83. </if>
  84. <if test="userId!= null">
  85. user_id,
  86. </if>
  87. <if test="typeFlag!= null">
  88. type_flag,
  89. </if>
  90. <if test="imageSize!= null">
  91. image_size,
  92. </if>
  93. <if test="useFlag!= null">
  94. use_flag,
  95. </if>
  96. <if test="artworkUrl!= null">
  97. artwork_url,
  98. </if>
  99. </trim>
  100. <trim prefix="values (" suffix=")" suffixOverrides=",">
  101. <if test="id != null">
  102. #{id,jdbcType=INTEGER},
  103. </if>
  104. <if test="delFlag != null">
  105. #{delFlag,jdbcType=CHAR},
  106. </if>
  107. <if test="updateTime != null">
  108. #{updateTime,jdbcType=TIMESTAMP},
  109. </if>
  110. <if test="updateUser != null">
  111. #{updateUser,jdbcType=VARCHAR},
  112. </if>
  113. <if test="createTime != null">
  114. #{createTime,jdbcType=TIMESTAMP},
  115. </if>
  116. <if test="createUser != null">
  117. #{createUser,jdbcType=VARCHAR},
  118. </if>
  119. <if test="imageName != null">
  120. #{imageName,jdbcType=VARCHAR},
  121. </if>
  122. <if test="url != null">
  123. #{url,jdbcType=VARCHAR},
  124. </if>
  125. <if test="storeId != null">
  126. #{storeId,jdbcType=VARCHAR},
  127. </if>
  128. <if test="orderId != null">
  129. #{orderId,jdbcType=VARCHAR},
  130. </if>
  131. <if test="userId != null">
  132. #{userId,jdbcType=VARCHAR},
  133. </if>
  134. <if test="typeFlag != null">
  135. #{typeFlag,jdbcType=VARCHAR},
  136. </if>
  137. <if test="imageSize != null">
  138. #{imageSize,jdbcType=DECIMAL},
  139. </if>
  140. <if test="useFlag != null">
  141. #{useFlag,jdbcType=CHAR},
  142. </if>
  143. <if test="artworkUrl != null">
  144. #{artworkUrl,jdbcType=VARCHAR},
  145. </if>
  146. </trim>
  147. </insert>
  148. <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.ImageUploadLog">
  149. update image_upload_log
  150. <set>
  151. <if test="id != null">
  152. id= #{id,jdbcType=INTEGER},
  153. </if>
  154. <if test="delFlag != null">
  155. del_flag= #{delFlag,jdbcType=CHAR},
  156. </if>
  157. <if test="updateTime != null">
  158. update_time= #{updateTime,jdbcType=TIMESTAMP},
  159. </if>
  160. <if test="updateUser != null">
  161. update_user= #{updateUser,jdbcType=VARCHAR},
  162. </if>
  163. <if test="createTime != null">
  164. create_time= #{createTime,jdbcType=TIMESTAMP},
  165. </if>
  166. <if test="createUser != null">
  167. create_user= #{createUser,jdbcType=VARCHAR},
  168. </if>
  169. <if test="imageName != null">
  170. image_name= #{imageName,jdbcType=VARCHAR},
  171. </if>
  172. <if test="url != null">
  173. url= #{url,jdbcType=VARCHAR},
  174. </if>
  175. <if test="storeId != null">
  176. store_id= #{storeId,jdbcType=VARCHAR},
  177. </if>
  178. <if test="orderId != null">
  179. order_id= #{orderId,jdbcType=VARCHAR},
  180. </if>
  181. <if test="userId != null">
  182. user_id= #{userId,jdbcType=VARCHAR},
  183. </if>
  184. <if test="typeFlag != null">
  185. type_flag= #{typeFlag,jdbcType=VARCHAR},
  186. </if>
  187. <if test="imageSize != null">
  188. image_size= #{imageSize,jdbcType=DECIMAL},
  189. </if>
  190. <if test="useFlag != null">
  191. use_flag= #{useFlag,jdbcType=CHAR},
  192. </if>
  193. <if test="artworkUrl != null">
  194. artwork_url= #{artworkUrl,jdbcType=VARCHAR},
  195. </if>
  196. </set>
  197. where
  198. <if test="id != null and !&quot;&quot;.equals(id)">
  199. id = #{id,jdbcType=INTEGER}
  200. </if>
  201. <if test="idStr != null and !&quot;&quot;.equals(idStr)">
  202. id in (${idStr})
  203. </if>
  204. </update>
  205. <select id="queryImageUploadLogByPage" parameterType="java.util.Map"
  206. resultType="com.izouma.awesomeadmin.model.ImageUploadLog">
  207. select
  208. <include refid="Base_Column_List"/>
  209. from image_upload_log
  210. <where>
  211. and del_flag = 'N'
  212. <if test="record.idStr != null and !&quot;&quot;.equals(record.idStr)">
  213. and id in (${record.idStr})
  214. </if>
  215. <if test="record.id != null and !&quot;&quot;.equals(record.id)">
  216. and id = #{record.id}
  217. </if>
  218. <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
  219. and del_flag = #{record.delFlag}
  220. </if>
  221. <if test="record.updateTime != null and !&quot;&quot;.equals(record.updateTime)">
  222. and update_time = #{record.updateTime}
  223. </if>
  224. <if test="record.updateUser != null and !&quot;&quot;.equals(record.updateUser)">
  225. and update_user = #{record.updateUser}
  226. </if>
  227. <if test="record.createTime != null and !&quot;&quot;.equals(record.createTime)">
  228. and create_time = #{record.createTime}
  229. </if>
  230. <if test="record.createUser != null and !&quot;&quot;.equals(record.createUser)">
  231. and create_user = #{record.createUser}
  232. </if>
  233. <if test="record.imageName != null and !&quot;&quot;.equals(record.imageName)">
  234. and image_name = #{record.imageName}
  235. </if>
  236. <if test="record.url != null and !&quot;&quot;.equals(record.url)">
  237. and url = #{record.url}
  238. </if>
  239. <if test="record.storeId != null and !&quot;&quot;.equals(record.storeId)">
  240. and store_id = #{record.storeId}
  241. </if>
  242. <if test="record.orderId != null and !&quot;&quot;.equals(record.orderId)">
  243. and order_id = #{record.orderId}
  244. </if>
  245. <if test="record.userId != null and !&quot;&quot;.equals(record.userId)">
  246. and user_id = #{record.userId}
  247. </if>
  248. <if test="record.typeFlag != null and !&quot;&quot;.equals(record.typeFlag)">
  249. and type_flag = #{record.typeFlag}
  250. </if>
  251. <if test="record.imageSize != null and !&quot;&quot;.equals(record.imageSize)">
  252. and image_size = #{record.imageSize}
  253. </if>
  254. <if test="record.useFlag != null and !&quot;&quot;.equals(record.useFlag)">
  255. and use_flag = #{record.useFlag}
  256. </if>
  257. <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
  258. <trim prefix="and (" suffix=")" prefixOverrides="OR">
  259. OR image_name LIKE concat('%',#{record.searchKey},'%')
  260. OR url LIKE concat('%',#{record.searchKey},'%')
  261. OR store_id LIKE concat('%',#{record.searchKey},'%')
  262. OR order_id LIKE concat('%',#{record.searchKey},'%')
  263. OR user_id LIKE concat('%',#{record.searchKey},'%')
  264. OR type_flag LIKE concat('%',#{record.searchKey},'%')
  265. OR image_size LIKE concat('%',#{record.searchKey},'%')
  266. OR use_flag LIKE concat('%',#{record.searchKey},'%')
  267. </trim>
  268. </if>
  269. <if test="record.advancedQuery != null and !&quot;&quot;.equals(record.advancedQuery)">
  270. <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
  271. <choose>
  272. <when test="item.indexOf('like') != -1">
  273. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  274. <if test="detailIndex == 3">
  275. concat('%',#{itemDetail},'%')
  276. </if>
  277. <if test="detailIndex &lt; 3">
  278. ${itemDetail}
  279. </if>
  280. </foreach>
  281. </when>
  282. <otherwise>
  283. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  284. <if test="detailIndex == 3">
  285. #{itemDetail}
  286. </if>
  287. <if test="detailIndex &lt; 3">
  288. ${itemDetail}
  289. </if>
  290. </foreach>
  291. </otherwise>
  292. </choose>
  293. </foreach>
  294. </if>
  295. </where>
  296. order by
  297. <if test="record.orderByStr != null and !&quot;&quot;.equals(record.orderByStr)">
  298. <trim suffixOverrides=",">
  299. <foreach item="item" index="index" separator="," collection="record.orderByStr.split('_;')">
  300. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  301. ${itemDetail}
  302. </foreach>
  303. </foreach>
  304. </trim>
  305. ,
  306. </if>
  307. id desc
  308. </select>
  309. <select id="queryAllImageUploadLog" parameterType="java.util.Map"
  310. resultType="com.izouma.awesomeadmin.model.ImageUploadLog">
  311. select
  312. <include refid="Base_Column_List"/>
  313. from image_upload_log
  314. <where>
  315. and del_flag = 'N'
  316. <if test="idStr != null and !&quot;&quot;.equals(idStr)">
  317. and id in (${idStr})
  318. </if>
  319. <if test="id != null and !&quot;&quot;.equals(id)">
  320. and id = #{id}
  321. </if>
  322. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  323. and del_flag = #{delFlag}
  324. </if>
  325. <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
  326. and update_time = #{updateTime}
  327. </if>
  328. <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
  329. and update_user = #{updateUser}
  330. </if>
  331. <if test="createTime != null and !&quot;&quot;.equals(createTime)">
  332. and create_time = #{createTime}
  333. </if>
  334. <if test="createUser != null and !&quot;&quot;.equals(createUser)">
  335. and create_user = #{createUser}
  336. </if>
  337. <if test="imageName != null and !&quot;&quot;.equals(imageName)">
  338. and image_name = #{imageName}
  339. </if>
  340. <if test="url != null and !&quot;&quot;.equals(url)">
  341. and url = #{url}
  342. </if>
  343. <if test="storeId != null and !&quot;&quot;.equals(storeId)">
  344. and store_id = #{storeId}
  345. </if>
  346. <if test="orderId != null and !&quot;&quot;.equals(orderId)">
  347. and order_id = #{orderId}
  348. </if>
  349. <if test="userId != null and !&quot;&quot;.equals(userId)">
  350. and user_id = #{userId}
  351. </if>
  352. <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
  353. and type_flag = #{typeFlag}
  354. </if>
  355. <if test="imageSize != null and !&quot;&quot;.equals(imageSize)">
  356. and image_size = #{imageSize}
  357. </if>
  358. <if test="useFlag != null and !&quot;&quot;.equals(useFlag)">
  359. and use_flag = #{useFlag}
  360. </if>
  361. <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
  362. <trim prefix="and (" suffix=")" prefixOverrides="OR">
  363. OR image_name LIKE concat('%',#{searchKey},'%')
  364. OR url LIKE concat('%',#{searchKey},'%')
  365. OR store_id LIKE concat('%',#{searchKey},'%')
  366. OR order_id LIKE concat('%',#{searchKey},'%')
  367. OR user_id LIKE concat('%',#{searchKey},'%')
  368. OR type_flag LIKE concat('%',#{searchKey},'%')
  369. OR image_size LIKE concat('%',#{searchKey},'%')
  370. OR use_flag LIKE concat('%',#{searchKey},'%')
  371. </trim>
  372. </if>
  373. <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
  374. <foreach item="item" index="index" collection="advancedQuery.split('_;')">
  375. <choose>
  376. <when test="item.indexOf('like') != -1">
  377. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  378. <if test="detailIndex == 3">
  379. concat('%',#{itemDetail},'%')
  380. </if>
  381. <if test="detailIndex &lt; 3">
  382. ${itemDetail}
  383. </if>
  384. </foreach>
  385. </when>
  386. <otherwise>
  387. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  388. <if test="detailIndex == 3">
  389. #{itemDetail}
  390. </if>
  391. <if test="detailIndex &lt; 3">
  392. ${itemDetail}
  393. </if>
  394. </foreach>
  395. </otherwise>
  396. </choose>
  397. </foreach>
  398. </if>
  399. </where>
  400. order by
  401. <if test="orderByStr != null and !&quot;&quot;.equals(orderByStr)">
  402. <trim suffixOverrides=",">
  403. <foreach item="item" index="index" separator="," collection="orderByStr.split('_;')">
  404. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  405. ${itemDetail}
  406. </foreach>
  407. </foreach>
  408. </trim>
  409. ,
  410. </if>
  411. id desc
  412. </select>
  413. <select id="queryImageUploadLog" parameterType="java.util.Map"
  414. resultType="com.izouma.awesomeadmin.model.ImageUploadLog">
  415. select
  416. <include refid="Base_Column_List"/>
  417. from image_upload_log
  418. <where>
  419. and del_flag = 'N'
  420. <if test="id != null and !&quot;&quot;.equals(id)">
  421. and id = #{id}
  422. </if>
  423. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  424. and del_flag = #{delFlag}
  425. </if>
  426. <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
  427. and update_time = #{updateTime}
  428. </if>
  429. <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
  430. and update_user = #{updateUser}
  431. </if>
  432. <if test="createTime != null and !&quot;&quot;.equals(createTime)">
  433. and create_time = #{createTime}
  434. </if>
  435. <if test="createUser != null and !&quot;&quot;.equals(createUser)">
  436. and create_user = #{createUser}
  437. </if>
  438. <if test="imageName != null and !&quot;&quot;.equals(imageName)">
  439. and image_name = #{imageName}
  440. </if>
  441. <if test="url != null and !&quot;&quot;.equals(url)">
  442. and url = #{url}
  443. </if>
  444. <if test="storeId != null and !&quot;&quot;.equals(storeId)">
  445. and store_id = #{storeId}
  446. </if>
  447. <if test="orderId != null and !&quot;&quot;.equals(orderId)">
  448. and order_id = #{orderId}
  449. </if>
  450. <if test="userId != null and !&quot;&quot;.equals(userId)">
  451. and user_id = #{userId}
  452. </if>
  453. <if test="typeFlag != null and !&quot;&quot;.equals(typeFlag)">
  454. and type_flag = #{typeFlag}
  455. </if>
  456. <if test="imageSize != null and !&quot;&quot;.equals(imageSize)">
  457. and image_size = #{imageSize}
  458. </if>
  459. <if test="useFlag != null and !&quot;&quot;.equals(useFlag)">
  460. and use_flag = #{useFlag}
  461. </if>
  462. </where>
  463. LIMIT 1
  464. </select>
  465. <update id="delete">
  466. UPDATE image_upload_log SET del_flag = 'Y'
  467. where
  468. id = #{id}
  469. </update>
  470. <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.ImageUploadLog">
  471. select
  472. <include refid="Base_Column_List"/>
  473. from image_upload_log
  474. <where>
  475. and del_flag = 'N'
  476. </where>
  477. order by id desc
  478. </select>
  479. <select id="queryDelOssImage" parameterType="java.util.Map"
  480. resultType="com.izouma.awesomeadmin.model.ImageUploadLog">
  481. SELECT
  482. url AS url
  483. FROM
  484. `image_upload_log`
  485. WHERE
  486. del_flag = 'N'
  487. AND order_id = #{orderId}
  488. AND url NOT IN (
  489. SELECT
  490. original_image AS image_url
  491. FROM
  492. order_image
  493. WHERE
  494. del_flag = 'N'
  495. AND original_image IS NOT NULL
  496. AND original_image != ''
  497. AND order_id = #{orderId}
  498. UNION
  499. SELECT
  500. finished_image AS image_url
  501. FROM
  502. order_image
  503. WHERE
  504. del_flag = 'N'
  505. AND finished_image IS NOT NULL
  506. AND finished_image != ''
  507. AND order_id = #{orderId}
  508. )
  509. UNION
  510. SELECT
  511. artwork_url AS url
  512. FROM
  513. `image_upload_log`
  514. WHERE
  515. del_flag = 'N'
  516. AND order_id = #{orderId}
  517. AND artwork_url NOT IN (
  518. SELECT
  519. original_artwork AS image_url
  520. FROM
  521. order_image
  522. WHERE
  523. del_flag = 'N'
  524. AND original_artwork IS NOT NULL
  525. AND original_artwork != ''
  526. AND order_id = #{orderId}
  527. UNION
  528. SELECT
  529. finished_artwork AS image_url
  530. FROM
  531. order_image
  532. WHERE
  533. del_flag = 'N'
  534. AND finished_artwork IS NOT NULL
  535. AND finished_artwork != ''
  536. AND order_id = #{orderId}
  537. )
  538. </select>
  539. </mapper>