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.Class1;
import com.ruoyi.test.mapper.Class1Mapper;
import com.ruoyi.test.seriver.IClass1Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class Class1ServiceImpl extends ServiceImpl<Class1Mapper, Class1> implements IClass1Service {

    @Autowired
    private Class1Mapper class1Mapper;

    @Override
    public Class1 classList(String grade, String Class) {
        LambdaQueryWrapper<Class1> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Class1::getGrade,grade)
                .eq(Class1::getClass1,Class);
        return class1Mapper.selectOne(queryWrapper);
    }

    @Override
    public Class1 selectClass1(Long id) {
        LambdaQueryWrapper<Class1> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Class1::getId,id);
        return class1Mapper.selectOne(queryWrapper);
    }

    @Override
    public int updateClass(Long id,Integer num) {
        return class1Mapper.updateClass(id,num);
    }

    @Override
    public int addclass1(String name, String grade, String Class1) {
        return class1Mapper.addclass1(name,grade,Class1);
    }
}
