mybatis中parameterType可以写的别名

mybatis中parameterType可以写的别名

 https://blog.csdn.net/sdzhangshulong/article/details/51749807

_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类型

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



  1. resultType:适合使用返回值的数据类型是非自定义的,即jdk的提供的类型 -->
  2. <select id="selectPersonCount" resultType="java.lang.Integer">
  3. select count(*) from
  4. person
  5. </select>
    1. <select id="selectPersonByIdWithMap" parameterType="java.lang.Integer"
    2. resultType="java.util.Map">
    3. select * from person p where p.person_id= #{id}

猜你喜欢

转载自www.cnblogs.com/libin6505/p/9810324.html