springboot配置
方式一:
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #打印sql日志
map-underscore-to-camel-case: false #下划线转驼峰
mapper-locations: classpath*:mapper/*.xml #mapper配置文件路径
global-config:
db-config:
id-type: auto #主键生成策略
方式二
@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "boot_user")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("用户id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
}
本文介绍了SpringBoot中MyBatis-Plus的配置方法,包括日志实现、字段转换规则和Mapper配置文件路径。同时展示了User实体类的定义,使用了@TableId注解设置主键ID类型为自动增长。
320

被折叠的 条评论
为什么被折叠?



