OrderLogisticsMapper.xml 22 KB

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