Mybatis的逆向工程
Spring Boot推荐的项目结构:
根目录:com.example.myproject
1)domain:实体类(com.example.domain)
2)Dao:数据访问层(com.example.repository)
3)Service:数据服务接口层(com.example.service)
ServiceImpl:数据服务实现层(com.example.service.impl)
4)Controller:前端控制器(com.example.controller)
5)utils:工具类(com.example.utils)
6)constant:常量接口类(com.example.constant)
7)config:配置信息类(com.example.config)
8)dto:数据传输对象(Data Transfer Object,用于封装多个实体类(domain)之间的关系,不破坏原有的实体类结构)(com.example.dto)
9)vo:视图包装对象(View Object,用于封装客户端请求的数据,防止部分数据泄露,保证数据安全,不破坏原有的实体类结构)(com.example.vo)
1.添加依赖
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<!--mybatis的依赖 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.0</version>