必须在实体里面加上 @TableName(autoResultMap = true),不然无效
只要在对应字段加上注解就可以:
@TableName(autoResultMap = true)
public class BlogUser implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private String name;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createTime;
private Integer version;
@TableField(typeHandler= JsonTypeHandler.class)
private Map relation;
@TableField(typeHandler= ArrayTypeHandler.class)
private List fans;
还有一种就是直接在xml里面写,直接引用,效果是一样的
原文:https://www.cnblogs.com/houzheng/p/12942872.html