package com.ssj.service.sys.lyh.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.ssj.bean.sys.lyh.domain.TbYbDetail;
import com.ssj.dao.sys.lyh.dao.IYbDetailDao;
import com.ssj.dao.sys.lyh.dao.IYbDetailQueryDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.framework.core.persistence.DynamicSpecifications;
import com.ssj.service.sys.lyh.service.IYbDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.repository.PagingAndSortingRepository;

import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;

@Transactional
@Service(version = "1.0")
public class YbDetailServiceImpl extends BaseServiceImpl<TbYbDetail, String> implements IYbDetailService {

	@Autowired
	private IYbDetailDao dao;
	@Autowired
	private IYbDetailQueryDao queryDao;
	
	@Override
	public PagingAndSortingRepository<TbYbDetail, String> getDao() {
		
		return dao;
	}

	@Override
	public Page<Map<String, Object>> findForPage(Object object, Pageable initPage) {
		return queryDao.findForPage(object,initPage);
	}

	@Override
	public Page<TbYbDetail> findByPage(Object object, Pageable initPage) {
		Specification<TbYbDetail> specification = DynamicSpecifications.bySearchFilter(null, TbYbDetail.class);
		return  dao.findAll(specification, initPage);
	}

	@Override
	public List<Map<String, Object>> pageFind(int i, int pageSize) {
		return queryDao.pageFind(i,pageSize);
	}

	@Override
	public List<Map<String, Object>> pageFind2(int i, int pageSize, String tableName) {
	
		return queryDao.pageFind2(i,pageSize,tableName);
	}


}
