java实体注解映射mysql数据库设置数据库字段类型以及时间格式
下面我们来说一下如何通过在java实体类注解设置数据库字段的类型
@SuppressWarnings(“serial”)
@Entity
@Table(name = “k_dailyWorkTasks”)
public class DailyWorkTasks extends BaseEntity {
@Column(name = "dailyWorkTitle")
private String dailyWorkTitle;
@Column(name="dailyWorkContent",columnDefinition="TEXT")
private String dailyWorkContent;
@Column(name = "UserId")
private String UserId;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Column(name = "uploadTime")
@Temporal(TemporalType.TIMESTAMP)
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date uploadTime;