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

    <resultMap type="cn.cecep.talroad.domain.BasControlValue" id="BasControlValueResult">
        <result property="dataId"    column="data_id"    />
        <result property="factoryId"    column="factory_id"    />
        <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="selectBasControlValueVo">
        select data_id, factory_id,industry,device_type, normal_value, remark, create_time from bas_control_value
    </sql>

    <select id="selectBasControlValueList" parameterType="cn.cecep.talroad.domain.BasControlValue" resultMap="BasControlValueResult">
        <include refid="selectBasControlValueVo"/>
        <where>
            <if test="factoryId != null  and factoryId != ''"> and factory_id = #{factoryId}</if>
            <if test="normalValue != null  and normalValue != ''"> and normal_value = #{normalValue}</if>
        </where>
    </select>
    <select id="selectByFactoryId" resultMap="BasControlValueResult">
        <include refid="selectBasControlValueVo"></include>
        where factory_id = #{factoryId} and industry = #{industry} and device_type=#{deviceType} limit 1
    </select>

</mapper>
