<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ## 添加配置開啟懶加載 ~~~ <settings> <setting name="lazyLoadingEnabled" value="true"/> <setting name="aggressiveLazyLoading" value="false"/> </settings> ~~~ ## 所需類 ~~~ package com.like.dao; import com.like.domain.Account; import java.util.List; public interface IAccountDao { List<Account> findAll(); List<Account> findByUserId(Integer id); } ~~~ ~~~ package com.like.dao; import com.like.domain.User; import java.util.List; public interface IUserDao { List<User> findAll(); User findById(Integer id); } ~~~ ~~~ package com.like.domain; public class Account { private Integer id; private Integer uid; private Double money; private User user; @Override public String toString() { return "Account{" + "id=" + id + ", uid=" + uid + ", money=" + money + ", user=" + user + '}'; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getUid() { return uid; } public void setUid(Integer uid) { this.uid = uid; } public Double getMoney() { return money; } public void setMoney(Double money) { this.money = money; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } } ~~~ ~~~ package com.like.domain; import java.io.Serializable; import java.util.Date; import java.util.List; public class User implements Serializable { private Integer id; private String username; private Date birthday; private String sex; private String address; private List<Account> accounts; @Override public String toString() { return "User{" + "id=" + id + ", username='" + username + '\'' + ", birthday=" + birthday + ", sex='" + sex + '\'' + ", address='" + address + '\'' + ", accounts=" + accounts + '}'; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public List<Account> getAccounts() { return accounts; } public void setAccounts(List<Account> accounts) { this.accounts = accounts; } } ~~~ ## 一對一延遲加載 ~~~ <mapper namespace="com.like.dao.IUserDao"> <select id="findById" parameterType="int" resultType="com.like.domain.User"> select * from user where id = #{id} </select> </mapper> ~~~ ~~~ <mapper namespace="com.like.dao.IAccountDao"> <resultMap id="accountUserMap" type="com.like.domain.Account"> <id property="id" column="id"/> <result property="uid" column="uid"/> <result property="money" column="money"/> <association property="user" column="uid" //必須寫,指定根據id查詢用戶時所需要的參數 javaType="com.like.domain.User" select="com.like.dao.IUserDao.findById"> //這里需要用到IUserDao根據ID查找的方法 </association> </resultMap> <select id="findAll" resultMap="accountUserMap"> select * from account; </select> </mapper> ~~~ ## 一對多延遲加載 ~~~ <select id="findByUserId" parameterType="int" resultType="com.like.domain.Account"> select * from account where uid = #{uid} </select> ~~~ ~~~ <resultMap id="userAccountMap" type="com.like.domain.User"> <id property="id" column="id"/> <result property="username" column="username"/> <result property="birthday" column="birthday"/> <result property="sex" column="sex"/> <result property="address" column="address"/> <collection property="accounts" column="id" //這里是id ofType="com.like.domain.Account" select="com.like.dao.IAccountDao.findByUserId"> //這里是根據用戶的id查找賬戶的方法 <id property="id" column="aid"/> <result property="uid" column="uid"/> <result property="money" column="money"/> </collection> </resultMap> <select id="findAll" resultMap="userAccountMap"> select * from user </select> ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看