一、创建IDEA数据库连接
二、连接数据库
三、生成Mybatis各种文件
1、创建 com.example.emos.wx.db.dao 和 创建 com.example.emos.wx.db.pojo
二、 选中这些数据表,然后点击右键,选择mybatis-generator
三、每个Dao接口上都要添加 @Mapper 注解
四、在application.yml配置mybatis映射
mybatis:
mapper-locations: classpath*:mapper/*.xml
type-aliases-package: com.example.emos.wx.db.pojo
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true
五、配置日志输出
logging:
level:
root: info
com.example.emos.wx.db.dao : warn
pattern:
console: "%d{HH:mm:ss} %-5level %msg%n"