SysAreaMapper.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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.ruoyi.system.mapper.SysAreaMapper">
  6. <resultMap type="SysArea" id="SysAreaResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="pid" column="pid" />
  10. <result property="provinceCode" column="province_code" />
  11. <result property="cityCode" column="city_code" />
  12. <result property="areaCode" column="area_code" />
  13. <result property="streetCode" column="street_code" />
  14. <result property="committeeCode" column="committee_code" />
  15. <result property="committeeType" column="committee_type" />
  16. <result property="sort" column="sort" />
  17. <result property="level" column="level" />
  18. <result property="leaf" column="leaf" />
  19. <result property="createBy" column="create_by" />
  20. <result property="createTime" column="create_time" />
  21. <result property="updateBy" column="update_by" />
  22. <result property="updateTime" column="update_time" />
  23. </resultMap>
  24. <sql id="selectSysAreaVo">
  25. select id, name, pid, province_code, city_code, area_code, street_code, committee_code, committee_type, sort, level, leaf, create_by, create_time, update_by, update_time from sys_area
  26. </sql>
  27. <select id="selectSimpleSysAreaList" parameterType="SysArea" resultMap="SysAreaResult">
  28. select id, name, pid, province_code, city_code, area_code, level, leaf from sys_area
  29. <where>
  30. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  31. <if test="pid != null "> and pid = #{pid}</if>
  32. <if test="provinceCode != null "> and province_code = #{provinceCode}</if>
  33. <if test="cityCode != null "> and city_code = #{cityCode}</if>
  34. <if test="areaCode != null "> and area_code = #{areaCode}</if>
  35. <if test="streetCode != null "> and street_code = #{streetCode}</if>
  36. <if test="committeeCode != null "> and committee_code = #{committeeCode}</if>
  37. <if test="committeeType != null "> and committee_type = #{committeeType}</if>
  38. <if test="sort != null "> and sort = #{sort}</if>
  39. <if test="level != null "> and level = #{level}</if>
  40. <if test="leaf != null "> and leaf = #{leaf}</if>
  41. </where>
  42. order by pid, sort
  43. </select>
  44. <select id="selectSysAreaList" parameterType="SysArea" resultMap="SysAreaResult">
  45. <include refid="selectSysAreaVo"/>
  46. <where>
  47. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  48. <if test="pid != null "> and pid = #{pid}</if>
  49. <if test="provinceCode != null "> and province_code = #{provinceCode}</if>
  50. <if test="cityCode != null "> and city_code = #{cityCode}</if>
  51. <if test="areaCode != null "> and area_code = #{areaCode}</if>
  52. <if test="streetCode != null "> and street_code = #{streetCode}</if>
  53. <if test="committeeCode != null "> and committee_code = #{committeeCode}</if>
  54. <if test="committeeType != null "> and committee_type = #{committeeType}</if>
  55. <if test="sort != null "> and sort = #{sort}</if>
  56. <if test="level != null "> and level = #{level}</if>
  57. <if test="leaf != null "> and leaf = #{leaf}</if>
  58. </where>
  59. </select>
  60. <select id="selectSysAreaById" parameterType="Long" resultMap="SysAreaResult">
  61. <include refid="selectSysAreaVo"/>
  62. where id = #{id}
  63. </select>
  64. <insert id="insertSysArea" parameterType="SysArea">
  65. insert into sys_area
  66. <trim prefix="(" suffix=")" suffixOverrides=",">
  67. <if test="id != null">id,</if>
  68. <if test="name != null">name,</if>
  69. <if test="pid != null">pid,</if>
  70. <if test="provinceCode != null">province_code,</if>
  71. <if test="cityCode != null">city_code,</if>
  72. <if test="areaCode != null">area_code,</if>
  73. <if test="streetCode != null">street_code,</if>
  74. <if test="committeeCode != null">committee_code,</if>
  75. <if test="committeeType != null">committee_type,</if>
  76. <if test="sort != null">sort,</if>
  77. <if test="level != null">level,</if>
  78. <if test="leaf != null">leaf,</if>
  79. <if test="createBy != null">create_by,</if>
  80. <if test="createTime != null">create_time,</if>
  81. <if test="updateBy != null">update_by,</if>
  82. <if test="updateTime != null">update_time,</if>
  83. </trim>
  84. <trim prefix="values (" suffix=")" suffixOverrides=",">
  85. <if test="id != null">#{id},</if>
  86. <if test="name != null">#{name},</if>
  87. <if test="pid != null">#{pid},</if>
  88. <if test="provinceCode != null">#{provinceCode},</if>
  89. <if test="cityCode != null">#{cityCode},</if>
  90. <if test="areaCode != null">#{areaCode},</if>
  91. <if test="streetCode != null">#{streetCode},</if>
  92. <if test="committeeCode != null">#{committeeCode},</if>
  93. <if test="committeeType != null">#{committeeType},</if>
  94. <if test="sort != null">#{sort},</if>
  95. <if test="level != null">#{level},</if>
  96. <if test="leaf != null">#{leaf},</if>
  97. <if test="createBy != null">#{createBy},</if>
  98. <if test="createTime != null">#{createTime},</if>
  99. <if test="updateBy != null">#{updateBy},</if>
  100. <if test="updateTime != null">#{updateTime},</if>
  101. </trim>
  102. </insert>
  103. <update id="updateSysArea" parameterType="SysArea">
  104. update sys_area
  105. <trim prefix="SET" suffixOverrides=",">
  106. <if test="name != null">name = #{name},</if>
  107. <if test="pid != null">pid = #{pid},</if>
  108. <if test="provinceCode != null">province_code = #{provinceCode},</if>
  109. <if test="cityCode != null">city_code = #{cityCode},</if>
  110. <if test="areaCode != null">area_code = #{areaCode},</if>
  111. <if test="streetCode != null">street_code = #{streetCode},</if>
  112. <if test="committeeCode != null">committee_code = #{committeeCode},</if>
  113. <if test="committeeType != null">committee_type = #{committeeType},</if>
  114. <if test="sort != null">sort = #{sort},</if>
  115. <if test="level != null">level = #{level},</if>
  116. <if test="leaf != null">leaf = #{leaf},</if>
  117. <if test="createBy != null">create_by = #{createBy},</if>
  118. <if test="createTime != null">create_time = #{createTime},</if>
  119. <if test="updateBy != null">update_by = #{updateBy},</if>
  120. <if test="updateTime != null">update_time = #{updateTime},</if>
  121. </trim>
  122. where id = #{id}
  123. </update>
  124. <delete id="deleteSysAreaById" parameterType="Long">
  125. delete from sys_area where id = #{id}
  126. </delete>
  127. <delete id="deleteSysAreaByIds" parameterType="String">
  128. delete from sys_area where id in
  129. <foreach item="id" collection="array" open="(" separator="," close=")">
  130. #{id}
  131. </foreach>
  132. </delete>
  133. </mapper>