package com.ssj.service.sys.orgclass;

import com.ssj.bean.sys.orgclass.VipBindClass;
import com.ssj.dao.sys.orgclass.VipBindClassDao;
import com.ssj.framework.core.common.service.BaseServiceImpl;
import com.ssj.framework.core.persistence.DynamicSpecifications;
import com.ssj.framework.core.persistence.SearchFilter;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

@Service
@Transactional
public class VipBindClassServiceImpl extends BaseServiceImpl<VipBindClass, String> implements VipBindClassService {

    @Autowired
    private VipBindClassDao vipBindClassDao;

    @Override
    public PagingAndSortingRepository<VipBindClass, String> getDao() {
        return vipBindClassDao;
    }

    @Override
    public Page<VipBindClass> findByPage(Map<String, Object> params, Pageable sp) {
        Map<String, SearchFilter> filters = SearchFilter.parse(params);
        Specification<VipBindClass> specification = DynamicSpecifications.bySearchFilter(filters.values(), VipBindClass.class);
        return  vipBindClassDao.findAll(specification,sp);
    }

}
