OrderAddressMapper.xml 25 KB

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