导入mybatis-plus依赖
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.1.0</version>
</dependency>
实体类注解对应
@TableName("user") //代表表名
public class User {
//映射id
@TableId(value = "id",type = IdType.AUTO)
private Integer id;
//映射字段和表字段对应
@TableField("username")
private String username;
//映射字段和表字段对应
@TableField("password")
private String password;
Mapper接口类继承BaseMapper 不需要xml了
@Mapper
public interface UserMapper extends BaseMapper<User> {
}