package cn.yw.archive.videoarchive.dao;

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

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("ywarchivevideoinfoDao")
public class YwarchivevideoinfoDao  extends BaseSqlMapDAO{
	

	/**
	 * 增加记录
	 * @return 
	 */
	public void insert_Ywarchivevideoinfo(Map map) throws SQLException{
		this.insert("insert_Ywarchivevideoinfo",map);
	}
	
	
	/**
	 * 批处理增加记录
	 */
	public void batch_insert_Ywarchivevideoinfo(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_Ywarchivevideoinfo", map);
				}
				executor.executeBatch();
				return null;
			}
			
		});
		// this.insert("batch_insert_Ywarchivevideoinfo",batch);
	}

	 
	/**
	 * 修改记录
	 */
	public Integer update_Ywarchivevideoinfo(Map map) throws SQLException{
		return this.update("update_Ywarchivevideoinfo",map);
	}

	
	/**
	 * 删除记录
	 */
	public Integer delete_Ywarchivevideoinfo(Map map) throws SQLException{
		return this.delete("delete_Ywarchivevideoinfo",map);
	}
	
	
	/**
	 * 批处理删除记录
	 */
	public Integer batch_delete_Ywarchivevideoinfo(Map map) throws SQLException{
		return this.delete("batch_delete_Ywarchivevideoinfo",map);
	}
	
	
	/**
	 * 查询总数
	 */
	public Integer count_Ywarchivevideoinfo(Map map) throws SQLException{
		return (Integer)this.queryForObject("count_Ywarchivevideoinfo",map);
	}
	
	
	/**
	 * 查询列表记录
	 */
	public List<Map> query_Ywarchivevideoinfo(Map map) throws SQLException{
		return this.queryForPage("query_Ywarchivevideoinfo",map);
	}
	
	
	/**
	 * 查询列表记录
	 */
	public Map get_Ywarchivevideoinfo(Map map) throws SQLException{
		return (Map) this.queryForObject("query_Ywarchivevideoinfo",map);
	}
	
	
	// 查询excel表对应数据库相关信息
	public List<Map> getExeclColname(Map map) throws SQLException{
		return this.queryForList("getExeclColname",map);
	}

	// 查询需要转换的信息
	public List<Map> getExeclCodeName(Map map) throws SQLException{
		return this.queryForList("getExeclCodeName",map);
	}
	
	//根据columnname查询  代码及中文
	public List<Map> queryByColumnname(Map map) throws SQLException{
		return this.queryForList("queryByColumnname",map);
	}
	
	//根据columnname查询  代码及中文
	public List<String> queryOutsidecode(Map map) throws SQLException{
		return this.queryForList("queryOutsidecode",map);
	}
}
