SysCnareaMapper.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zdqz.system.mapper.SysCnareaMapper">
  6. <resultMap type="SysCnarea" id="SysCnareaResult">
  7. <result property="id" column="id" />
  8. <result property="level" column="level" />
  9. <result property="parentCode" column="parent_code" />
  10. <result property="areaCode" column="area_code" />
  11. <result property="zipCode" column="zip_code" />
  12. <result property="cityCode" column="city_code" />
  13. <result property="name" column="name" />
  14. <result property="shortName" column="short_name" />
  15. <result property="mergerName" column="merger_name" />
  16. <result property="pinyin" column="pinyin" />
  17. <result property="lng" column="lng" />
  18. <result property="lat" column="lat" />
  19. </resultMap>
  20. <sql id="selectSysCnareaVo">
  21. select id, level, parent_code, area_code, zip_code, city_code, name, short_name, merger_name, pinyin, lng, lat from sys_cnarea_2023
  22. </sql>
  23. <select id="selectSysCnareaList" parameterType="SysCnarea" resultMap="SysCnareaResult">
  24. <include refid="selectSysCnareaVo"/>
  25. <where>
  26. <if test="level != null and level != ''"> and level = #{level}</if>
  27. <if test="parentCode != null and parentCode != ''"> and parent_code = #{parentCode}</if>
  28. <if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
  29. <if test="zipCode != null "> and zip_code = #{zipCode}</if>
  30. <if test="cityCode != null and cityCode != ''"> and city_code = #{cityCode}</if>
  31. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  32. <if test="shortName != null and shortName != ''"> and short_name like concat('%', #{shortName}, '%')</if>
  33. <if test="mergerName != null and mergerName != ''"> and merger_name like concat('%', #{mergerName}, '%')</if>
  34. <if test="pinyin != null and pinyin != ''"> and pinyin = #{pinyin}</if>
  35. <if test="lng != null "> and lng = #{lng}</if>
  36. <if test="lat != null "> and lat = #{lat}</if>
  37. </where>
  38. </select>
  39. <select id="selectSysCnareaById" parameterType="String" resultMap="SysCnareaResult">
  40. <include refid="selectSysCnareaVo"/>
  41. where id = #{id}
  42. </select>
  43. <insert id="insertSysCnarea" parameterType="SysCnarea" useGeneratedKeys="true" keyProperty="id">
  44. insert into sys_cnarea_2023
  45. <trim prefix="(" suffix=")" suffixOverrides=",">
  46. <if test="level != null and level != ''">level,</if>
  47. <if test="parentCode != null and parentCode != ''">parent_code,</if>
  48. <if test="areaCode != null and areaCode != ''">area_code,</if>
  49. <if test="zipCode != null">zip_code,</if>
  50. <if test="cityCode != null and cityCode != ''">city_code,</if>
  51. <if test="name != null and name != ''">name,</if>
  52. <if test="shortName != null and shortName != ''">short_name,</if>
  53. <if test="mergerName != null and mergerName != ''">merger_name,</if>
  54. <if test="pinyin != null and pinyin != ''">pinyin,</if>
  55. <if test="lng != null">lng,</if>
  56. <if test="lat != null">lat,</if>
  57. </trim>
  58. <trim prefix="values (" suffix=")" suffixOverrides=",">
  59. <if test="level != null and level != ''">#{level},</if>
  60. <if test="parentCode != null and parentCode != ''">#{parentCode},</if>
  61. <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
  62. <if test="zipCode != null">#{zipCode},</if>
  63. <if test="cityCode != null and cityCode != ''">#{cityCode},</if>
  64. <if test="name != null and name != ''">#{name},</if>
  65. <if test="shortName != null and shortName != ''">#{shortName},</if>
  66. <if test="mergerName != null and mergerName != ''">#{mergerName},</if>
  67. <if test="pinyin != null and pinyin != ''">#{pinyin},</if>
  68. <if test="lng != null">#{lng},</if>
  69. <if test="lat != null">#{lat},</if>
  70. </trim>
  71. </insert>
  72. <update id="updateSysCnarea" parameterType="SysCnarea">
  73. update sys_cnarea_2023
  74. <trim prefix="SET" suffixOverrides=",">
  75. <if test="level != null and level != ''">level = #{level},</if>
  76. <if test="parentCode != null and parentCode != ''">parent_code = #{parentCode},</if>
  77. <if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
  78. <if test="zipCode != null">zip_code = #{zipCode},</if>
  79. <if test="cityCode != null and cityCode != ''">city_code = #{cityCode},</if>
  80. <if test="name != null and name != ''">name = #{name},</if>
  81. <if test="shortName != null and shortName != ''">short_name = #{shortName},</if>
  82. <if test="mergerName != null and mergerName != ''">merger_name = #{mergerName},</if>
  83. <if test="pinyin != null and pinyin != ''">pinyin = #{pinyin},</if>
  84. <if test="lng != null">lng = #{lng},</if>
  85. <if test="lat != null">lat = #{lat},</if>
  86. </trim>
  87. where id = #{id}
  88. </update>
  89. <delete id="deleteSysCnareaById" parameterType="String">
  90. delete from sys_cnarea_2023 where id = #{id}
  91. </delete>
  92. <delete id="deleteSysCnareaByIds" parameterType="String">
  93. delete from sys_cnarea_2023 where id in
  94. <foreach item="id" collection="array" open="(" separator="," close=")">
  95. #{id}
  96. </foreach>
  97. </delete>
  98. </mapper>