1.在配置文件中配置数据库url地址加上下面的参数serverTimezone=GMT%2B8
保持数据库时间为北京时间
spring.datasource.url = jdbc:mysql://192.168.0.173:3306/guard?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&failOverReadOnly=false&rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2B8
spring.datasource.username = username
spring.datasource.password = password
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
2.在pojo中的时间类型字段注解上不需要再加timezone = "GMT+8"
/**
* @description:基类
* @author :liuf
* @since :2020/7/21 16:57
*/
public class BasicEntity implements Serializable {
private static final long serialVersionUID = -6150348308354729953L;
/**
* 创建人
*/
private String creatorId;
/**
* 创建时间
*/