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}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM