<?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="cn.cecep.talroad.mapper.BMainSolidHazardousMapper">

    <resultMap type="cn.cecep.talroad.domain.BMainSolidHazardous" id="BMainSolidHazardousResult">
        <result property="id"    column="id"    />
        <result property="factoryId"    column="factory_id"    />
        <result property="facilityName"    column="facility_name"    />
        <result property="facilityCode"    column="facility_code"    />
    </resultMap>


    <sql id="selectBMainSolidHazardousVo">
        select id, factory_id, facility_name, facility_code from b_main_solid_hazardous
    </sql>

    <select id="selectBMainSolidHazardousList" parameterType="cn.cecep.talroad.domain.BMainSolidHazardous" resultMap="BMainSolidHazardousResult">
        <include refid="selectBMainSolidHazardousVo"/>
        <where>
            <if test="factoryId != null  and factoryId != ''"> and factory_id = #{factoryId}</if>
            <if test="facilityName != null  and facilityName != ''"> and facility_name like concat('%', #{facilityName}, '%')</if>
            <if test="facilityCode != null  and facilityCode != ''"> and facility_code = #{facilityCode}</if>
        </where>
    </select>

</mapper>
