package com.ssj.service.weixin.library.service.impl;

import com.ssj.bean.weixin.libmy.domain.LibBookSwitchInfo;
import com.ssj.dao.weixin.library.dao.IBookSwitchInfoDao;
import com.ssj.dao.weixin.library.dao.IReadParentQueryDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.service.reading.out.VipBorrowOutDto;
import com.ssj.service.weixin.library.dto.out.BookHisViewOutDto;
import com.ssj.service.weixin.library.dto.out.IndexOutDto;
import com.ssj.service.weixin.library.dto.out.LibRankingOutDto;
import com.ssj.service.weixin.library.dto.out.SuccessOutDto;
import com.ssj.service.weixin.library.service.IBookSwitchInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

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


@Service
@Transactional
public class BookSwitchInfoServiceImpl extends BaseServiceImpl<LibBookSwitchInfo, String> implements IBookSwitchInfoService {

	@Autowired
	private IBookSwitchInfoDao dao;

	@Autowired
	private IReadParentQueryDao queryDao;
	
	@Override
	public PagingAndSortingRepository<LibBookSwitchInfo, String> getDao() {
		
		return dao;
	}

	@Override
	public List<LibBookSwitchInfo> findSwitchList(String searchLibId, int type) {
		return dao.findSwitchList(searchLibId,type);
	}

	@Override
	public LibBookSwitchInfo findSwitchInfo(String libId, Integer type,String detailId) {
		return dao.findSwitchInfo(libId,type,detailId);
	}

	@Override
	public Page<IndexOutDto> findGoodIndexData(Map<String,String> params, Pageable pageable) {
		return queryDao.findGoodIndexData(params,pageable);
	}

	@Override
	public List<SuccessOutDto> findBorrowedList(List<String> bookDetails) {
		return queryDao.findBorrowedList(bookDetails);
	}

	@Override
	public Page<Map<String, Object>> growthRecordList(Map<String, Object> params, Pageable pageable) {
		return queryDao.growthRecordList(params,pageable);
	}

	@Override
	public Page<BookHisViewOutDto> themeBorrowedList(Map<String, String> params, Pageable pageable) {
		return queryDao.themeBorrowedList(params,pageable);
	}

	@Override
	public Page<LibRankingOutDto> findUserRankingLib(Map<String, Object> params, Pageable pageable) {
		return queryDao.findUserRankingLib(params,pageable);
	}

	@Override
	public Page<LibRankingOutDto> libRankingHis(Map<String, Object> params, Pageable pageable) {
		return queryDao.libRankingHis(params,pageable);
	}

	@Override
	public List<VipBorrowOutDto> findInfoListById(String bookInfoId,String libId) {
		return queryDao.findInfoListById(bookInfoId,libId);
	}
}
