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

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                使用ResultMap建立映射 **1.表結構** ![](https://img.kancloud.cn/dd/11/dd11ad4663ff60358e78775d37a1b92b_754x235.png) **2.實體類** ~~~ package com.nobb.domain; public class User { private Integer id; private String name; private String password; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Override public String toString() { return "User{" + "id=" + id + ", name='" + name + '\'' + ", password='" + password + '\'' + '}'; } } ~~~ **3.在UserMapper.xml中配置 ResultMap** ~~~ <!--id:取名 type:對應的實體可以使用別名--> <resultMap id="userMapper" type="User"> <!--映射id屬性,映射主鍵--> <!--property:實體類的屬性--> <!--column:表的字段--> <id property="id" column="u_id"></id> <!-- 映射非id屬性-result --> <result property="name" column="u_name"></result> <result property="password" column="u_password"></result> </resultMap> ~~~ **4.UserMapper.java 新增查詢方法** ~~~ //新增實體屬性與列名不對應的查詢方法 List<User> findAll1(); ~~~ **5.UserMapper.xml 查詢語句** ~~~ <!--實體屬性與列名不對應的處理辦法,用resultMap建立映射--> <select id="findAll1" resultMap="userMapper"> select * from t_user </select> ~~~ **6.查詢測試** ~~~ //列名不對應的查詢方法 @Test public void testFindAll1(){ UserMapper mapper = session.getMapper(UserMapper.class); List<User> users = mapper.findAll1(); System.out.println(users); } ~~~
                  <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>

                              哎呀哎呀视频在线观看