Skip to content

gaojizhou/MybatisTypeHandler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MybatisTypeHandler

Specify typeHandler for List<T> in mybatis.

typeHandler java type sql type
ListStringHandler List<String> varchar[]
ListBigDecimalHandler List<BigDecimal> numeric[]
ListBooleanHandler List<Boolean> bool[]
ListDateHandler List<Date> date[]
ListIntegerHandler List<Integer> integer[]

Use

pom.xml

<dependency>
    <groupId>io.github.gaojizhou</groupId>
    <artifactId>MybatisTypeHandler</artifactId>
    <version>1.0.1</version>
</dependency>

Mybatis xml file

<select id="queryDog" resultMap="ResultMap">
    select id, name, coat_colors from dog
    where dog.id = any(#{ids,jdbcType=ARRAY,typeHandler=io.github.gaojizhou.ListStringHandler})
</select>

<resultMap id="ResultMap" type="io.github.gaojizhou.xxxxx.Dog">
    <id column="id" jdbcType="VARCHAR" property="id"/>
    <result column="name" jdbcType="VARCHAR" property="name"/>
    <result column="coat_colors"
            jdbcType="ARRAY"
            property="coatColors"
            typeHandler="io.github.gaojizhou.ListStringHandler"/>
</resultMap>

License

See the LICENSE file for license rights and limitations (GPL-3.0 or later).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages