<?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.ruoyi.zdsz.mapper.ZEngineeringPipeJackingMapper">

    <resultMap type="com.ruoyi.zdsz.domain.ZEngineeringPipeJacking" id="ZEngineeringPipeJackingResult">
        <result property="id" column="id"/>
        <result property="enginName" column="engin_name"/>
        <result property="enginAddre" column="engin_addre"/>
        <result property="enginCode" column="engin_code"/>
        <result property="constructUnit" column="construct_unit"/>
        <result property="enginScale" column="engin_scale"/>
        <result property="constructQuality" column="construct_quality"/>
        <result property="constructSchedule" column="construct_schedule"/>
        <result property="version" column="version"/>
        <result property="remark" column="remark"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <select id="getCivil" resultType="java.util.Map">
        SELECT
            m.*,
            CONCAT(
                COALESCE ( area.NAME, '无' ),
                '-',
                COALESCE ( build.NAME, '无' ),
                '-',
                COALESCE ( unit.NAME, '无' ),
                '-',
                COALESCE ( house.NAME, '无' )
            ) AS name
        FROM
            z_engineering_civil as m
                left join z_area as area on area.del_flag = '0' and area.id = m.area_id
                left join z_building as build on build.del_flag = '0' and build.id = m.building_id
                left join z_unit as unit on unit.del_flag = '0' and unit.id = m.unit_id
                left join z_house as house on house.del_flag = '0' and house.id = m.house_id
        WHERE
            m.del_flag = '0'  and m.id = #{enginId}
    </select>
    <select id="getIndustry" resultType="java.util.Map">
        SELECT
            m.id,m.engin_name as name
        FROM
            z_engineering_industry as m
        WHERE
            m.del_flag = '0'  and m.id = #{enginId}
    </select>
    <select id="getDangerous" resultType="java.util.Map">
        SELECT
            m.id,m.engin_name as name,engin_addre as address
        FROM
            z_engineering_dangerous as m
        WHERE
            m.del_flag = '0'  and m.id = #{enginId}
    </select>
    <select id="getInfrastructure" resultType="java.util.Map">
        SELECT
            m.id,m.engin_name as name,engin_addre as address
        FROM
            z_engineering_infrastructure as m
        WHERE
            m.del_flag = '0'  and m.id = #{enginId}
    </select>
    <select id="getSg" resultType="java.util.Map">
        SELECT
            m.id,m.engin_name as name
        FROM
            z_engineering_industry as m
        WHERE
            m.del_flag = '0'  and m.id = #{enginId}
    </select>
    <select id="nameList" resultType="java.util.Map">
        select id,engin_name as name from z_engineering_pipe_jacking where del_flag = '0'
        <if test="enginName != null  and enginName != ''">
            and engin_name like concat('%',#{enginName},'%')
        </if>
    </select>
</mapper>
