我是靠谱客的博主 清秀山水,这篇文章主要介绍Mybatis的resultType对应的Java类型,现在分享给大家,希望可以做个参考。

Mybatis中设置了默认的别名和映射类型:

Mybatis的resultTypeJava类型
_bytebyte
_longlong
_shortshort
_intint
_integerint
_doubledouble
_floatfloat
_booleanboolean
stringString
byteByte
longLong
shortShort
intInteger
integerInteger
doubleDouble
floatFloat
booleanBoolean
dateDate
decimalBigDecimal
bigDecimalBigDecimal
objectObject
mapMap
hashmapHashMap
listList
arraylistArrayList
collectionCollection
iteratorIterator

基本数据类型都要在前面加一个下划线。

<!--该语句返回的数据类型对应Java中的int类型-->
<select id="getCount" resultType="_int">
    select count(*) from tbl_user
</select>

<!--该语句返回的数据类型对应Java中的Integer类型-->
<select id="getCount" resultType="integer">
    select count(*) from tbl_user
</select>

image-20220506220624835

Mybatis中最常用的类型别名:

java.lang.Integer --> int,integer

int --> _int,_integer

Map --> map

String --> string

最后

以上就是清秀山水最近收集整理的关于Mybatis的resultType对应的Java类型的全部内容,更多相关Mybatis内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(111)

评论列表共有 0 条评论

立即
投稿
返回
顶部