package top.awin_x.learn;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import top.awin_x.learn.mapper.CourseMapper;
import top.awin_x.learn.pojo.Course;

import java.util.ArrayList;

@SpringBootTest
class Learn03SpringbootApplicationTests {

    @Autowired
    private CourseMapper courseMapper;

    @Test
    public void testSelectAllCourse(){
        ArrayList<Course> courses = courseMapper.selectAll();
        for (Course course : courses) {
            System.out.println(course);
        }
    }

    @Test
    public void testInsertCourse(){
        Course course = new Course();
        course.setVC_COURSE_NAME("测试数据");
        course.setF_CREDIT(2.5F);
        course.setN_GRADE(2024);
        course.setN_MAJOR(2);
        course.setVC_DETAIL("test");
        course.setN_TYPE(2);
        System.out.println(courseMapper.insert(course));
        System.out.println(course.getN_COURSE_ID());
    }

}
