ClassificationServiceImpl.java 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. package cn.minbb.evaluationsystemserver.service.impl;
  2. import cn.minbb.evaluationsystemserver.entity.Classification;
  3. import cn.minbb.evaluationsystemserver.entity.repository.ClassificationRepository;
  4. import cn.minbb.evaluationsystemserver.service.ClassificationService;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.data.domain.Sort;
  7. import org.springframework.stereotype.Service;
  8. import java.util.List;
  9. @Service
  10. public class ClassificationServiceImpl implements ClassificationService {
  11. private ClassificationRepository classificationRepository;
  12. @Autowired
  13. public ClassificationServiceImpl(ClassificationRepository classificationRepository) {
  14. this.classificationRepository = classificationRepository;
  15. }
  16. @Override
  17. public List<Classification> findEnabledClassification() {
  18. return classificationRepository.findByEnabledTrue(new Sort(Sort.Direction.DESC, "orderBy"));
  19. }
  20. @Override
  21. public Classification findById(Long classificationId) {
  22. return classificationRepository.getOne(classificationId);
  23. }
  24. }