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

    <resultMap type="cn.cecep.talroad.domain.BasDeviceConfig" id="BasDeviceConfigResult">
        <result property="dataId"    column="data_id"    />
        <result property="factoryId"    column="factory_id"    />
        <result property="deviceId"    column="device_id"    />
        <result property="deviceName"    column="device_name"    />
        <result property="paramCode"    column="param_code"    />
        <result property="paramName"    column="param_name"    />
        <result property="unit"    column="unit"    />
        <result property="industry"    column="industry"    />
        <result property="deviceType"    column="device_type"    />
        <result property="normalValue"    column="normal_value"    />
        <result property="remark"    column="remark"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>


    <sql id="selectBasDeviceConfigVo">
        select data_id, factory_id, device_id, device_name, param_code, param_name, unit, industry, device_type, normal_value, remark, create_time from bas_device_config
    </sql>

    <select id="selectBasDeviceConfigList" parameterType="cn.cecep.talroad.domain.BasDeviceConfig" resultMap="BasDeviceConfigResult">
        <include refid="selectBasDeviceConfigVo"/>
        <where>
            <if test="factoryId != null  and factoryId != ''"> and factory_id = #{factoryId}</if>
            <if test="deviceId != null  and deviceId != ''"> and device_id = #{deviceId}</if>
            <if test="deviceName != null  and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
            <if test="paramCode != null  and paramCode != ''"> and param_code = #{paramCode}</if>
            <if test="paramName != null  and paramName != ''"> and param_name like concat('%', #{paramName}, '%')</if>
            <if test="unit != null  and unit != ''"> and unit = #{unit}</if>
            <if test="industry != null  and industry != ''"> and industry = #{industry}</if>
            <if test="deviceType != null  and deviceType != ''"> and device_type = #{deviceType}</if>
            <if test="normalValue != null  and normalValue != ''"> and normal_value = #{normalValue}</if>
        </where>
    </select>

</mapper>
