package com.gyee.alarm.mapper.auto;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gyee.alarm.model.auto.ProEconAlarmConfiguration;
import com.gyee.alarm.model.auto.ProEconAlarmInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gyee.alarm.model.vo.AlarmVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 报警缓存表 Mapper 接口
 * </p>
 *
 * @author shilin
 * @since 2023-06-19
 */
public interface ProEconAlarmInfoMapper extends BaseMapper<ProEconAlarmInfo> {



    @Select({"<script>",
            "select * from pro_econ_alarm_info " ,
            "<where>" ,


            "<if test='begin != null'>",
            " last_update_time &gt;= #{begin}",
            "</if>",
            "<if test='end != null'>",
            "and last_update_time &lt;= #{end}",
            "</if>",
            "<if test='modelId != null'>",
            "and model_id= #{modelId}",
            "</if>",
            "<if test='description != null'>",
            "and description like #{description}",
            "</if>",
            "<if test='deviceid != null'>",
            "and device_id = #{deviceid}",
            "</if>",
            "<if test='deviceType != null'>",
            "and device_Type = #{deviceType}",
            "</if>",
            "<if test='alarmType != null'>",
            "and alarm_type = #{alarmType}",
            "</if>",
            "<if test='components != null'>",
            "and components = #{components}",
            "</if>",
            "<if test='stationid != null'>",
            "and station_id = #{stationid}",
            "</if>",
            "<if test='alarmid != null'>",
            "and alarm_id = #{alarmid}",
            "</if>",
            "<if test='isclose== true'>",
            "and close_time is not null ",
            "</if>",
            "<if test='isclose== false'>",
            "and close_time is  null ",
            "</if>",
            "<if test='isclose== true'>",
            "and confirmed_time is not null ",
            "</if>",
            "<if test='isclose== false'>",
            "and confirmed_time is  null",
            "</if>",
            "</where>",
            " order by last_update_time desc,rank desc  ",
            "</script>"})
    IPage<ProEconAlarmInfo> selectByWtLimit(Page page, @Param("begin") Date begin, @Param("end")Date end, @Param("modelId")String modelId, @Param("superTableName") String superTableName, @Param("alarmType")String alarmType, @Param("stationid")String stationid, @Param("deviceid")String deviceid, @Param("description")String description, @Param("deviceType")String deviceType, @Param("components")String components, @Param("alarmid")String alarmid, @Param("isclose")Boolean isclose);

}
