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