package cn.yw.alarm.service;

 import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.base.bean.BaseService;
import cn.base.util.CommUtils;
import cn.yw.alarm.dao.YwalarmeventinfoDao;

@Service("ywalarmeventinfoService")
public class YwalarmeventinfoService extends BaseService {
	
	private static Log log = LogFactory.getLog(YwalarmeventinfoService.class);
	
	@Autowired
	private YwalarmeventinfoDao ywalarmeventinfoDao;
	
	/**
	 * 保存记录
	 */
	public void insert_Ywalarmeventinfo(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		ywalarmeventinfoDao.insert_Ywalarmeventinfo(map);
	}
	/**
	 * 检查是否具有查看告警权限
	 * @param yhbh
	 * @throws SQLException
	 */
	public Map checkQx(Map yhbh) throws SQLException{
		return (Map)ywalarmeventinfoDao.checkQx(yhbh);
	}

	
	/**
	 * 修改记录
	 */
	public Integer update_Ywalarmeventinfo(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return ywalarmeventinfoDao.update_Ywalarmeventinfo(map);
	}
	
	/**
	 * 删除记录
	 */
	public Integer delete_Ywalarmeventinfo(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return ywalarmeventinfoDao.delete_Ywalarmeventinfo(map);
	}
	
	/**
	 * 批处理删除记录
	 */
	public Integer batch_delete_Ywalarmeventinfo(Map map) throws SQLException{
		return ywalarmeventinfoDao.batch_delete_Ywalarmeventinfo(map);
	}
	
	/**
	 * 查询总数
	 */
	public Integer count_Ywalarmeventinfo(Map map) throws SQLException{
		return ywalarmeventinfoDao.count_Ywalarmeventinfo(map);
	}
	
	/**
	 * 查询列表记录SELECT
	 */
	public List<Map> query_Ywalarmeventinfo(Map map) throws SQLException{
		return ywalarmeventinfoDao.query_Ywalarmeventinfo(map);
	}
	public List<Map> statisticPieChart(Map map) throws SQLException{
		return ywalarmeventinfoDao.statisticPieChart(map);
	}
	public List<Map> alarmStatisticsLine(Map map) throws SQLException{
		return ywalarmeventinfoDao.alarmStatisticsLine(map);
	}

	/**
	 * 查询详情列表
	 */
	public List<Map> query_YwalarmeventinfoDetail(Map map) throws SQLException{
		return ywalarmeventinfoDao.query_YwalarmeventinfoDetail(map);
	}
	
	/**
	 * 查询一条
	 */
	 
	public Map get_Ywalarmeventinfo(Map map) throws SQLException{
		return ywalarmeventinfoDao.get_Ywalarmeventinfo(map);
	}
	
	/**
	 * 查询故障信息列表
	 */
	
	public Map query_Ywalarmlist(Map map) throws SQLException{
		return ywalarmeventinfoDao.query_Ywalarmlist(map);
	}
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportYwalarmeventinfo(Map map) throws SQLException{
		return this.listYwalarmeventinfoByPage(map);
	}
	*/
	
	/**
	 * Ywalarmeventinfo 分页
	 */
	public Map listYwalarmeventinfoByPage(Map map) throws SQLException {
		List<Map> list = ywalarmeventinfoDao.query_Ywalarmeventinfo(map);
		Integer totalCount = ywalarmeventinfoDao.count_Ywalarmeventinfo(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
	// 忽略告警
	public Integer ignore_Ywalarmeventinfo(Map map) throws SQLException{
		return ywalarmeventinfoDao.ignore_Ywalarmeventinfo(map);
	}
	
	// 首页监控故障次数统计
	public List<Map>  count_HomepageFaultCount(Map map) throws SQLException{
		return ywalarmeventinfoDao.count_HomepageFaultCount(map);
	}
}
