- dao
- entity
- yml配置文件
- MP运行日志
dao
package com.abc.dao; import com.abc.entity.Student; import com.baomidou.mybatisplus.core.mapper.baseMapper; import org.apache.ibatis.annotations.Mapper; @Mapper public interface StudentDao extends baseMapperentity{ }
package com.abc.entity;
import jdk.nashorn.internal.objects.annotations.Constructor;
import lombok.*;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Student {
private Long id;
private String name;
private int age;
private String sex;
}
yml配置文件
# 服务器端口号
server:
port: 80
# SQL驱动
spring:
datasource:
druid:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/learn_sql
username: root
password: 123456
# MyBatisPlus配置数据库表名的前后缀
mybatis-plus:
global-config:
db-config:
# 前缀
table-prefix: learn_
# 主键递增方式
id-type: auto
# 日志
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
MP运行日志
在配置文件里添加配置后即可,无需别的地方代码编写
所以以后一些打印语句也就没有必要了,直接日志里看就ok



