src/main/java/cn/lemon/lib/service/StudentService.java

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package cn.lemon.lib.service;

import cn.lemon.lib.dao.StudentDao;
import cn.lemon.lib.entity.Student;
import cn.lemon.lib.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class StudentService {

    @Autowired
    StudentDao studentDao;

    @Autowired
    StudentMapper studentMapper;


    public void save(Student student) {
        studentDao.save(student);
    }

    public long count() {
        return studentDao.count();
    }

    public Student getStudentById(long studentId) {
        Optional<Student> optionalGrade = studentDao.findById(studentId);
        Student student = optionalGrade.get();
        return student;
    }


    public void delete(Student student) {
        studentDao.delete(student);
    }

    public List<Student> getStudentList(int page, int limit) {
        List<Student> studentList = studentMapper.getStudentListPage(page, limit);
        return studentList;
    }

    //班级学生人数
    public long countOfGrade(int gradeId) {

        return studentMapper.countOfGrade(gradeId);
    }

    // 获取当前班级的学生
    public List<Student> getStudentListOfGrade(int page, int limit, int gradeId) {

        return studentMapper.getStudentListOfGrade(page,limit,gradeId);
    }

    public Student check(String username,String password) {
        Student student = studentMapper.findByUsernameAndPassword(username, password);
        return student;
后面还有 3 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。