How many input methods are there for the Select element tag input parameters in the Mybatis configuration file?

For those who need more related information, please see the profile on the homepage!

Select element label input method
Basic data type

String type

Map type

Java bean type

Case actual operation
Input parameter classification
Basic type, string, java bean, map, array (reflected when deleting operation), List (reflecting when adding), etc. Each case is defined as follows

Basic data type
Statement definition

SELECT id,user_name 'userName',user_balance 'userBalance' FROM yg_customer WHERE id=#{id}

CustomerDao method definition

Customer queryCustomerById(int id);

String type
Statement definition

SELECT id,user_name 'userName',user_balance 'userBalance' FROM yg_customer WHERE user_name=#{userName}

Dao method definition

Customer queryCustomerById(int id);

Map type
Statement definition

SELECT id,user_name 'userName',user_balance 'userBalance' FROM yg_customer WHERE user_name=#{userName}

Dao method definition

Customer queryCustomerByName(Map<String,Object> userName);

Java bean type
Statement definition

SELECT id,user_name 'userName',user_balance 'userBalance' FROM yg_customer WHERE user_name=#{userName}

Dao method definition

Customer queryCustomerByParams(Customer customer);

Extended
result type classification
Basic data type, string, JavaBean, Map, List, etc.

Basic data type
Statement definition

select count(1) from yg_customer

Dao method definition and corresponding implementation

int queryCustomerAccount();


Statement definition of string type

select user_name from yg_customer WHERE id=#{id}

Dao method definition

String queryCustomerNameById(int id);

Java Bean
Statement definition

select id,user_name as userName,user_pwd as userPwd from user where id=#{id}

List
Statement definition

id,user_name,user_pwd select from user where user_name like concat("%",#{userName},"%")

Map type data
Statement definition

select id,user_name as userName,user_pwd as userPwd from user where id=#{id}

Guess you like

Origin blog.csdn.net/xyx12321/article/details/111475010