package cn.yw.alarmtaskmanage.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.alarmtaskmanage.dao.YwalarmrulefordeviceDao;

@Service("ywalarmrulefordeviceService")
public class YwalarmrulefordeviceService extends BaseService {
	
	private static Log log = LogFactory.getLog(YwalarmrulefordeviceService.class);
	
	@Autowired
	private YwalarmrulefordeviceDao ywalarmrulefordeviceDao;
	
	/**
	 * 保存记录
	 */
	
	public void insert_Ywalarmrulefordevice(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		ywalarmrulefordeviceDao.insert_Ywalarmrulefordevice(map);
	}
	

	
	/**
	 * 修改记录
	 */
	
	public Integer update_Ywalarmrulefordevice(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return ywalarmrulefordeviceDao.update_Ywalarmrulefordevice(map);
	}
	
	
	/**
	 * 删除记录
	 */
	
	public Integer delete_Ywalarmrulefordevice(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return ywalarmrulefordeviceDao.delete_Ywalarmrulefordevice(map);
	}
	
	
	/**
	 * 批处理删除记录
	 */
	
	public Integer batch_delete_Ywalarmrulefordevice(Map map) throws SQLException{
		return ywalarmrulefordeviceDao.batch_delete_Ywalarmrulefordevice(map);
	}
	
	
	/**
	 * 查询总数
	 */
	
	public Integer count_Ywalarmrulefordevice(Map map) throws SQLException{
		return ywalarmrulefordeviceDao.count_Ywalarmrulefordevice(map);
	}
	
	
	/**
	 * 查询列表记录SELECT
	 */
	
	public List<Map> query_Ywalarmrulefordevice(Map map) throws SQLException{
		return ywalarmrulefordeviceDao.query_Ywalarmrulefordevice(map);
	}
	
	
	/**
	 * 查询一条
	 */
	 
	
	public Map get_Ywalarmrulefordevice(Map map) throws SQLException{
		return ywalarmrulefordeviceDao.get_Ywalarmrulefordevice(map);
	}
	
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportYwalarmrulefordevice(Map map) throws SQLException{
		return this.listYwalarmrulefordeviceByPage(map);
	}
	*/
	
	/**
	 * Ywalarmrulefordevice 分页
	 */
	
	public Map listYwalarmrulefordeviceByPage(Map map) throws SQLException {
		List<Map> list = ywalarmrulefordeviceDao.query_Ywalarmrulefordevice(map);
		Integer totalCount = ywalarmrulefordeviceDao.count_Ywalarmrulefordevice(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
	// 更新
	public Integer edit_Ywalarmrulefordevice(Map map) throws SQLException{
		return ywalarmrulefordeviceDao.edit_Ywalarmrulefordevice(map);
	}
	
	//监控告警类型查询
	public Map get_leftVideoDevice(Map map) throws SQLException{
		List<Map> list = ywalarmrulefordeviceDao.get_leftVideoDevice(map);
		Integer totalCount = ywalarmrulefordeviceDao.get_leftVideoDeviceCount(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
	//服务器告警类型查询
	public Map get_leftServerDevice(Map map) throws SQLException{
		List<Map> list = ywalarmrulefordeviceDao.get_leftServerDevice(map);
		Integer totalCount = ywalarmrulefordeviceDao.get_leftServerDeviceCount(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
	//应用系统告警类型查询
	public Map get_leftSoftDevice(Map map) throws SQLException{
		List<Map> list = ywalarmrulefordeviceDao.get_leftSoftDevice(map);
		Integer totalCount = ywalarmrulefordeviceDao.get_leftSoftDeviceCount(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
	//服务器 硬盘 告警类型查询
	public Map get_leftDiskDevice(Map map) throws SQLException{
		List<Map> list = ywalarmrulefordeviceDao.get_leftDiskDevice(map);
		Integer totalCount = ywalarmrulefordeviceDao.get_leftDiskDeviceCount(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
	//服务器 cpu 告警类型查询
	public Map get_leftCPUdevice(Map map) throws SQLException{
		List<Map> list = ywalarmrulefordeviceDao.get_leftCPUdevice(map);
		Integer totalCount = ywalarmrulefordeviceDao.get_leftCPUdeviceCount(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
	//服务器  内存  告警类型查询
	public Map get_leftMemorydevice(Map map) throws SQLException{
		List<Map> list = ywalarmrulefordeviceDao.get_leftMemorydevice(map);
		Integer totalCount = ywalarmrulefordeviceDao.get_leftMemorydeviceCount(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
}
