链接:https://blog.csdn.net/YonJarLuo/article/details/81187239
自动生成工具只是生成很单纯的表,复杂的一对多,多对多的情况则是在建表的时候就建立好了关系(如添加外键,中间表什么的),然后自动生成就行了,会覆盖这些复杂情况!
添加mybatis的generator插件:
链接:https://blog.csdn.net/readyyy/article/details/85935365
1,先用generator工具生成xml,mapper,bean
2,对于复杂关系,还得自己再加工一下
2-1在bean中新增一个extend包,添加extend类各自包含对方一个集合引用
(多对多)(如果是一对多,一那方包含)
2-2在dao中新增一个extend包,添加extend接口类,实现多表查询功能
2-3在mapper.xml中新增一个extend包,添加extend.xml文件,实现多表查询功能