SpringBoot(四)开启驼峰命名 以及@JsonIgnorez注解
1、配置文件yml中
mybatis:
configuration:
map-underscore-to-camel-case: true #开启驼峰命名和下划线命名的自动转换
实体类和表中对应字段可能不一样的命名方式
2、实体类中不想返回接口中的数据可以使用@JsonIgnorez注解
package com.itheima.pojo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class User {
private Integer id;//主键ID
private String username;//用户名
@JsonIgnore
private String password;//密码
private String nickname;//昵称
private String email;//邮箱
private String userPic;//用户头像地址
private LocalDateTime createTime;//创建时间
private LocalDateTime updateTime;//更新时间
}