Mybatis 对象关系映射之一对多 and 多对多 关系

一:一对多 |多对多 关系

0、创建数据库表

Mybatis 对象关系映射之一对多 and 多对多 关系

Mybatis 对象关系映射之一对多 and 多对多 关系

1、创建实体类

1、用户实体类

Mybatis 对象关系映射之一对多 and 多对多 关系

2、订单实体类

Mybatis 对象关系映射之一对多 and 多对多 关系

3、接口

Mybatis 对象关系映射之一对多 and 多对多 关系

mapper.xml文件的编写

方式一:

Mybatis 对象关系映射之一对多 and 多对多 关系

方式二:

Mybatis 对象关系映射之一对多 and 多对多 关系

Mybatis 对象关系映射之一对多 and 多对多 关系

猜你喜欢

转载自blog.csdn.net/weixin_34109408/article/details/86705972