<?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.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper">

<update id="updateByInfo">
    UPDATE ${tableName}
    <if test="groupLowerLimit != null and groupLowerLimit != ''">
        set GROUP_LOWER_LIMIT = #{groupLowerLimit}
    </if>
    <if test="groupUpperLimit != null and groupUpperLimit != ''">
        , GROUP_UPPER_LIMIT = #{groupUpperLimit}
    </if>
    WHERE
        ANALYSIS_OBJ_TYPE = #{analysisObjType}
      AND HEALTH_LEVEL = #{healthLevel}
    </update>

<update id="updateByInfoIsNull">
    UPDATE ${tableName}
    <if test="groupLowerLimit != null and groupLowerLimit != ''">
        set GROUP_LOWER_LIMIT = #{groupLowerLimit}
    </if>
    <if test="groupUpperLimit != null and groupUpperLimit != ''">
        set GROUP_UPPER_LIMIT = #{groupUpperLimit}
    </if>
    WHERE
    ANALYSIS_OBJ_TYPE = #{analysisObjType}
    AND HEALTH_LEVEL = #{healthLevel}
    </update>

    <select id="queryHealthLevel" resultType="java.util.Map">
        SELECT * FROM idx_biz_fan_health_level where ANALYSIS_OBJ_TYPE = '全域' ORDER BY GROUP_UPPER_LIMIT DESC
    </select>

    <select id="queryPvSubArray" resultType="java.util.Map">
        SELECT
        STATION,
        SUBARRAY
        FROM
        pv_health_index_latest_data
        WHERE
        EQUIPMENT_NAME != ''
        GROUP BY
        STATION,
        SUBARRAY
        ORDER BY SUBARRAY ASC
    </select>
</mapper>
