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.YwalarmrulefortimeDao;

@Service("ywalarmrulefortimeService")
public class YwalarmrulefortimeService extends BaseService {
	
	private static Log log = LogFactory.getLog(YwalarmrulefortimeService.class);
	
	@Autowired
	private YwalarmrulefortimeDao ywalarmrulefortimeDao;
	
	/**
	 * 保存记录
	 */
	
	public void insert_Ywalarmrulefortime(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		ywalarmrulefortimeDao.insert_Ywalarmrulefortime(map);
	}
	

	
	/**
	 * 修改记录
	 */
	
	public Integer update_Ywalarmrulefortime(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return ywalarmrulefortimeDao.update_Ywalarmrulefortime(map);
	}
	
	/**
	 * 批处理增加记录
	 */
	
	public void batch_insert_Ywalarmrulefortime(List batch) throws SQLException{
		ywalarmrulefortimeDao.batch_insert_Ywalarmrulefortime(batch);
	}
	
	
	/**
	 * 删除记录
	 */
	
	public Integer delete_Ywalarmrulefortime(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return ywalarmrulefortimeDao.delete_Ywalarmrulefortime(map);
	}
	
	
	/**
	 * 批处理删除记录
	 */
	
	public Integer batch_delete_Ywalarmrulefortime(Map map) throws SQLException{
		return ywalarmrulefortimeDao.batch_delete_Ywalarmrulefortime(map);
	}
	
	
	/**
	 * 查询总数
	 */
	
	public Integer count_Ywalarmrulefortime(Map map) throws SQLException{
		return ywalarmrulefortimeDao.count_Ywalarmrulefortime(map);
	}
	
	
	/**
	 * 查询列表记录SELECT
	 */
	
	public List<Map> query_Ywalarmrulefortime(Map map) throws SQLException{
		return ywalarmrulefortimeDao.query_Ywalarmrulefortime(map);
	}
	
	
	/**
	 * 查询一条
	 */
	 
	
	public Map get_Ywalarmrulefortime(Map map) throws SQLException{
		return ywalarmrulefortimeDao.get_Ywalarmrulefortime(map);
	}
	
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportYwalarmrulefortime(Map map) throws SQLException{
		return this.listYwalarmrulefortimeByPage(map);
	}
	*/
	
	/**
	 * Ywalarmrulefortime 分页
	 */
	
	public Map listYwalarmrulefortimeByPage(Map map) throws SQLException {
		List<Map> list = ywalarmrulefortimeDao.query_Ywalarmrulefortime(map);
		Integer totalCount = ywalarmrulefortimeDao.count_Ywalarmrulefortime(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
}
