<?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.BMainHazardousSolidWasteLeMapper">

    <resultMap type="cn.cecep.talroad.domain.BMainHazardousSolidWasteLe" id="BMainHazardousSolidWasteLeResult">
        <result property="id"    column="id"    />
        <result property="factoryId"    column="factory_id"    />
        <result property="solidWasteId"    column="solid_waste_id"    />
        <result property="selfDisposalVolume"    column="self_disposal_volume"    />
        <result property="entrustedDisposalVolume"    column="entrusted_disposal_volume"    />
        <result property="entrustedDisposalUnitName"    column="entrusted_disposal_unit_name"    />
        <result property="hazardousWasteUnitName"    column="hazardous_waste_unit_name"    />
        <result property="hazardousWasteLicenceCode"    column="hazardous_waste_licence_code"    />
        <result property="storageFacilityName"    column="storage_facility_name"    />
        <result property="storageFacilityCode"    column="storage_facility_code"    />
        <result property="videoSurveillance"    column="video_surveillance"    />
    </resultMap>


    <sql id="selectBMainHazardousSolidWasteLeVo">
        select id, factory_id, solid_waste_id, self_disposal_volume, entrusted_disposal_volume, entrusted_disposal_unit_name, hazardous_waste_unit_name, hazardous_waste_licence_code, storage_facility_name, storage_facility_code, video_surveillance from b_main_hazardous_solid_waste_le
    </sql>

    <select id="selectBMainHazardousSolidWasteLeList" parameterType="cn.cecep.talroad.domain.BMainHazardousSolidWasteLe" resultMap="BMainHazardousSolidWasteLeResult">
        <include refid="selectBMainHazardousSolidWasteLeVo"/>
        <where>
            <if test="factoryId != null  and factoryId != ''"> and factory_id = #{factoryId}</if>
            <if test="solidWasteId != null  and solidWasteId != ''"> and solid_waste_id = #{solidWasteId}</if>
            <if test="selfDisposalVolume != null  and selfDisposalVolume != ''"> and self_disposal_volume = #{selfDisposalVolume}</if>
            <if test="entrustedDisposalVolume != null  and entrustedDisposalVolume != ''"> and entrusted_disposal_volume = #{entrustedDisposalVolume}</if>
            <if test="entrustedDisposalUnitName != null  and entrustedDisposalUnitName != ''"> and entrusted_disposal_unit_name like concat('%', #{entrustedDisposalUnitName}, '%')</if>
            <if test="hazardousWasteUnitName != null  and hazardousWasteUnitName != ''"> and hazardous_waste_unit_name like concat('%', #{hazardousWasteUnitName}, '%')</if>
            <if test="hazardousWasteLicenceCode != null  and hazardousWasteLicenceCode != ''"> and hazardous_waste_licence_code = #{hazardousWasteLicenceCode}</if>
            <if test="storageFacilityName != null  and storageFacilityName != ''"> and storage_facility_name like concat('%', #{storageFacilityName}, '%')</if>
            <if test="storageFacilityCode != null  and storageFacilityCode != ''"> and storage_facility_code = #{storageFacilityCode}</if>
            <if test="videoSurveillance != null  and videoSurveillance != ''"> and video_surveillance = #{videoSurveillance}</if>
        </where>
    </select>

</mapper>
