CityMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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.hssx.mapper.CityMapper">
  4. <resultMap id="BaseResultMap" type="com.hssx.model.City">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  9. -->
  10. <id column="id" jdbcType="INTEGER" property="id" />
  11. <result column="parent_id" jdbcType="INTEGER" property="parentId" />
  12. <result column="name" jdbcType="VARCHAR" property="name" />
  13. <result column="type" jdbcType="INTEGER" property="type" />
  14. <result column="pinyin" jdbcType="VARCHAR" property="pinyin" />
  15. </resultMap>
  16. <sql id="Example_Where_Clause">
  17. <!--
  18. WARNING - @mbg.generated
  19. This element is automatically generated by MyBatis Generator, do not modify.
  20. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  21. -->
  22. <where>
  23. <foreach collection="oredCriteria" item="criteria" separator="or">
  24. <if test="criteria.valid">
  25. <trim prefix="(" prefixOverrides="and" suffix=")">
  26. <foreach collection="criteria.criteria" item="criterion">
  27. <choose>
  28. <when test="criterion.noValue">
  29. and ${criterion.condition}
  30. </when>
  31. <when test="criterion.singleValue">
  32. and ${criterion.condition} #{criterion.value}
  33. </when>
  34. <when test="criterion.betweenValue">
  35. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  36. </when>
  37. <when test="criterion.listValue">
  38. and ${criterion.condition}
  39. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  40. #{listItem}
  41. </foreach>
  42. </when>
  43. </choose>
  44. </foreach>
  45. </trim>
  46. </if>
  47. </foreach>
  48. </where>
  49. </sql>
  50. <sql id="Update_By_Example_Where_Clause">
  51. <!--
  52. WARNING - @mbg.generated
  53. This element is automatically generated by MyBatis Generator, do not modify.
  54. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  55. -->
  56. <where>
  57. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  58. <if test="criteria.valid">
  59. <trim prefix="(" prefixOverrides="and" suffix=")">
  60. <foreach collection="criteria.criteria" item="criterion">
  61. <choose>
  62. <when test="criterion.noValue">
  63. and ${criterion.condition}
  64. </when>
  65. <when test="criterion.singleValue">
  66. and ${criterion.condition} #{criterion.value}
  67. </when>
  68. <when test="criterion.betweenValue">
  69. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  70. </when>
  71. <when test="criterion.listValue">
  72. and ${criterion.condition}
  73. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  74. #{listItem}
  75. </foreach>
  76. </when>
  77. </choose>
  78. </foreach>
  79. </trim>
  80. </if>
  81. </foreach>
  82. </where>
  83. </sql>
  84. <sql id="Base_Column_List">
  85. <!--
  86. WARNING - @mbg.generated
  87. This element is automatically generated by MyBatis Generator, do not modify.
  88. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  89. -->
  90. id, parent_id, name, type, pinyin
  91. </sql>
  92. <select id="selectByExample" parameterType="com.hssx.model.CityExample" resultMap="BaseResultMap">
  93. <!--
  94. WARNING - @mbg.generated
  95. This element is automatically generated by MyBatis Generator, do not modify.
  96. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  97. -->
  98. select
  99. <if test="distinct">
  100. distinct
  101. </if>
  102. <include refid="Base_Column_List" />
  103. from city
  104. <if test="_parameter != null">
  105. <include refid="Example_Where_Clause" />
  106. </if>
  107. <if test="orderByClause != null">
  108. order by ${orderByClause}
  109. </if>
  110. </select>
  111. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  112. <!--
  113. WARNING - @mbg.generated
  114. This element is automatically generated by MyBatis Generator, do not modify.
  115. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  116. -->
  117. select
  118. <include refid="Base_Column_List" />
  119. from city
  120. where id = #{id,jdbcType=INTEGER}
  121. </select>
  122. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  123. <!--
  124. WARNING - @mbg.generated
  125. This element is automatically generated by MyBatis Generator, do not modify.
  126. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  127. -->
  128. delete from city
  129. where id = #{id,jdbcType=INTEGER}
  130. </delete>
  131. <delete id="deleteByExample" parameterType="com.hssx.model.CityExample">
  132. <!--
  133. WARNING - @mbg.generated
  134. This element is automatically generated by MyBatis Generator, do not modify.
  135. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  136. -->
  137. delete from city
  138. <if test="_parameter != null">
  139. <include refid="Example_Where_Clause" />
  140. </if>
  141. </delete>
  142. <insert id="insert" parameterType="com.hssx.model.City">
  143. <!--
  144. WARNING - @mbg.generated
  145. This element is automatically generated by MyBatis Generator, do not modify.
  146. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  147. -->
  148. <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
  149. SELECT LAST_INSERT_ID()
  150. </selectKey>
  151. insert into city (parent_id, name, type,
  152. pinyin)
  153. values (#{parentId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
  154. #{pinyin,jdbcType=VARCHAR})
  155. </insert>
  156. <insert id="insertSelective" parameterType="com.hssx.model.City">
  157. <!--
  158. WARNING - @mbg.generated
  159. This element is automatically generated by MyBatis Generator, do not modify.
  160. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  161. -->
  162. <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
  163. SELECT LAST_INSERT_ID()
  164. </selectKey>
  165. insert into city
  166. <trim prefix="(" suffix=")" suffixOverrides=",">
  167. <if test="parentId != null">
  168. parent_id,
  169. </if>
  170. <if test="name != null">
  171. name,
  172. </if>
  173. <if test="type != null">
  174. type,
  175. </if>
  176. <if test="pinyin != null">
  177. pinyin,
  178. </if>
  179. </trim>
  180. <trim prefix="values (" suffix=")" suffixOverrides=",">
  181. <if test="parentId != null">
  182. #{parentId,jdbcType=INTEGER},
  183. </if>
  184. <if test="name != null">
  185. #{name,jdbcType=VARCHAR},
  186. </if>
  187. <if test="type != null">
  188. #{type,jdbcType=INTEGER},
  189. </if>
  190. <if test="pinyin != null">
  191. #{pinyin,jdbcType=VARCHAR},
  192. </if>
  193. </trim>
  194. </insert>
  195. <select id="countByExample" parameterType="com.hssx.model.CityExample" resultType="java.lang.Long">
  196. <!--
  197. WARNING - @mbg.generated
  198. This element is automatically generated by MyBatis Generator, do not modify.
  199. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  200. -->
  201. select count(*) from city
  202. <if test="_parameter != null">
  203. <include refid="Example_Where_Clause" />
  204. </if>
  205. </select>
  206. <update id="updateByExampleSelective" parameterType="map">
  207. <!--
  208. WARNING - @mbg.generated
  209. This element is automatically generated by MyBatis Generator, do not modify.
  210. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  211. -->
  212. update city
  213. <set>
  214. <if test="record.id != null">
  215. id = #{record.id,jdbcType=INTEGER},
  216. </if>
  217. <if test="record.parentId != null">
  218. parent_id = #{record.parentId,jdbcType=INTEGER},
  219. </if>
  220. <if test="record.name != null">
  221. name = #{record.name,jdbcType=VARCHAR},
  222. </if>
  223. <if test="record.type != null">
  224. type = #{record.type,jdbcType=INTEGER},
  225. </if>
  226. <if test="record.pinyin != null">
  227. pinyin = #{record.pinyin,jdbcType=VARCHAR},
  228. </if>
  229. </set>
  230. <if test="_parameter != null">
  231. <include refid="Update_By_Example_Where_Clause" />
  232. </if>
  233. </update>
  234. <update id="updateByExample" parameterType="map">
  235. <!--
  236. WARNING - @mbg.generated
  237. This element is automatically generated by MyBatis Generator, do not modify.
  238. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  239. -->
  240. update city
  241. set id = #{record.id,jdbcType=INTEGER},
  242. parent_id = #{record.parentId,jdbcType=INTEGER},
  243. name = #{record.name,jdbcType=VARCHAR},
  244. type = #{record.type,jdbcType=INTEGER},
  245. pinyin = #{record.pinyin,jdbcType=VARCHAR}
  246. <if test="_parameter != null">
  247. <include refid="Update_By_Example_Where_Clause" />
  248. </if>
  249. </update>
  250. <update id="updateByPrimaryKeySelective" parameterType="com.hssx.model.City">
  251. <!--
  252. WARNING - @mbg.generated
  253. This element is automatically generated by MyBatis Generator, do not modify.
  254. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  255. -->
  256. update city
  257. <set>
  258. <if test="parentId != null">
  259. parent_id = #{parentId,jdbcType=INTEGER},
  260. </if>
  261. <if test="name != null">
  262. name = #{name,jdbcType=VARCHAR},
  263. </if>
  264. <if test="type != null">
  265. type = #{type,jdbcType=INTEGER},
  266. </if>
  267. <if test="pinyin != null">
  268. pinyin = #{pinyin,jdbcType=VARCHAR},
  269. </if>
  270. </set>
  271. where id = #{id,jdbcType=INTEGER}
  272. </update>
  273. <update id="updateByPrimaryKey" parameterType="com.hssx.model.City">
  274. <!--
  275. WARNING - @mbg.generated
  276. This element is automatically generated by MyBatis Generator, do not modify.
  277. This element was generated on Sat Oct 12 18:08:00 CST 2019.
  278. -->
  279. update city
  280. set parent_id = #{parentId,jdbcType=INTEGER},
  281. name = #{name,jdbcType=VARCHAR},
  282. type = #{type,jdbcType=INTEGER},
  283. pinyin = #{pinyin,jdbcType=VARCHAR}
  284. where id = #{id,jdbcType=INTEGER}
  285. </update>
  286. </mapper>