1.首先在对应表添加一个 json
类型字段
json
2.在java对应的实体类添加对应的字段,重点是加上 (typeHandler = JacksonTypeHandler.class)
这个注解
(typeHandler = JacksonTypeHandler.class)
不然的话保存会报如下错 Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property 'urlParams'. It was either not specified and/or could not be found for the javaType (com.alibaba.fastjson.JSONObject) : jdbcType (null) combination.
Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property 'urlParams'. It was either not specified and/or could not be found for the javaType (com.alibaba.fastjson.JSONObject) : jdbcType (null) combination.
3. mybatisPlus
查询 json
类型数据结果为 null
,这个得在 @TableName
加上 autoResultMap = true
注解
mybatisPlus
json
null
@TableName
autoResultMap = true