mybatis的自定义类型转化器如何使用
作者:互联网
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.****.dao.StudentVOMapper"> <resultMap id="BaseResultMap" type="com.****.bean.Student"> <id column="id" jdbcType="INTEGER" property="id" /> <result column="age" jdbcType="INTEGER" property="age" /> <result column="config" jdbcType="VARCHAR" property="config" typeHandler="com.****.typehandler.AbstractClassJsonTypeHandler"/> </resultMap> <insert id="insert" parameterType="com.*****.bean.Student" useGeneratedKeys="true" keyProperty="id" keyColumn="id"> insert into student(name, age,config) values (#{name,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER}, ,#{config,jdbcType=VARCHAR,typeHandler=com.****.typehandler.AbstractClassJsonTypeHandler} ) </insert> </mapper>
标签:VARCHAR,name,自定义,age,转化,jdbcType,mybatis,config 来源: https://www.cnblogs.com/zhaijing/p/15988602.html