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

    <resultMap type="cn.cecep.talroad.domain.BasElecDevice" id="BasElecDeviceResult">
        <result property="elecDeviceId"    column="elec_device_id"    />
        <result property="factoryId"    column="factory_id"    />
        <result property="name"    column="name"    />
        <result property="industry"    column="industry"    />
        <result property="memo"    column="memo"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>


    <sql id="selectBasElecDeviceVo">
        select elec_device_id, factory_id, name, industry, memo, create_time from bas_elec_device
    </sql>

    <select id="selectBasElecDeviceList" parameterType="cn.cecep.talroad.domain.BasElecDevice" resultMap="BasElecDeviceResult">
        <include refid="selectBasElecDeviceVo"/>
        <where>
            <if test="factoryId != null "> and factory_id = #{factoryId}</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="industry != null  and industry != ''"> and industry = #{industry}</if>
            <if test="memo != null  and memo != ''"> and memo = #{memo}</if>
        </where>
    </select>

</mapper>
