zoukankan      html  css  js  c++  java
  • Mybatis复杂嵌套关联一例

    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;

  • 相关阅读:
    2019牛客暑期多校训练营(第三场)D Big Integer
    ZOJ2432 Greatest Common Increasing Subsequence(最长公共上升子序列)
    AGC031 C
    UPC11456 视线(计算几何)
    tmp
    jQuery与Ajax
    JQuery介绍
    Week12(11月25日)
    Week11(11月21日)
    Week11(11月19日):补课
  • 原文地址:https://www.cnblogs.com/rgqancy/p/6165483.html
Copyright © 2011-2022 走看看