java开发mysql数据库dateTime类型字段转成北京时间

@Data
public class ArticleQueryVo {
    private String id;

    private String title;

    private Integer status;
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date updateTime;

    private String typeId;

    private String typeName;
    // 收藏状态 1.已收藏 2.未收藏 前端已收藏显示取消收藏按钮,未收藏显示收藏按钮
    private Integer collectStatus;

}

数据库dateTime类型字段,转成北京时间,在vo类的字段上加上如上注解即可

猜你喜欢

转载自blog.csdn.net/qq_41656943/article/details/87017385