<?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="com.njcn.device.pq.mapper.AlarmStrategyMapper">

    <select id="getAlarmStrategyData" resultType="AlarmStrategyVO">
        SELECT
        A.`Id` id,
        B.`Name` name,
        A.`Integrity_Value` integrityValue,
        A.`Online_Value` onlineValue,
        A.`Offtime_Value` offTimeValue,
        A.`Warn_Value` warnValue,
        A.`Update_Time` updateTime,
        C.`Name` updateBy
        FROM
        pqs_alarm_strategy A,
        sys_dict_data B,
        sys_user C
        WHERE A.State = 1
        AND A.Id = B.Id
        AND A.Update_By = C.Id
    </select>

    <select id="getAlarmStrategyById" resultType="java.lang.Integer">
        SELECT
        COUNT(Id)
        FROM
        pqs_alarm_strategy
        WHERE State = 1
        AND Id = #{id}
    </select>

    <update id="updateAlarmStrategyState">
        UPDATE
        pqs_alarm_strategy
        SET
        State = 0
        WHERE Id = #{id}
    </update>

</mapper>