package com.bb.dao;

import java.util.HashMap;
import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import com.bb.model.BanGameSearch;
import com.bb.model.CmnSearch;

@Repository("commonDao")
public class CommonDaoImpl implements CommonDao {

	/** 메인DB 연결 */
    @Autowired @Qualifier("sqlSessionMain")
    protected SqlSession sqlSession;
 
    /** 서브DB 연결 */
    @Autowired @Qualifier("sqlSessionSub")
    protected SqlSession sqlSessionSub;

	@Override
	public List<HashMap<String, String>> getGameCategoryList() {
		// TODO Auto-generated method stub
		return sqlSessionSub.selectList("getGameCategoryList");
	}

	@Override
	public List<HashMap<String, Object>> getGameVendorList(CmnSearch search) {
		// TODO Auto-generated method stub
		return sqlSessionSub.selectList("getGameVendorList", search);
	}

	@Override
	public List<HashMap<String, Object>> getBanGameList(BanGameSearch search) {
		// TODO Auto-generated method stub
		return sqlSessionSub.selectList("getBanGameList", search);
	}

	@Override
	public int insertBanGameInfo(HashMap<String, Object> item) {
		// TODO Auto-generated method stub
		return sqlSession.update("insertBanGameInfo", item);
	}

	@Override
	public int insertNexusGameInfo(HashMap<String, Object> item) {
		// TODO Auto-generated method stub
		return sqlSession.update("insertNexusGameInfo", item);
	}

	@Override
	public HashMap getVendorApiInfo(CmnSearch search) {
		// TODO Auto-generated method stub
		return sqlSessionSub.selectOne("getVendorApiInfo", search);
	}
}
