package com.rf.psychological.scale.service.impl;

import com.rf.psychological.dao.model.MemoryCheckEntity;
import com.rf.psychological.dao.repository.MemoryCheckRepository;
import com.rf.psychological.scale.service.MemoryCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zsy
 * @description:
 * @date 2021/5/14 10:51
 */
@Service
public class MemoryCheckServiceImpl implements MemoryCheckService {
    @Autowired
    private MemoryCheckRepository memoryCheckRepository;

    /**
     * 根据flag获取全部答案
     *
     * @param flag
     */
    //@Override
    //public List<AnswerEntity> getAnswerByFlag(String flag) {
    //return this.answerRepository.getAnswerByFlag(flag);
    //}

    /**
     * 保存
     * @param memoryCheckEntity
     */
    @Override
    public void save(MemoryCheckEntity memoryCheckEntity) {
        this.memoryCheckRepository.save(memoryCheckEntity);
    }

    /**
     * 根据关联记忆id修改既时记忆状态
     * @param correlationMemory
     */
    @Override
    public void updateStatus(String correlationMemory) {
        this.memoryCheckRepository.updateStatus(correlationMemory);
    }

    /**
     * 根据phone获取用户进行中记忆检查
     * @param phone
     */
    @Override
    public List<MemoryCheckEntity> getMemoryCheckList(String phone,String type,String testType,String questionNo,String institutionNo) {
        return this.memoryCheckRepository.getMemoryCheckList(phone,type,testType,questionNo,institutionNo);
    }

    /**
     * 根据id获取用户记忆检查信息
     * @param correlationMemory
     */
    @Override
    public MemoryCheckEntity selectById(String correlationMemory) {
        return this.memoryCheckRepository.selectById(correlationMemory);
    }

    /**
     * 查询当前用户第六题信息
     * @param
     */
    @Override
    public MemoryCheckEntity selectMemory(String phone, String correlationMemory,String institutionNo) {
        return this.memoryCheckRepository.selectMemory(phone,correlationMemory,institutionNo);
    }

    /**
     * 清除进行中任务
     * @param
     */
    @Override
    public void clearMemory(String phone,String type,String testType,String questionNo,String institutionNo) {
        this.memoryCheckRepository.clearMemory(phone,type,testType,questionNo,institutionNo);
    }


}
