package cn.yw.video.videoalarm.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.video.videoalarm.dao.YwvideotaskrunsetDao;

@Service("ywvideotaskrunsetService")
public class YwvideotaskrunsetService extends BaseService {
	
	private static Log log = LogFactory.getLog(YwvideotaskrunsetService.class);
	
	@Autowired
	private YwvideotaskrunsetDao ywvideotaskrunsetDao;
	
	/**
	 * 保存记录
	 */
	public void insert_Ywvideotaskrunset(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		ywvideotaskrunsetDao.insert_Ywvideotaskrunset(map);
	}

	
	/**
	 * 修改记录
	 */
	public Integer update_Ywvideotaskrunset(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return ywvideotaskrunsetDao.update_Ywvideotaskrunset(map);
	}
	
	/**
	 * 删除记录
	 */
	public Integer delete_Ywvideotaskrunset(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return ywvideotaskrunsetDao.delete_Ywvideotaskrunset(map);
	}
	
	/**
	 * 批处理删除记录
	 */
	public Integer batch_delete_Ywvideotaskrunset(Map map) throws SQLException{
		return ywvideotaskrunsetDao.batch_delete_Ywvideotaskrunset(map);
	}
	
	/**
	 * 查询总数
	 */
	public Integer count_Ywvideotaskrunset(Map map) throws SQLException{
		return ywvideotaskrunsetDao.count_Ywvideotaskrunset(map);
	}
	
	/**
	 * 查询列表记录SELECT
	 */
	public List<Map> query_Ywvideotaskrunset(Map map) throws SQLException{
		return ywvideotaskrunsetDao.query_Ywvideotaskrunset(map);
	}
	
	/**
	 * 查询一条
	 */
	 
	public Map get_Ywvideotaskrunset(Map map) throws SQLException{
		return ywvideotaskrunsetDao.get_Ywvideotaskrunset(map);
	}
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportYwvideotaskrunset(Map map) throws SQLException{
		return this.listYwvideotaskrunsetByPage(map);
	}
	*/
	
	/**
	 * Ywvideotaskrunset 分页
	 */
	public Map listYwvideotaskrunsetByPage(Map map) throws SQLException {
		List<Map> list = ywvideotaskrunsetDao.query_Ywvideotaskrunset(map);
		Integer totalCount = ywvideotaskrunsetDao.count_Ywvideotaskrunset(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}

	/**
	 * 任务完好率分页
	 */
	public Map listywvideotaskcompleterateByPage(Map map) throws SQLException {
		List<Map> list = ywvideotaskrunsetDao.query_ywvideotaskcompleterate(map);
		Integer totalCount = ywvideotaskrunsetDao.count_Ywvideotaskrunset(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
}
