package cn.minbb.evaluationsystemserver.service.impl; import cn.minbb.evaluationsystemserver.entity.Classification; import cn.minbb.evaluationsystemserver.entity.repository.ClassificationRepository; import cn.minbb.evaluationsystemserver.service.ClassificationService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import java.util.List; @Service public class ClassificationServiceImpl implements ClassificationService { private ClassificationRepository classificationRepository; @Autowired public ClassificationServiceImpl(ClassificationRepository classificationRepository) { this.classificationRepository = classificationRepository; } @Override public List findEnabledClassification() { return classificationRepository.findByEnabledTrue(new Sort(Sort.Direction.DESC, "orderBy")); } @Override public Classification findById(Long classificationId) { return classificationRepository.getOne(classificationId); } }