mybatis配置一對多關係

<resultMap type="com.p5w.core.model.interaction.Question" id="QA_Map">
    
    <id column="pid" property="pid"/>
    <result column="content" property="content"/>
    <result column="questionerTimeStr" property="questionerTimeStr"/>
<association property="questionUser" column="questionUserId" javaType="com.p5w.core.model.user.UserBaseInfo">
<id column="questionUserId" property="pid"/>
<result column="mobile" property="mobile"/>
<result column="nickname" property="nickname"/>
<result column="userPictureUrl" property="userPictureUrl"/>
</association>
<association property="companyBaseInfo" column="companyBaseinfoId" javaType="com.p5w.core.model.company.CompanyBaseInfo">
<id column="companyBaseinfoId" property="pid"/>
<result column="company_code" property="companyCode"/>
<result column="company_shortname" property="companyShortname"/>
<result column="company_fullname" property="companyFullname"/>
<result column="companyLogoUrl" property="companyLogoUrl"/>
</association>
<collection property="replyList" 
ofType="com.p5w.core.model.interaction.Reply" 
column="pid" 
select="com.p5w.core.model.interaction.Reply.getReplyByQId">
</collection>
   
    </resultMap>

 

歡迎訪問個人主頁: https://tangyuewei.com/

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章