<?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.prepare.harmonic.mapper.mysql.line.ThsWarnStrategyMapper">

    <!--查询策略的集合-->
    <select id="selectStrategyList" parameterType="com.njcn.prepare.harmonic.pojo.param.SuperviseParam"
            resultType="com.njcn.harmonic.pojo.vo.ThsStrategyVo">
        select
        tws.id,
        tws.name,
        tws.grade,
        tws.operation,
        tws.type,
        Monitor_Id as monitorId,
        tda.dept_Id as deptId
        from
        ths_warn_strategy tws
        INNER join ths_dept_alarm tda on
        tws.Id = tda.Alarm_Id
        <where>
            <choose>
                <when test="param.initType==0">
                    tws.State = 1 and tws.Grade in(0,2)
                </when>
                <when test="param.initType==1">
                    tws.State = 1 and tws.Grade in(1,2)
                </when>
            </choose>
            <if test="param.deptId !=null and param.deptId !=''">
                and tda.Dept_Id=#{param.deptId}
            </if>
            <if test="param.type !=null">
                and tda.type=#{param.type}
            </if>

        </where>
    </select>


</mapper>
