Mybatis dynamically transfers table names (also applies to dynamically transfers table fields) and mybatis Fields

Source: Internet
Author: User

Mybatis dynamically transfers table names (also applies to dynamically transfers table fields) and mybatis Fields

// Set the name of the map parameter, innerTable, and 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 ";
}

 

<! -- Configure table parameters in xml -->

Select * FROM $ {innerTable} where 1 = 1
<If test = "config_id! = Null and config_id! = ''">
And ms. config_id = # {config_id}
</If>


Mybatis-3 dynamic table parameter passing is not good to make?

MyBatis has never been used, and iBatis has been used for a while.
Report Error
Map. put ("product category ",);
Corresponding parameters cannot be found in parameter passing of product categories.

When the parameter is passed to it, it can be considered to be added with dynamic conditions, it is different in getScrollPage.

How to Use mybatis for multi-table join queries, such as class A, B, C, and D? extract data from these tables for addition, deletion, modification, and query

Mybatis is very loose to the result. With this "result" object, you can return a set like List <query result Object>.

Select a. Floor, B. Area, c. Counter FROM a LEFT JOIN ................

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.