OrderRepairDetailMapper.xml 15 KB

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