Mybatis CRUD注解Annotation的使用

@Select,@Insert,@Update,@Delete完成常见的增删改查sql语句的映射。

Mybatis CRUD注解Annotation的使用

注解和xml配置中的sql语法一致。
Mybatis CRUD注解Annotation的使用

Mybatis CRUD注解Annotation的使用

@Options注解,使用数据库自动增长的主键,需要底层数据库的支持。

Mybatis CRUD注解Annotation的使用

测试类。
Mybatis CRUD注解Annotation的使用

将数据表中的字段名和PO类中的属性进行匹配对应,就要使用@Result注解。
Mybatis CRUD注解Annotation的使用

Mybatis CRUD注解Annotation的使用
Mybatis CRUD注解Annotation的使用

一对一关联查询@One注解的使用

Mybatis CRUD注解Annotation的使用

Mybatis CRUD注解Annotation的使用

OneToMany一对多关联查询
Mybatis CRUD注解Annotation的使用

Mybatis CRUD注解Annotation的使用

Mybatis CRUD注解Annotation的使用

ManyToMany多对多关联查询

Mybatis CRUD注解Annotation的使用

Mybatis CRUD注解Annotation的使用