<?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="org.jeecg.modules.stm.page.mapper.PageMonitorchartMapper">
    <select id="metricRiskLevelSta" resultType="java.util.Map">
        SELECT COUNT(*) AS cnt,AA.risk_level AS riskLevel FROM (
        SELECT A.* FROM  metric_report A  INNER JOIN (
        SELECT MAX(fill_time) AS fillTime, mtrc_no FROM  metric_report  GROUP BY  mtrc_no
        ) B ON A.fill_time = B.fillTime AND A.mtrc_no=B.mtrc_no and A.risk_level IS NOT NULL
        INNER JOIN metric_monitor_set C ON A.mtrc_no= C.mtrc_no AND C.mtrc_ctp=2
     ) AA GROUP BY AA.risk_level order by AA.risk_level desc
    </select>

    <select id="queryMulMetrcSta" resultType="java.util.Map">
        SELECT A.mtrc_no AS mtrcNo,SUBSTRING(B.fill_vals,1,4) AS val,SUBSTRING(B.fill_time,1,4) AS fillTime
        FROM page_monitorchart A
                 INNER JOIN  metric_report B ON A.mtrc_no=B.mtrc_no
        ORDER BY B.fill_time
    </select>
</mapper>