package com.sf.mapperTest;


import com.sf.entity.Student;
import com.sf.mapper.StudentMapper;
import com.sf.util.SqlSessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

import java.util.List;

/**
 * @author WanJl
 * @version 1.0
 * @title StudentMapperTest
 * @description
 * @create 2025/11/9
 */
public class StudentMapperTest {
    @Test
    public void testSelectByCid(){
        SqlSession sqlSession = SqlSessionFactoryUtils.getSqlSession();
        StudentMapper studentMapper = sqlSession.getMapper(StudentMapper.class);
        List<Student> students = studentMapper.selectByClassId(1);
        students.forEach(System.out::println);
    }
    @Test
    public void testSelectAll(){
        SqlSession sqlSession = SqlSessionFactoryUtils.getSqlSession();
        StudentMapper studentMapper = sqlSession.getMapper(StudentMapper.class);
        List<Student> students = studentMapper.selectAll();
        students.forEach(System.out::println);
    }
}
