1 第一种方法 :创建 resultMap标签将返回值类型标注
<resultMap id="BaseResultMap" type="cn.net.hylink.qingzhi.entity.v2.TPoliceDutyRelation"> <result column="id" jdbcType="VARCHAR" property="id"></result> <result column="police_dbid" jdbcType="OTHER" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" property="policeDbid"></result> <result column="police_mjid" jdbcType="OTHER" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" property="policeMjid"></result> <result column="police_fjid" jdbcType="OTHER" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" property="policeFjid"></result> <result column="police_jdid" jdbcType="OTHER" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" property="policeJdid"></result> </resultMap>
将字段police_dbid标注typeHandler
第二种方法 在实体上标注类型
@TableField(typeHandler = FastjsonTypeHandler.class) @ApiModelProperty(value = "带班领导ID") private Object policeDbid;