You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.4 KiB
Java
44 lines
1.4 KiB
Java
|
3 weeks ago
|
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<ClassMapper, GradeClass> implements ClassService {
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private StudentMapper studentMapper;
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public List<GradeClass> findClassByGradeId(Integer gradeId) {
|
||
|
|
QueryWrapper<GradeClass> queryWrapper = new QueryWrapper<>();
|
||
|
|
queryWrapper.eq("grade",gradeId);
|
||
|
|
return baseMapper.selectList(queryWrapper);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public boolean isClassHasStudent(Integer classId) {
|
||
|
|
QueryWrapper<Student> queryWrapper = new QueryWrapper<>();
|
||
|
|
queryWrapper.eq("class_id",classId);
|
||
|
|
|
||
|
|
return studentMapper.selectCount(queryWrapper)>0;
|
||
|
|
}
|
||
|
|
}
|