文章目录 `0 可能错误截图``1 在属性上加自定义Json返回注释 @JsonSerialize``2 新建实体类 CustomDateTimeSerializer` 0 可能错误截图 1 在属性上加自定义Json返回注释 @JsonSerialize @TableField(value = "create_time")@JsonSerialize(using = CustomDateTimeSerializer.class)private Date createTime; 2 新建实体类 CustomDateTimeSerializer public class CustomDateTimeSerializer extends JsonSerializer<Date>{@Overridepublic void serialize(Date value, JsonGenerator gen, SerializerProvider serializers)throws IOException {SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");sdf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));gen.writeString(sdf.format(value)); } }