FsCityMapper.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.fs.his.mapper.FsCityMapper">
  6. <resultMap type="FsCity" id="FsCityResult">
  7. <result property="id" column="id" />
  8. <result property="cityId" column="city_id" />
  9. <result property="cityName" column="city_name" />
  10. <result property="citySname" column="city_sname" />
  11. <result property="parentId" column="parent_id" />
  12. <result property="spell" column="spell" />
  13. <result property="cityType" column="city_type" />
  14. <result property="sort" column="sort" />
  15. <result property="level" column="level" />
  16. <result property="lng" column="lng" />
  17. <result property="lat" column="lat" />
  18. </resultMap>
  19. <sql id="selectFsCityVo">
  20. select id, city_id, city_name, city_sname, parent_id, spell, city_type, sort, level, lng, lat from fs_city
  21. </sql>
  22. <select id="selectFsCityList" parameterType="FsCity" resultMap="FsCityResult">
  23. <include refid="selectFsCityVo"/>
  24. <where>
  25. <if test="cityId != null and cityId != ''"> and city_id = #{cityId}</if>
  26. <if test="cityName != null and cityName != ''"> and city_name like concat('%', #{cityName}, '%')</if>
  27. <if test="citySname != null and citySname != ''"> and city_sname like concat('%', #{citySname}, '%')</if>
  28. <if test="parentId != null and parentId != ''"> and parent_id = #{parentId}</if>
  29. <if test="spell != null and spell != ''"> and spell = #{spell}</if>
  30. <if test="cityType != null "> and city_type = #{cityType}</if>
  31. <if test="sort != null "> and sort = #{sort}</if>
  32. <if test="level != null "> and level = #{level}</if>
  33. <if test="lng != null and lng != ''"> and lng = #{lng}</if>
  34. <if test="lat != null and lat != ''"> and lat = #{lat}</if>
  35. </where>
  36. </select>
  37. <select id="selectFsCityById" parameterType="Long" resultMap="FsCityResult">
  38. <include refid="selectFsCityVo"/>
  39. where id = #{id}
  40. </select>
  41. <insert id="insertFsCity" parameterType="FsCity" useGeneratedKeys="true" keyProperty="id">
  42. insert into fs_city
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="cityId != null and cityId != ''">city_id,</if>
  45. <if test="cityName != null and cityName != ''">city_name,</if>
  46. <if test="citySname != null">city_sname,</if>
  47. <if test="parentId != null and parentId != ''">parent_id,</if>
  48. <if test="spell != null and spell != ''">spell,</if>
  49. <if test="cityType != null">city_type,</if>
  50. <if test="sort != null">sort,</if>
  51. <if test="level != null">level,</if>
  52. <if test="lng != null">lng,</if>
  53. <if test="lat != null">lat,</if>
  54. </trim>
  55. <trim prefix="values (" suffix=")" suffixOverrides=",">
  56. <if test="cityId != null and cityId != ''">#{cityId},</if>
  57. <if test="cityName != null and cityName != ''">#{cityName},</if>
  58. <if test="citySname != null">#{citySname},</if>
  59. <if test="parentId != null and parentId != ''">#{parentId},</if>
  60. <if test="spell != null and spell != ''">#{spell},</if>
  61. <if test="cityType != null">#{cityType},</if>
  62. <if test="sort != null">#{sort},</if>
  63. <if test="level != null">#{level},</if>
  64. <if test="lng != null">#{lng},</if>
  65. <if test="lat != null">#{lat},</if>
  66. </trim>
  67. </insert>
  68. <update id="updateFsCity" parameterType="FsCity">
  69. update fs_city
  70. <trim prefix="SET" suffixOverrides=",">
  71. <if test="cityId != null and cityId != ''">city_id = #{cityId},</if>
  72. <if test="cityName != null and cityName != ''">city_name = #{cityName},</if>
  73. <if test="citySname != null">city_sname = #{citySname},</if>
  74. <if test="parentId != null and parentId != ''">parent_id = #{parentId},</if>
  75. <if test="spell != null and spell != ''">spell = #{spell},</if>
  76. <if test="cityType != null">city_type = #{cityType},</if>
  77. <if test="sort != null">sort = #{sort},</if>
  78. <if test="level != null">level = #{level},</if>
  79. <if test="lng != null">lng = #{lng},</if>
  80. <if test="lat != null">lat = #{lat},</if>
  81. </trim>
  82. where id = #{id}
  83. </update>
  84. <delete id="deleteFsCityById" parameterType="Long">
  85. delete from fs_city where id = #{id}
  86. </delete>
  87. <delete id="deleteFsCityByIds" parameterType="String">
  88. delete from fs_city where id in
  89. <foreach item="id" collection="array" open="(" separator="," close=")">
  90. #{id}
  91. </foreach>
  92. </delete>
  93. </mapper>