<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之旅 廣告
                ~~~ 1.當傳遞的參數只有一個的時候,mybatis不會做特殊處理。 2.當傳遞多個參數的時候,mybatis會封裝一個Map,當前map的key 默認是param1...paramN,取的時候使用key拿到value,也可以通過索引。可以在接口方法中使用@Param注解來直接封裝map的key...如果多個參數的話推薦傳入POJO,通過#{屬性名}來取出。也可以直接在接口聲明位置傳入一個map集合。如果經常使用可以創建一個TO對象,封裝數據信息。(transfer object) public Employee getEmp(@Param("id")Integer id,String lastName); 取值:id==>#{id/param1/0} lastName==>#{param2/1} public Employee getEmp(Integer id,@Param("e")Employee emp); 取值:id==>#{param1/0} lastName===>#{param2.lastName/e.lastName/1} ##特別注意:如果是Collection(List、Set)類型或者是數組, 也會特殊處理。也是把傳入的list或者數組封裝在map中。 key:Collection(collection),如果是List還可以使用這個key(list) 數組(array) public Employee getEmpById(List<Integer> ids); 取值:取出第一個id的值: #{list[0]} ~~~ 通俗講四種方法 一: ~~~ <!-- 通過名字和性別查詢員工信息 --> <select id="selEmpByNameAndGender" resultType="cn.li.pojo.Employee"> select * from employee where name=#{0} and gender=#{1}; </select> ~~~ 二: ~~~ where name=#{param1} and gender=#{param2}; ~~~ 三: ~~~ employee where name=#{name} and gender=#{gender}; //@Param是在傳遞多個參數的時候,指定map集合中這個key的封裝規則 Employee selEmpByNameAndGender(@Param("name") String name,@Param("gender") char gender); ~~~ 四: ~~~ Employee selEmpByMap(Map<String,Object> map); employee where name=#{aa} and gender=#{bb}; EmployeeDao employeeDao=sqlSession.getMapper(EmployeeDao.class); Map<String,Object> map=new HashMap<>(); map.put("aa", "周杰倫"); map.put("bb", '1'); Employee emp=employeeDao.selEmpByMap(map); ~~~
                  <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>

                              哎呀哎呀视频在线观看