package cn.yw.archive.videoarchive.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.archive.videoarchive.dao.YwarchivedepartmentDao;

@Service("ywarchivedepartmentService")
public class YwarchivedepartmentService extends BaseService {
	
	private static Log log = LogFactory.getLog(YwarchivedepartmentService.class);
	
	@Autowired
	private YwarchivedepartmentDao ywarchivedepartmentDao;
	
	/**
	 * 保存记录
	 */
	public void insert_Ywarchivedepartment(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		ywarchivedepartmentDao.insert_Ywarchivedepartment(map);
	}
	

	
	/**
	 * 修改记录
	 */
	public Integer update_Ywarchivedepartment(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return ywarchivedepartmentDao.update_Ywarchivedepartment(map);
	}

	
	/**
	 * 删除记录
	 */
	
	public Integer delete_Ywarchivedepartment(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return ywarchivedepartmentDao.delete_Ywarchivedepartment(map);
	}
	
	
	/**
	 * 批处理删除记录
	 */
	public Integer batch_delete_Ywarchivedepartment(Map map) throws SQLException{
		return ywarchivedepartmentDao.batch_delete_Ywarchivedepartment(map);
	}
	
	
	/**
	 * 查询总数
	 */
	public Integer count_Ywarchivedepartment(Map map) throws SQLException{
		return ywarchivedepartmentDao.count_Ywarchivedepartment(map);
	}
	
	
	/**
	 * 查询列表记录SELECT
	 */
	public List<Map> query_Ywarchivedepartment(Map map) throws SQLException{
		return ywarchivedepartmentDao.query_Ywarchivedepartment(map);
	}
	
	
	/**
	 * 查询一条
	 */
	public Map get_Ywarchivedepartment(Map map) throws SQLException{
		return ywarchivedepartmentDao.get_Ywarchivedepartment(map);
	}
	
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportYwarchivedepartment(Map map) throws SQLException{
		return this.listYwarchivedepartmentByPage(map);
	}
	*/
	
	/**
	 * Ywarchivedepartment 分页
	 */
	
	public Map listYwarchivedepartmentByPage(Map map) throws SQLException {
		List<Map> list = ywarchivedepartmentDao.query_Ywarchivedepartment(map);
		Integer totalCount = ywarchivedepartmentDao.count_Ywarchivedepartment(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
}
