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

    <resultMap type="cn.cecep.talroad.domain.SMainDynamicControl" id="SMainDynamicControlResult">
        <result property="id"    column="id"    />
        <result property="factoryId"    column="factory_id"    />
        <result property="outletId"    column="outlet_id"    />
        <result property="equipmentBrandCems"    column="equipment_brand_cems"    />
        <result property="equipmentState"    column="equipment_state"    />
        <result property="controlTypeCode"    column="control_type_code"    />
        <result property="controlTypeName"    column="control_type_name"    />
    </resultMap>


    <sql id="selectSMainDynamicControlVo">
        select id, factory_id, outlet_id, equipment_brand_cems, equipment_state, control_type_code, control_type_name from s_main_dynamic_control
    </sql>

    <select id="selectSMainDynamicControlList" parameterType="cn.cecep.talroad.domain.SMainDynamicControl" resultMap="SMainDynamicControlResult">
        <include refid="selectSMainDynamicControlVo"/>
        <where>
            <if test="factoryId != null  and factoryId != ''"> and factory_id = #{factoryId}</if>
            <if test="outletId != null  and outletId != ''"> and outlet_id = #{outletId}</if>
            <if test="equipmentBrandCems != null  and equipmentBrandCems != ''"> and equipment_brand_cems = #{equipmentBrandCems}</if>
            <if test="equipmentState != null  and equipmentState != ''"> and equipment_state = #{equipmentState}</if>
            <if test="controlTypeCode != null  and controlTypeCode != ''"> and control_type_code = #{controlTypeCode}</if>
            <if test="controlTypeName != null  and controlTypeName != ''"> and control_type_name like concat('%', #{controlTypeName}, '%')</if>
        </where>
    </select>

</mapper>
