package top.awin_x.learn.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import top.awin_x.learn.pojo.Course;

import java.util.ArrayList;

@Mapper
public interface CourseMapper {
    @Select("SELECT * FROM t_course")
    public ArrayList<Course> selectAll();

    @Options(useGeneratedKeys = true, keyProperty = "N_COURSE_ID")
    @Insert("INSERT INTO t_course(VC_COURSE_NAME, N_TYPE, F_CREDIT, N_GRADE, N_MAJOR, VC_DETAIL) VALUES " +
            "(#{VC_COURSE_NAME}, #{N_TYPE},#{F_CREDIT},#{N_GRADE},#{N_MAJOR},#{VC_DETAIL})")
    public int insert(Course course);
}
