mybatis association和collection标签怎么用

Posted THISISPAN

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mybatis association和collection标签怎么用相关的知识,希望对你有一定的参考价值。

  1. <resultMap type="Bill" id="ResultBill">  
  2.            <id property="id" column="id"/>  
  3.            <result property="dh" column="dh"  />          
  4.            <result property="rq" column="rq"/>  
  5.            <association property="author"  javaType="Author"  >  
  6.               <id  property="id"  column="idAutor" />  
  7.               <result property="name" column="authorName" />  
  8.               <result property="email" column="authorEmail"/>  
  9.            </association>          
  10.            <collection property="det1"  javaType="ArrayList" ofType="BillDet1" >  
  11.               <id property="id" column="idDet1"/>  
  12.               <result property="dh" column="dhDet1"/>  
  13.               <result property="wlbm" column="wlbm"/>  
  14.               <result property="wlmc" column="wlmc"/>  
  15.               <result property="unit" column="unit"/>  
  16.               <result property="qty" column="qty"/>  
  17.            </collection>  
  1. </resultMap>  
  1. <resultMap type="com.sailod.shiro.dto.HtAuthorityMenuDTO" id="OneMenuAuthority">  
  2.         <id property="htAuthorityId" column="htAuthorityId" javaType="java.lang.Long" />  
  3.         <result property="name" column="name" javaType="java.lang.String" />  
  4.         <result property="currentUserId" column="currentUserId" javaType="java.lang.Long" />  
  5.         <collection property="htAuthorityDTO"  ofType="com.sailod.shiro.dto.HtAuthorityDTO"  
  6.          select="selectAuthority" column="{htAuthorityId2 = htAuthorityId ,currentUserId2 = currentUserId}"   >  
  7.          </collection>  
  8.     </resultMap>  

以上是关于mybatis association和collection标签怎么用的主要内容,如果未能解决你的问题,请参考以下文章

Mybatis中collection和association的使用区别

mybatis 一对一与一对多collection和association的使用

mybatis中association和collection的column传入多个参数值

Mybatis的一对多(collection)和一对一(association)查询

MyBatis,collection标签和association标签的区别啥?

mybatis association和collection标签怎么用