TbAreaMangeSMapper.xml 2.07 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zteits.sys.mapper.smapper.TbAreaManageMapper">
    <resultMap id="BaseResultMap" type="com.zteits.clouds.api.dto.sys.param.AreaListTreeDTO">
        <id column="id" jdbcType="BIGINT" property="id" />
        <result column="area_code" jdbcType="BIGINT" property="value" />
        <result column="area_name" jdbcType="VARCHAR" property="label" />
        <result column="area_type" jdbcType="INTEGER" property="areaType" />
        <result column="parent_id" jdbcType="BIGINT" property="parentId" />
        <result column="data_state" jdbcType="INTEGER" property="dataState" />
        <result column="sort_num" jdbcType="INTEGER" property="sortNum" />
        <result column="car_number_head" jdbcType="VARCHAR" property="carNumberHead" />
    </resultMap>
  <sql id="Base_Column_List">
    id, area_code, area_name, area_type, parent_id, data_state, car_number_head,sort_num
  </sql>

    <!-- 根据地域类型查询所有地域-->
    <select id="InitAreaList" resultMap="BaseResultMap">
        SELECT  <include refid="Base_Column_List" />
        from tb_area
        WHERE  data_state = 1

    </select>

    <!-- 根据地域类型查询所有地域-->
    <select id="areaBlockByAreaId" parameterType="com.zteits.clouds.api.dto.park.param.closecarpark.QueryAreaBlockRequest"
            resultType="com.zteits.clouds.api.dto.park.dto.AreaBlockListDTO">
        SELECT
        c.id,
        c.area_code areaCode,
        c.area_name areaName,
        c.area_type areaType,
        c.parent_id parentId,
        c.org_id orgId,
        c.data_state dataState
        FROM
        tb_area_block c
        WHERE  c.data_state=1
        <if test="orgId != null and orgId !='' and orgId !='-1' ">
            and c.org_id=#{orgId}
        </if>
        <if test="parentId != null and parentId !=''">
            and c.parent_id=#{parentId}
        </if>
        and c.area_type=#{areaType}
        order by c.area_name

    </select>
  
</mapper>