package cn.yw.alarm.dao;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;

import cn.base.dao.BaseSqlMapDAO;

@Repository("ywalarmeventinfoDao")
public class YwalarmeventinfoDao  extends BaseSqlMapDAO{
	
	/**
	 * 增加记录
	 */
	public void insert_Ywalarmeventinfo(Map map) throws SQLException{
		this.insert("insert_Ywalarmeventinfo",map);
	}
	public Map checkQx(Map yhbh) throws SQLException{
		return (Map) this.queryForObject("checkQx",yhbh);
	}
	
	/**
	 * 批处理增加记录
	 */
	public void batch_insert_Ywalarmeventinfo(List batch) throws SQLException{
		this.insert("batch_insert_Ywalarmeventinfo",batch);
	}
	 
	/**
	 * 修改记录
	 */
	public Integer update_Ywalarmeventinfo(Map map) throws SQLException{
		return this.update("update_Ywalarmeventinfo",map);
	}
	
	/**
	 * 删除记录
	 */
	public Integer delete_Ywalarmeventinfo(Map map) throws SQLException{
		return this.delete("delete_Ywalarmeventinfo",map);
	}
	
	/**
	 * 批处理删除记录
	 */
	
	public Integer batch_delete_Ywalarmeventinfo(Map map) throws SQLException{
		return this.delete("batch_delete_Ywalarmeventinfo",map);
	}
	
	/**
	 * 查询总数
	 */
	public Integer count_Ywalarmeventinfo(Map map) throws SQLException{
		return (Integer)this.queryForObject("count_Ywalarmeventinfo",map);
	}
	
	/**
	 * 查询列表记录
	 */
	
	public List<Map> query_Ywalarmeventinfo(Map map) throws SQLException{
		return this.queryForPage("query_Ywalarmeventinfo",map);
	}
	public List<Map> statisticPieChart(Map map) throws SQLException{
		return this.queryForList("statisticPieChart",map);
	}
	public List<Map> alarmStatisticsLine(Map map) throws SQLException{
		String type = String.valueOf(map.get("staticsType"));
		if("1".equals(type)){
			return this.queryForList("alarmStatisticsHour",map);
		}else if("2".equals(type)){
			return this.queryForList("alarmStatisticsDay",map);
		}else{
			return this.queryForList("alarmStatisticsMonth",map);
		}
		
	}

	/**
	 * 查询详情列表
	 */
	public List<Map> query_YwalarmeventinfoDetail(Map map) throws SQLException{
		return this.queryForPage("query_YwalarmeventinfoDetail",map);
	}

	/**
	 * 查询列表记录
	 */
	public Map get_Ywalarmeventinfo(Map map) throws SQLException{
		return (Map) this.queryForObject("query_Ywalarmeventinfo",map);
	}
	/**
	 * 查询故障信息列表
	 */
	public Map  query_Ywalarmlist(Map map) throws SQLException{
		return (Map) this.queryForObject("query_Ywalarmlist",map);
	}
	
	//忽略告警
	public Integer ignore_Ywalarmeventinfo(Map map) throws SQLException{
		return this.update("ignore_Ywalarmeventinfo",map);
	}
	
	// 首页监控故障次数统计
	public List<Map>  count_HomepageFaultCount(Map map) throws SQLException{
		return this.queryForPage("count_HomepageFaultCount",map);
	}
	
}
