package nlib.col.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import nlib.col.service.CartService;
import nlib.col.service.CollectionVO;
import nlib.col.service.DeptVO;
import nlib.col.service.InterestService;
import nlib.restful.service.DataApiReqVO;
import nlib.restful.service.DataApiResVO;

@Service("interestService")
public class InterestServiceImpl implements InterestService
{
	private static final Logger log = LoggerFactory.getLogger(InterestServiceImpl.class);
	
	@Resource(name="interestDAO")
	private InterestDAO interestDAO;
	
	/* 
	 * 관심자료 목록을 조회한다.
	 * 
	 * (non-Javadoc)
	 * @see nlib.col.service.CollectionService#listInterests(nlib.restful.service.DataApiReqVO)
	 */
	public List<CollectionVO> listInterests(CollectionVO vo)  {
		return interestDAO.listInterests(vo);
	}
	/* 
	 * 관심자료목록의 총 개수를 조회한다.
	 * (non-Javadoc)
	 * @see nlib.col.service.CollectionService#countListInterests(nlib.col.service.CollectionVO)
	 */
	public int countListInterests(CollectionVO vo) {
		return interestDAO.countListInterests(vo);
	}
	/* 
	 * 관심자료 목록 삭제
	 * (non-Javadoc)
	 * @see nlib.col.service.CollectionService#deleteInterests(java.util.List)
	 */
	public void deleteInterests(List<String> masterIdList,String mbInfoId) {
		CollectionVO vo = new CollectionVO();
		vo.setMbInfoId(mbInfoId);
		for(String masterId : masterIdList) {
			vo.setMasterId(masterId);
			interestDAO.deleteInterests(vo);
        }
	}
	/* 
	 * 관심자료 추가시 중복체크용 count
	 * (non-Javadoc)
	 * @see nlib.col.service.CollectionService#countInterest(nlib.col.service.CollectionVO)
	 */
	public int countInterest(CollectionVO vo) {
		return interestDAO.countInterest(vo);
	}

	/* 
	 * 관심자료 추가
	 * (non-Javadoc)
	 * @see nlib.col.service.CollectionService#insertInterest(nlib.col.service.CollectionVO)
	 */
	public void insertInterest(CollectionVO vo) {
		interestDAO.insertInterest(vo);
	}
	/* 
	 * 문화원 목록 조회
	 * (non-Javadoc)
	 * @see nlib.col.service.CollectionService#selectOrgList()
	 */
	public List<DeptVO> selectOrgList(CollectionVO vo) {
		return interestDAO.selectOrgList(vo);
	}
}