<?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.metric.mapper.MetricMonitorSetMapper">
    <select id="queryMonitorSet" resultType="org.jeecg.modules.stm.metric.pojo.QueryMetricMonitorSetVo">
        SELECT A.mtrc_no AS mtrcNo,A.mtrc_name AS mtrcName,A.coll_freq as collFreq,A.domain_no as domainNo,
               A.coll_method as collMethod,A.mtrc_tp as mtrcTp,A.tol_val AS tolVal,A.mtrc_ctp as mtrcCtp,
               A.warn_val AS warnVal,A.intv_val AS intvVal,A.id,formulas,A.mtrc_sta as mtrcSta,
               A.mtrc_source_tp as mtrcSourceTp,A.des,A.unit,A.params,
               IFNULL(B.domain_name,"-") as domainName
        FROM metric_monitor_set A left join st_domain B on A.domain_no=B.domain_code
        <where>
            <if test="query.mtrcCtp!=null">
                and A.mtrc_ctp = #{query.mtrcCtp}
            </if>
            <if test="query.collFreq!=null">
                and A.coll_freq = #{query.collFreq}
            </if>
            <if test="query.mtrcTp!=null">
                and A.mtrc_tp = #{query.mtrcTp}
            </if>
            <if test="query.mtrcNo!=null">
               and  A.mtrc_no = #{query.mtrcNo}
            </if>
            <if test="query.mtrcName!=null">
               and A.mtrc_name like  concat('%',#{query.mtrcName},'%')
            </if>
        </where>
    </select>
</mapper>