package com.cesgroup.homwork.mybatis.sample.mapper;

import com.cesgroup.homwork.mybatis.sample.entity.Student;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author ytj
 * @date 2020/1/2 22:36
 */
@Mapper
public interface StudentMapper {
    @Insert("INSERT INTO student (id, name, context) VALUES(#{id}, #{name}, #{context})")
    void insert(Student student);

    @Select("SELECT id, name, context FROM student WHERE id = #{id}")
    Student findById(String id);

    @Select("SELECT id, name, context FROM student ")
    List<Student> findAll();
}
