package cn.yw.videosyncchannel.service;

 import java.sql.SQLException;
import java.util.HashMap;
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.videosyncchannel.dao.YwvideosyncaccountDao;

@Service("ywvideosyncaccountService")
public class YwvideosyncaccountService extends BaseService {
	
	private static Log log = LogFactory.getLog(YwvideosyncaccountService.class);
	
	@Autowired
	private YwvideosyncaccountDao ywvideosyncaccountDao;
	
	/**
	 * 保存记录
	 */
	public void insert_Ywvideosyncaccount(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		ywvideosyncaccountDao.insert_Ywvideosyncaccount(map);
	}

	
	/**
	 * 修改记录
	 */
	public Integer update_Ywvideosyncaccount(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return ywvideosyncaccountDao.update_Ywvideosyncaccount(map);
	}
	
	/**
	 * 删除记录
	 */
	public Integer delete_Ywvideosyncaccount(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return ywvideosyncaccountDao.delete_Ywvideosyncaccount(map);
	}
	
	/**
	 * 批处理删除记录
	 */
	/*
	public Integer batch_delete_Ywvideosyncaccount(Map map) throws SQLException{
		return ywvideosyncaccountDao.batch_delete_Ywvideosyncaccount(map);
	}
	*/
	
	/**
	 * 查询总数
	 */
	/*
	public Integer count_Ywvideosyncaccount(Map map) throws SQLException{
		return ywvideosyncaccountDao.count_Ywvideosyncaccount(map);
	}
	*/
	
	/**
	 * 查询列表记录SELECT
	 */
	public List<Map> query_Ywvideosyncaccount(Map map) throws SQLException{
		return ywvideosyncaccountDao.query_Ywvideosyncaccount(map);
	}
	
	/**
	 * 查询一条
	 */
	public Map get_Ywvideosyncaccount(Map map) throws SQLException{
		return ywvideosyncaccountDao.get_Ywvideosyncaccount(map);
	}

	/**
	 * 获取平台行政树
	 */
	public List get_ptxzs() throws SQLException{
		Map map = new HashMap();
		return ywvideosyncaccountDao.get_ptxzs(map);
	}
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportYwvideosyncaccount(Map map) throws SQLException{
		return this.listYwvideosyncaccountByPage(map);
	}
	*/
	
	/**
	 * Ywvideosyncaccount 分页
	 */
	public Map listYwvideosyncaccountByPage(Map map) throws SQLException {
		List<Map> list = ywvideosyncaccountDao.query_Ywvideosyncaccount(map);
		Integer totalCount = ywvideosyncaccountDao.count_Ywvideosyncaccount(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}

	/**
	 * 
	 */
	public Map listVideosyncchannelToChannelSet(Map map) throws SQLException {
		List<Map> list = ywvideosyncaccountDao.listVideosyncchannelToChannelSet(map);
		Integer totalCount = ywvideosyncaccountDao.count_listVideosyncchannelToChannelSet(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
}
