package com.ruoyi.test.seriver.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.test.domain.QuestionType;
import com.ruoyi.test.mapper.QuestionTypeMapper;
import com.ruoyi.test.seriver.IQuestionTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class QuestionTypeServiceImpl extends ServiceImpl<QuestionTypeMapper, QuestionType> implements IQuestionTypeService {

    @Autowired
    private QuestionTypeMapper questionTypeMapper;

    @Override
    public String getQuestiontype(int id) {
        LambdaQueryWrapper<QuestionType> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(QuestionType::getId,id);
        return questionTypeMapper.selectOne(queryWrapper).getType();
    }

    @Override
    public Long getId(String type) {
        LambdaQueryWrapper<QuestionType> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(QuestionType::getType,type);
        return questionTypeMapper.selectOne(queryWrapper).getId();
    }
}
