package cn.yw.video.videochannelset.dao;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.SqlMapClientCallback;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapExecutor;

import cn.base.dao.BaseSqlMapDAO;

@Repository("ywvideochannelsetlistDao")
public class YwvideochannelsetlistDao  extends BaseSqlMapDAO{
	
	/**
	 * 增加记录
	 */
	public void insert_Ywvideochannelsetlist(Map map) throws SQLException{
		this.insert("insert_Ywvideochannelsetlist",map);
	}
	
	/**
	 * 批处理增加记录
	 */
	public void batch_insert_Ywvideochannelsetlist(List batch) throws SQLException{
		this.insert("batch_insert_Ywvideochannelsetlist",batch);
	}
	public void batch_add_Ywvideochannelsetlist(List batch) throws SQLException{
		this.getSqlMapClientTemplate().insert("batch_add_Ywvideochannelsetlist",batch);
	}
	 
	/**
	 * 修改记录
	 */
	public Integer update_Ywvideochannelsetlist(Map map) throws SQLException{
		return this.update("update_Ywvideochannelsetlist",map);
	}
	
	/**
	 * 删除记录
	 */
	public Integer delete_Ywvideochannelsetlist(Map map) throws SQLException{
		return this.delete("delete_Ywvideochannelsetlist",map);
	}
	
	/**
	 * 批处理删除记录
	 */
	
	public Integer batch_delete_Ywvideochannelsetlist(List l) throws SQLException{
		return this.delete("batch_delete_Ywvideochannelsetlist",l);
	}
	public Integer update_batch_videomodel(Map map) throws SQLException{
		return this.delete("update_batch_videomodel",map);
	}
	public Integer update_batch_recorddays(Map map) throws SQLException{
		return this.delete("update_batch_recorddays",map);
	}
	public Integer update_batch_ywvideochannelsetlist(Map map) throws SQLException{
		return this.delete("update_batch_ywvideochannelsetlist",map);
	}
	
	/**
	 * 查询总数
	 */
	public Integer count_Ywvideochannelsetlist(Map map) throws SQLException{
		return (Integer)this.queryForObject("count_Ywvideochannelsetlist",map);
	}
	
	/**
	 * 查询列表记录
	 */
	
	public List<Map> query_Ywvideochannelsetlist(Map map) throws SQLException{
		return this.queryForPage("query_Ywvideochannelsetlist",map);
	}
	public List<Map> query_Ywvideochannelsetlist_select(Map map) throws SQLException{
		return this.queryForList("query_Ywvideochannelsetlist_select",map);
	}
	
	/**
	 * 查询列表记录
	 */
	public Map get_Ywvideochannelsetlist(Map map) throws SQLException{
		return (Map) this.queryForObject("query_Ywvideochannelsetlist",map);
	}
	
	
	/**
	 * 批处理增加记录
	 */
	public void insert_batch_Ywvideochannelsetlist(final List<Map> batch) throws SQLException{
		
		this.getSqlMapClientTemplate().execute(new SqlMapClientCallback() {

			@Override
			public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
				// TODO Auto-generated method stub
				executor.startBatch();
				for(Map map : batch) {
					executor.insert("insert_Ywvideochannelsetlist", map);
				}
				executor.executeBatch();
				return null;
			}
			
		});
 	}
	
}
