package com.rf.psychological.service.impl;

import com.rf.psychological.dao.model.PSQIEntity;
import com.rf.psychological.dao.repository.PSQIRepository;
import com.rf.psychological.service.PSQIService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zzf
 * @description:
 * @date 2021/1/19 16:54
 */
@Service
public class PSQIServiceImpl implements PSQIService {
    @Autowired
    private PSQIRepository psqiRepository;
    /**
     * 查询全量PSQI列表
     *
     * @return
     */
    @Override
    public List<PSQIEntity> findAll() {
        return this.psqiRepository.findAll(Sort.by(Sort.Direction.ASC, "no"));
    }

    /**
     * 保存
     *
     * @return
     */
    @Override
    public PSQIEntity saveSubject(PSQIEntity psqiEntity) {
        return this.psqiRepository.save(psqiEntity);
    }
}
