想试试mybatis逆向工程来生成简单sql语句,mybatis-generator真是帮了大忙
生成的文件
- insert
- update by primary key
- update by example (using a dynamic where clause)
- delete by primary key
- delete by example (using a dynamic where clause)
- select by primary key
- select by example (using a dynamic where clause)
- count by example
generatorConfig.xml
配置
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
使用代码方式使用mybatis-generator生成代码
1 | public class GeneratorSqlmap { |
最后项目结构
dal.mapper
dal.model
resources.mapper
都是自动生成的,只要自己写service
和serviceimpl
即可