mybaits别名简介

typeAliases  别名 

1.1      需求

在mapper.xml中,定义很多的statement,statement需要parameterType指定输入参数的类型、需要resultType指定输出结果的映射类型。

如果在指定类型时输入类型全路径,不方便进行开发,可以针对parameterType或resultType指定的类型定义一些别名,在mapper.xml中通过别名定义,方便开发。

1.2     mybatis默认支持别名

别名

映射的类型

_byte

byte

_long

long

_short

short

_int

int

_integer

int

_double

double

_float

float

_boolean

boolean

string

String

byte

Byte

long

Long

short

Short

int

Integer

integer

Integer

double

Double

float

Float

boolean

Boolean

date

Date

decimal

BigDecimal

bigdecimal

BigDecimal

1.3     自定义别名

1.3.1             单个别名定义

           

1.3.2             引用别名

        

1.3.3            批量定义别名(常用)

      

 别名部分比较常用,多加练习

猜你喜欢

转载自www.cnblogs.com/upyounger/p/8963404.html