一、@Param(用于描述属性的名称)
二、CRUD 注解
- @Select: 类似于<select>
- @Insert: 类似于<insert>
- @Update: 类似于<update>
- @Delete: 类似于<delete>
1 public interface StudentMapper {
2 @Select("select * from t_student")
3 List<Student> selAll();
4
5 @Insert("insert into t_student values (default, #{name}, #{age}, #{gender}, #{cid})")
6 int insStu(Student student);
7
8 @Update("update t_student set age=#{1} where id=#{0}")
9 int updStu(int id, int age);
10
11 @Delete("delete from t_student where id=#{0}")
12 int delStu(int id);
13
14 }