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

import javax.annotation.Resource;

import kr.co.jinwoosi.clfd.conts.media.mapper.MediaMapper;
import kr.co.jinwoosi.clfd.conts.media.model.Media;
import kr.co.jinwoosi.clfd.conts.media.model.MediaSearch;
import kr.co.jinwoosi.clfd.conts.media.service.MediaService;
import kr.co.jinwoosi.clfd.framework.base.service.impl.BaseServiceImpl;
import kr.co.jinwoosi.clfd.framework.util.StrUtil;
import org.springframework.stereotype.Service;

@Service(value="mediaService")
public class MediaServiceImpl extends BaseServiceImpl<Media, MediaSearch, MediaMapper> implements MediaService {

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

	@Override
	public void insert(Media media) {
		super.insert(media);
		media.setHash(StrUtil.getDigits(media.getMediaId()));
		mapper.updateHash(media);
	}

	@Override
	public void updateFile(Media media) {
		mapper.updateFile(media);
	}
	
}
