package kr.co.jinwoosi.clfd.conts.cont.service.impl;

import java.util.List;

import javax.annotation.Resource;

import kr.co.jinwoosi.clfd.conts.cont.mapper.ContItemMapper;
import kr.co.jinwoosi.clfd.conts.cont.model.ContItem;
import kr.co.jinwoosi.clfd.conts.cont.model.ContItemSearch;
import kr.co.jinwoosi.clfd.conts.cont.service.ContItemService;
import kr.co.jinwoosi.clfd.framework.base.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;

@Service(value="contItemService")
public class ContItemServiceImpl extends BaseServiceImpl<ContItem, ContItemSearch, ContItemMapper> implements ContItemService {

	@Override
	@Resource (name="contItemMapper")
	protected void setMapper (ContItemMapper mapper) {
		super.setMapper (mapper);
	}

	@Override
	public ContItem selectLast(ContItemSearch contItemSearch) {
		contItemSearch.setSort("REG_DT");
		contItemSearch.setSortOrd("DESC");
		List<ContItem> contItemList = super.selectList(contItemSearch);
		if(contItemList.size() > 0) {
			return contItemList.get(0);
		}else {
			return null;
		}
	}


}
