码迷,mamicode.com
首页 > 其他好文 > 详细

Mybatis复杂嵌套关联一例

时间:2016-12-12 19:45:32      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:style   class   .lib   nbsp   collect   string   sys   and   state   

Mybatis  three entity relation:association in collection

PatentMapper.xml

   <resultMap id="BaseResultMap" type="com.yuanchuangyun.libra.entity.Patent" >
     <collection property="lawStates" resultMap="com.yuanchuangyun.libra.mapper.LawStateMapper.BaseResultMap"/>
  </resultMap>
  <select id="getById" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select   <include refid="Base_Column_List" />,
             <include refid="com.yuanchuangyun.libra.mapper.LawStateMapper.Base_Column_List"/>,
             <include refid="com.yuanchuangyun.framework.mapper.system.UserMapper.Base_Column_List"/>
    from BIZ_OBJECT_PATENT PET
    left join BIZ_LAWSTATE LS on LS.OBJECT_ID = PET.ID AND LS.WHICH_OBJECT = ‘2‘
    left join PF_USER SU on SU.ID = LS.CREATE_USER_ID
  </select>

LawStateMapper.xml

  <resultMap id="BaseResultMap" type="com.yuanchuangyun.libra.entity.LawState" >
    <association property="createUser" resultMap="com.yuanchuangyun.framework.mapper.system.UserMapper.BaseResultMap"/>
  </resultMap>

Patent.java

    private List<LawState> lawStates;

 

LawState.java

    private User createUser;

Mybatis复杂嵌套关联一例

标签:style   class   .lib   nbsp   collect   string   sys   and   state   

原文地址:http://www.cnblogs.com/rgqancy/p/6165483.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!