背景
mybatis-plus+postgresql获取数据库数据时报错
postgresql.util.PSQLException: 不良的类型值 int : 2020-11-19 02:47:05.013
解决
从报错信息可以看出是时间类型数据映射出现了问题
解决办法是将实体类申明序列化
implements Serializable
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("menu_management")
public class Menu implements Serializable {
private Integer id;
private Integer pid;
private String name;
private String icon;
private String url;
@TableField(exist = false)
private User creator;
private Date createTime;
@TableField(exist = false)
private User modifier;
private Date modifyTime;
@TableField(exist = false)
private List<Menu> children;
private String code;
private Integer level;
}
如果还出现 IndexOutOfBoundsException: Index 7 out of bounds for length 7 的报错,那是因为使用lombok的问题,需要在实体类中同时申明无参和有参构造方法,即添加上@NoArgsConstructor @AllArgsConstructor
原文地址:https://wu55555.blog.csdn.net/article/details/109805106