@ApiModelProperty(value = "头像") @TableField(strategy = FieldStrategy.NOT_EMPTY) private String url; @ApiModelProperty(value = "用户名") @TableField(strategy = FieldStrategy.NOT_EMPTY) private String username; @ApiModelProperty(value = "用户昵称") @TableField(strategy = FieldStrategy.NOT_EMPTY) private String nick; @ApiModelProperty(value = "密码") @TableField(strategy = FieldStrategy.NOT_EMPTY) private String password;
public enum FieldStrategy { IGNORED, NOT_NULL, NOT_EMPTY, DEFAULT; private FieldStrategy() { } }
strategy字段更新插入策略属性说明:
- IGNORED(0): “忽略判断”, 所有字段都更新和插入
- NOT_NULL(1): “非 NULL 判断”, 只更新和插入非NULL值
- NOT_EMPTY(2): “非空判断”, 只更新和插入非NULL值且非空字符串
另外一种方式可全局配置,未亲手实践