RegionMapper.xml 1.1 KB

123456789101112131415161718192021222324252627282930
  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.demo.wjj.mapper.RegionMapper">
  4. <resultMap id="region" type="com.demo.wjj.po.Region">
  5. <id column="id" property="id"/>
  6. <result column="name" property="name"/>
  7. <result column="region_type" property="regionType"/>
  8. </resultMap>
  9. <!--查询区域-->
  10. <select id="selectRegion" resultMap="region">
  11. SELECT r.id, r.name, r.region_type
  12. FROM tb_region r
  13. WHERE r.can_enable = 1 AND r.region_type = #{regionType}
  14. <if test="parentId != null">
  15. AND r.parent_id = #{parentId}
  16. </if>
  17. ORDER BY r.sort_no, r.name
  18. </select>
  19. <select id="selectRegionList" resultMap="region">
  20. SELECT r.id, r.name, r.region_type
  21. FROM tb_region r
  22. WHERE r.can_enable = 1 AND r.id IN
  23. <foreach collection="ids" item="id" separator="," open="(" close=")">
  24. #{id}
  25. </foreach>
  26. </select>
  27. </mapper>