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