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

    <resultMap type="cn.cecep.talroad.domain.BasThresholdConfig" id="BasThresholdConfigResult">
        <result property="dataId"    column="data_id"    />
        <result property="taskName"    column="task_name"    />
        <result property="paramCode"    column="param_code"    />
        <result property="paramName"    column="param_name"    />
        <result property="frequency"    column="frequency"    />
        <result property="thresholdValue"    column="threshold_value"    />
        <result property="unit"    column="unit"    />
        <result property="remark"    column="remark"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>


    <sql id="selectBasThresholdConfigVo">
        select data_id, task_name, param_code, param_name, frequency, threshold_value, unit, remark, create_by, create_time, update_by, update_time from bas_threshold_config
    </sql>

    <select id="selectBasThresholdConfigList" parameterType="cn.cecep.talroad.domain.BasThresholdConfig" resultMap="BasThresholdConfigResult">
        <include refid="selectBasThresholdConfigVo"/>
        <where>
            <if test="taskName != null  and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</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="frequency != null  and frequency != ''"> and frequency = #{frequency}</if>
            <if test="thresholdValue != null  and thresholdValue != ''"> and threshold_value = #{thresholdValue}</if>
            <if test="unit != null  and unit != ''"> and unit = #{unit}</if>
        </where>
    </select>

    <select id="selectByParamCode" resultMap="BasThresholdConfigResult">
        <include refid="selectBasThresholdConfigVo"/>
        where param_code = #{paramCode}
    </select>

</mapper>
