<?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.gyee.wisdom.alarm.sharding.mapper.ShutdownEventMapper">


    <select id="queryShutdownEventList"  resultType="com.gyee.wisdom.alarm.sharding.entity.ShutdownEvent">
        SELECT
            *
        FROM
        Shutdownevent s
        LEFT JOIN Warning2 w ON s.warningid = w.id
        <where>
            s.windpowerstationid = #{stId}
            and s.statuscode = '2'
            and s.stoptypeid in (select id from stoptype where parentid= 'gz' and id != 'gzbmq')
            and s.windpowerstationid is not null
            and s.stoptime &lt;= #{startdate,jdbcType=DATE}
            and s.stoptime &gt; #{edtend,jdbcType=DATE}
        </where>
    </select>
    <select id="queryShutdownEventCurrentDate"
            resultType="com.gyee.wisdom.alarm.sharding.entity.ShutdownEvent">

        SELECT
        *
        FROM
        Shutdownevent s
        <where>
            and s.stoptime &gt;= #{currentDate,jdbcType=DATE}
            and s.statuscode = '2'
            and s.stoptypeid in (select id from stoptype where parentid= 'gz' and id != 'gzbmq')
            and s.windpowerstationid is not null
            <if test="stId !=null and stId !=''">
                and  s.windpowerstationid = #{stId}
            </if>

        </where>


    </select>


    <select id="queryTodayCount" resultType="java.util.Map">

            SELECT count(s.id) as count
              FROM Shutdownevent s
             where s.stoptime >= #{currentDate,jdbcType=DATE}
               and s.statuscode = '2'
               and s.stoptypeid in (select id from stoptype where parentid = 'gz')
               and s.windpowerstationid is not null

    </select>

</mapper>
