DistrictInfoMapper.xml 19 KB

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