<?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="org.springblade.modules.yjxt.base.map.mapper.DangerAreaLeaveLineMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="dangerAreaLineResultMap" type="org.springblade.modules.yjxt.base.map.entity.DangerAreaLeaveLineEntity">

        <result column="leave_line_pid" property="leaveLinePid"/>
        <result column="leave_line_name" property="leaveLineName"/>
        <result column="adcd" property="adcd"/>
        <result column="address" property="address"/>
        <result column="remark" property="remark"/>
        <result column="center_point_lng" property="centerPointLng"/>
        <result column="center_point_lat" property="centerPointLat"/>
    </resultMap>


    <resultMap id="dangerAreaLineResultVOMap" type="org.springblade.modules.yjxt.base.map.vo.DangerAreaLeaveLineVO">

        <result column="leave_line_pid" property="leaveLinePid"/>
        <result column="leave_line_name" property="leaveLineName"/>
        <result column="adcd" property="adcd"/>
        <result column="address" property="address"/>
        <result column="remark" property="remark"/>
        <result column="center_point_lng" property="centerPointLng"/>
        <result column="center_point_lat" property="centerPointLat"/>
        <result column="adnm" property="adnm"/>
    </resultMap>


    <select id="selectPage" resultMap="dangerAreaLineResultVOMap">
        SELECT
        d.*,a.adnm
        FROM
        map_danger_leave_line d
        LEFT JOIN base_data_ad_cd a ON a.adcd = d.adcd
        WHERE
        d.is_deleted = 0
        <if test="dto.leaveLineName!=null">
            and d.leave_line_name like concat(concat('%', #{dto.leaveLineName}), '%')
        </if>
        order by d.adcd
    </select>

    <select id="selectAdDangerArea" resultMap="dangerAreaLineResultVOMap">
        SELECT
        d.*,a.adnm
        FROM
        map_danger_leave_line d
        LEFT JOIN base_data_ad_cd a ON a.adcd = d.adcd
        WHERE
        d.is_deleted = 0
        <if test="dto.adcd!=null">
            and d.adcd = #{dto.adcd}
        </if>
        order by d.adcd
    </select>
</mapper>
