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

    <resultMap type="cn.cecep.talroad.domain.BMainSolidWasteOutput" id="BMainSolidWasteOutputResult">
        <result property="id"    column="id"    />
        <result property="factoryId"    column="factory_id"    />
        <result property="particularYear"    column="particular_year"    />
        <result property="particularMonth"    column="particular_month"    />
        <result property="materialsType"    column="materials_type"    />
        <result property="materialsCode"    column="materials_code"    />
        <result property="materialsName"    column="materials_name"    />
        <result property="materialsOutput"    column="materials_output"    />
        <result property="materialsPreliminaryStage"    column="materials_preliminary_stage"    />
        <result property="materialsAccumulated"    column="materials_accumulated"    />
        <result property="materialsUse"    column="materials_use"    />
        <result property="materialsDispose"    column="materials_dispose"    />
        <result property="materialsEntrustUse"    column="materials_entrust_use"    />
        <result property="materialsEntrustDispose"    column="materials_entrust_dispose"    />
    </resultMap>


    <sql id="selectBMainSolidWasteOutputVo">
        select id, factory_id, particular_year, particular_month, materials_type, materials_code, materials_name, materials_output, materials_preliminary_stage, materials_accumulated, materials_use, materials_dispose, materials_entrust_use, materials_entrust_dispose from b_main_solid_waste_output
    </sql>

    <select id="selectBMainSolidWasteOutputList" parameterType="cn.cecep.talroad.domain.BMainSolidWasteOutput" resultMap="BMainSolidWasteOutputResult">
        <include refid="selectBMainSolidWasteOutputVo"/>
        <where>
            <if test="factoryId != null  and factoryId != ''"> and factory_id = #{factoryId}</if>
            <if test="particularYear != null  and particularYear != ''"> and particular_year = #{particularYear}</if>
            <if test="particularMonth != null  and particularMonth != ''"> and particular_month = #{particularMonth}</if>
            <if test="materialsType != null  and materialsType != ''"> and materials_type = #{materialsType}</if>
            <if test="materialsCode != null  and materialsCode != ''"> and materials_code = #{materialsCode}</if>
            <if test="materialsName != null  and materialsName != ''"> and materials_name like concat('%', #{materialsName}, '%')</if>
            <if test="materialsOutput != null  and materialsOutput != ''"> and materials_output = #{materialsOutput}</if>
            <if test="materialsPreliminaryStage != null  and materialsPreliminaryStage != ''"> and materials_preliminary_stage = #{materialsPreliminaryStage}</if>
            <if test="materialsAccumulated != null  and materialsAccumulated != ''"> and materials_accumulated = #{materialsAccumulated}</if>
            <if test="materialsUse != null  and materialsUse != ''"> and materials_use = #{materialsUse}</if>
            <if test="materialsDispose != null  and materialsDispose != ''"> and materials_dispose = #{materialsDispose}</if>
            <if test="materialsEntrustUse != null  and materialsEntrustUse != ''"> and materials_entrust_use = #{materialsEntrustUse}</if>
            <if test="materialsEntrustDispose != null  and materialsEntrustDispose != ''"> and materials_entrust_dispose = #{materialsEntrustDispose}</if>
        </where>
    </select>

</mapper>
