Mybatis動態傳表名(同樣適用於動態傳表欄位),mybatis欄位

來源:互聯網
上載者:User

Mybatis動態傳表名(同樣適用於動態傳表欄位),mybatis欄位

//設定map參數,innerTable,outTable對應的表名

public String sendDetail(){
  pager = getStartPager();
  if( null !=msg && msg.equals("succ")){
   map.put("innerTable","bs_sent_inner" ); 
   map.put("outTable","bs_sent_out" );
   pager = outBoxInnerService.findSendPager(pager, map);
  }
  if(null !=msg && msg.equals("falilure")){
   map.put("innerTable","bs_fail_inner" );
   map.put("outTable","bs_fail_out" );
   pager = outBoxInnerService.findSendPager(pager, map);
  }
  map.remove("innerTable");
  map.remove("outTable");
  
  return "sendDetail";
 }

 

<!-- xml 配置 table參數-->

select  * FROM ${innerTable} where 1 = 1
      <if test="config_id != null and config_id !='' ">
       and ms.config_id = #{config_id}
      </if>


mybatis-3 動態表傳參不好使了?

MyBatis的從未使用過,iBatis的使用了一段時間。
報告錯誤
map.put(“產品類別”,);
產品類別的參數傳遞中無法找到相應的參數。

參數傳遞到它可以被認為是加入了動態條件下,在getScrollPage不同。
 
怎使用mybatis 進行多表聯查 例如知道class A,B,C ,D,從這幾張表中抽出資料用於增刪改查

mybatis 對結果是很寬鬆的,有這個“結果”的對象,就可以返回 List<查詢結果對象> 這樣的集合

select a.樓層, b.地區, c.專櫃 FROM a LEFT JOIN ................
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.