mybatis 低版本配置JSON格式字段的映射

119 阅读1分钟

配置查询映射

  1. 需要在实体类上打注解
  2. xml 中配置映射
@TableName(resultMap = "xx名字")
<resultMap id="xx名字" type="com.xxx.xxx.entity.实体类名">
    <result property="groupConfigJson" column="group_config_json" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.xxx.xxx.handler.JacksonTypeHandler" />
</resultMap>

配置通过实体类更新和新增映射

@ApiModelProperty(value = "工作流可拓展配置字段")
@TableField(value = "group_config_json",el = "groupConfigJson,typeHandler = com.xxx.xxxx.handler.JacksonTypeHandler")
private JSONObject groupConfigJson;