package com.template.services.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.template.model.enumModel.eModelType;
import com.template.model.pojo.AlumniAdminApply;
import com.template.mapper.AlumniAdminApplyMapper;
import com.template.services.AlumniAdminApplyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ceshi
 * @since 2024-11-25
 */
@Service
public class AlumniAdminApplyServiceImpl extends ServiceImpl<AlumniAdminApplyMapper, AlumniAdminApply> implements AlumniAdminApplyService {

    @Autowired
    private AlumniAdminApplyMapper alumniAdminApplyMapper;

    @Override
    public AlumniAdminApply queryImageAdmin() {
        QueryWrapper<AlumniAdminApply> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("model_id", eModelType.Image.getValue());

        AlumniAdminApply result = alumniAdminApplyMapper.selectOne(queryWrapper);
        return result;
    }

    @Override
    public AlumniAdminApply queryActivityAdmin() {
        QueryWrapper<AlumniAdminApply> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("model_id", eModelType.Activity.getValue());

        AlumniAdminApply result = alumniAdminApplyMapper.selectOne(queryWrapper);
        return result;
    }

    @Override
    public AlumniAdminApply queryEndorseAdmin() {
        QueryWrapper<AlumniAdminApply> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("model_id", eModelType.Endorse.getValue());

        AlumniAdminApply result = alumniAdminApplyMapper.selectOne(queryWrapper);
        return result;
    }

    @Override
    public boolean insertOrUpdateAdmin(AlumniAdminApply aaa) {
        boolean result = this.saveOrUpdate(aaa);
        return result;
    }
}
