LiveServiceImpl.java 1.57 KB
package com.bjivt.service.showtime.impl;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.bjivt.base.dao.BaseDao;
import com.bjivt.base.service.impl.BaseServiceImpl;
import com.bjivt.dao.showtime.LiveDao;
import com.bjivt.entity.showtime.Live;
import com.bjivt.service.showtime.LiveService;
import com.bjivt.util.Pager;

@Component
public class LiveServiceImpl extends BaseServiceImpl<Live, Integer> implements LiveService {

	@Autowired
	private LiveDao liveDao;

	@Override
	public BaseDao getBaseDao() {
		return liveDao;
	}

	@Override
	public List<Live> findStarLiveListByPage(Live live, Pager page) {
		Map<String, Object> map = new HashMap<String, Object>();
		if (page != null) {
			int count = getStarLiveCountBy(live);
			page.setCount(count);
		}
		map.put("page", page);
		map.put(live.getClass().getSimpleName(), live);
		return liveDao.findStarLiveListByPage(map);
	}

	private int getStarLiveCountBy(Live live) {
		// TODO Auto-generated method stub
		return liveDao.getStarLiveCountBy(live);
	}

	@Override
	public List<Live> findLiveListByPage(Live live, String startTime, String endTime, Pager page) {
		Map<String, Object> map = new HashMap<String, Object>();
		if (page != null) {
			int count = getStarLiveCountBy(live);
			page.setCount(count);
		}
		map.put("startTime", startTime);
		map.put("endTime", endTime);
		map.put("page", page);
		map.put(live.getClass().getSimpleName(), live);
		return liveDao.findLiveListByPage(map);
	}
}