Closed dengshidang closed 1 year ago
使用: 1、实现 @MappedTypes({Arrays.class}) @MappedJdbcTypes(JdbcType.ARRAY) public class FastjsonArrayHandler extends AbstractTypeHandler {
@Override protected List parse(String json) { return StringUtils.isBlank(json) ? null : JSONObject.parseObject(json,new TypeReference<List>(){}.getType()); } @Override protected String toJson(List list) { return JSONObject.toJSONString(list); }
} 2 、实体类里面添加 @Entity.Table(value = "model_category",autoResultMap = true)
3、对应的字段添加
@Entity.Column(value = "interfaces",typeHandler = FastjsonArrayHandler.class) private List interfaces;
这个基类加到mapper中的作用是什么?感觉完全放自己业务代码也可以用。
可以加Q群讨论:277256950
使用: 1、实现 @MappedTypes({Arrays.class}) @MappedJdbcTypes(JdbcType.ARRAY) public class FastjsonArrayHandler extends AbstractTypeHandler
{
} 2 、实体类里面添加 @Entity.Table(value = "model_category",autoResultMap = true)
3、对应的字段添加
@Entity.Column(value = "interfaces",typeHandler = FastjsonArrayHandler.class) private List interfaces;