<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## 代碼 ~~~ package com.like.dao; import com.like.domain.Role; import java.util.List; public interface IRoleDao { List<Role> findAll(); } ~~~ ~~~ package com.like.dao; import com.like.domain.User; import java.util.List; public interface IUserDao { List<User> findAll(); } ~~~ ~~~ package com.like.domain; import java.io.Serializable; import java.util.List; public class Role implements Serializable { private Integer id; private String roleName; private String roleDesc; // 多對多關系映射 private List<User> users; @Override public String toString() { return "Role{" + "id=" + id + ", roleName='" + roleName + '\'' + ", roleDesc='" + roleDesc + '\'' + ", users=" + users + '}'; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getRoleName() { return roleName; } public void setRoleName(String roleName) { this.roleName = roleName; } public String getRoleDesc() { return roleDesc; } public void setRoleDesc(String roleDesc) { this.roleDesc = roleDesc; } public List<User> getUsers() { return users; } public void setUsers(List<User> users) { this.users = users; } } ~~~ ~~~ 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<Role> roles; @Override public String toString() { return "User{" + "id=" + id + ", username='" + username + '\'' + ", birthday=" + birthday + ", sex='" + sex + '\'' + ", address='" + address + '\'' + ", roles=" + roles + '}'; } 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<Role> getRoles() { return roles; } public void setRoles(List<Role> roles) { this.roles = roles; } } ~~~ ~~~ <mapper namespace="com.like.dao.IRoleDao"> <resultMap id="roleMap" type="com.like.domain.Role"> <id property="id" column="id"/> <result property="roleName" column="role_name"/> <result property="roleDesc" column="role_desc"/> <collection property="users" ofType="com.like.domain.User"> <id property="id" column="uid"/> <result property="username" column="username"/> <result property="sex" column="sex"/> <result property="address" column="address"/> <result property="birthday" column="birthday"/> </collection> </resultMap> <select id="findAll" resultMap="roleMap"> select * from role inner join user_role on role.id = user_role.rid inner join user on user_role.uid = user.id </select> </mapper> ~~~ ~~~ <mapper namespace="com.like.dao.IUserDao"> <resultMap id="userMap" type="com.like.domain.User"> <id property="id" column="id"/> <result property="username" column="username"/> <result property="sex" column="sex"/> <result property="address" column="address"/> <result property="birthday" column="birthday"/> <collection property="roles" ofType="com.like.domain.Role"> <id property="id" column="rid"/> <result property="roleName" column="role_name"/> <result property="roleDesc" column="role_desc"/> </collection> </resultMap> <select id="findAll" resultMap="userMap"> select * from user inner join user_role on user.id = user_role.uid inner join role on user_role.rid = role.id </select> </mapper> ~~~ ~~~ IRoleDao mapper = session.getMapper(IRoleDao.class); List<Role> roles = mapper.findAll(); for (Role role : roles) { System.out.println(role); } IUserDao mapper1 = session.getMapper(IUserDao.class); List<User> users = mapper1.findAll(); for (User user : users) { System.out.println(user); } ~~~
                  <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>

                              哎呀哎呀视频在线观看