package com.ynfy.buss.exam.userexam.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ynfy.buss.exam.exam.enums.PaperState;
import com.ynfy.buss.exam.userexam.entity.UserExamPapers;
import com.ynfy.buss.exam.userexam.mapper.UserExamPapersMapper;
import com.ynfy.buss.exam.userexam.service.IUserExamPapersService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 用户考试试卷表
 * @Author: jeecg-boot
 * @Date: 2023-03-05
 * @Version: V1.0
 */
@Service
public class UserExamPapersServiceImpl extends ServiceImpl<UserExamPapersMapper, UserExamPapers> implements IUserExamPapersService {

    @Override
    public List<UserExamPapers> UserExamIdAllUserExamPapers(String userExamId) {
        LambdaQueryWrapper<UserExamPapers> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(UserExamPapers::getUserExamId, userExamId)
               .eq(UserExamPapers::getState, PaperState.ING);
        return this.list(wrapper);
    }

    @Override
    public List<UserExamPapers> UserExamIdAllUserExamPapers2(String userExamId) {
        LambdaQueryWrapper<UserExamPapers> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(UserExamPapers::getUserExamId, userExamId);
        return this.list(wrapper);
    }

    @Override
    public List<UserExamPapers> UserExamIdPaperUserExamPapers(String userExamId,String paperId) {
        LambdaQueryWrapper<UserExamPapers> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(UserExamPapers::getUserExamId, userExamId).eq(UserExamPapers::getPaperId, paperId);
        return this.list(wrapper);
    }
    @Override
    public List<UserExamPapers> UserExamPapersList(String userExamId,String paperId) {
        LambdaQueryWrapper<UserExamPapers> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(UserExamPapers::getUserExamId, userExamId).eq(UserExamPapers::getPaperId, paperId);
        return this.list(wrapper);
    }
}
