package com.xunwang.education.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xunwang.education.entity.TeacherCertifications;
import com.xunwang.education.mapper.TeacherCertificationsMapper;
import com.xunwang.education.service.TeacherCertificationsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 老师认证 服务实现类
 * </p>
 *
 * @author Long
 * @since 2022-11-24
 */
@Service
public class TeacherCertificationsServiceImpl extends ServiceImpl<TeacherCertificationsMapper, TeacherCertifications> implements TeacherCertificationsService {

    /**
     * 判断老师类型：在校大学生，专职老师
     * @param uid
     * @return
     */
    @Override
    public String getTeacherType(String uid) {
        TeacherCertifications one = baseMapper.selectOne(new QueryWrapper<TeacherCertifications>().eq("uid", uid));
        String education = one.getEducation();
        if (education.contains("在读")) {
            return "学生教员";
        } else {
            return "专职教员";
        }
    }

    /**
     * 根据用户id查询认证相关信息
     * @param uid
     */
    @Override
    public TeacherCertifications getInfosByUid(String uid) {
        TeacherCertifications one = baseMapper.getInfosByUid(uid);
        return one;
    }
}
