mysql字段
springboot配置
- 依赖
compile('com.vladmihalcea:hibernate-types-52:2.4.1')
- 实体
@Getter
@Setter
@Entity(name = "opt_log")
@TypeDef(name = "json",typeClass = JsonStringType.class)
public class OptLog {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ApiModelProperty(value = "ID")
private Long id;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "创建时间")
private Date creatTime;
@ApiModelProperty(value = "表ID")
private Integer tableId;
@ApiModelProperty(value = "表名称")
private String tableName;
@ApiModelProperty(value = "标题")
private String title;
@Type(type = "json")
@ApiModelProperty(value = "详情")
private JSONObject detail;
}
标签:jpa,sprinboot,value,ApiModelProperty,json,private,mysql,ID From: https://www.cnblogs.com/z8080/p/17032526.html
JSONObject
类型也可以换成自字义实体,并实现Serializable
接口