您的位置:首页 > 其它

mybatis中parameterType可以写的别名

2016-06-24 09:17 465 查看
_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

左侧为mybatis自带的别名,右侧为映射类型

比如parameterType="string"其实映射对应的为String类型

<!-- 定义 别名 -->
<typeAliases>
<!--
单个别名的定义
alias:别名,type:别名映射的类型  -->
<typeAlias type="cn.itcast.mybatis.po.User" alias="user"/>
<!-- 批量别名定义
指定包路径,自动扫描包下边的pojo,定义别名,别名默认为类名(首字母小写或大写)
-->
<package name="cn.itcast.mybatis.po"/>

</typeAliases>


resultType:适合使用返回值的数据类型是非自定义的,即jdk的提供的类型 -->
<select id="selectPersonCount" resultType="java.lang.Integer">
select count(*) from
person
</select>
<select id="selectPersonByIdWithMap" parameterType="java.lang.Integer"
resultType="java.util.Map">
select * from person p where p.person_id= #{id}
</select>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: