package cn.zyp.stusystem.service.impl; import cn.zyp.stusystem.entity.GradeClass; import cn.zyp.stusystem.entity.Student; import cn.zyp.stusystem.mapper.ClassMapper; import cn.zyp.stusystem.mapper.StudentMapper; import cn.zyp.stusystem.service.ClassService; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.ConfigurationKeys; import lombok.Data; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class ClassServiceImpl extends ServiceImpl implements ClassService { @Autowired private StudentMapper studentMapper; @Override public List findClassByGradeId(Integer gradeId) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("grade",gradeId); return baseMapper.selectList(queryWrapper); } @Override public boolean isClassHasStudent(Integer classId) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("class_id",classId); return studentMapper.selectCount(queryWrapper)>0; } }