# Mybatis配置文件中Select元素标签输入参数有多少种输入方式呢?
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-T5Pqmowl-1602572083832)(https://imgkr.cn-bj.ufileos.com/768074eb-5e03-4ad1-81ee-5432b6614e4a.jpg)]
## Select元素标签输入方式
- 基本数据类型
- 字符串类型
- Map 类型
- Java bean 类型
## 案例实操
### 输入参数分类
基本类型,字符串,java bean,map,数组(删除操作时体现),List(添加时体现)等每种情况定义如下
#### 基本数据类型
**Statement 定义**
~~~ xml
SELECT id,user_name 'userName',user_balance 'userBalance' FROM yg_customer WHERE id=#{id}
~~~
**CustomerDao方法定义**
~~~ java
Customer queryCustomerById(int id);
~~~
#### 字符串类型
**Statement 定义**
~~~ xml
SELECT id,user_name 'userName',user_balance 'userBalance' FROM yg_customer WHERE user_name=#{userName}
~~~
**Dao 方法定义**
~~~ java
Customer queryCustomerById(int id);
~~~
#### Map 类型
**Statement 定义**
~~~ xml
SELECT id,user_name 'userName',user_balance 'userBalance' FROM yg_customer WHERE user_name=#{userName}
~~~
**Dao 方法定义**
~~~ java
Customer queryCustomerByName(Map
~~~
#### Java bean 类型
**Statement 定义**
~~~ xml
SELECT id,user_name 'userName',user_balance 'userBalance' FROM yg_customer WHERE user_name=#{userName}
~~~
**Dao方法定义**
~~~ java
Customer queryCustomerByParams(Customer customer);
~~~
####
## 扩展
### 结果类型分类
基本数据类型,字符串,JavaBean,Map,List等
#### 基本数据类型
**Statement定义**
~~~ xml
select count(1) from yg_customer
~~~
**Dao 方法定义与对应实现**
~~~ java
int queryCustomerAccount();
~~~
#### 字符串类型
**Statement定义**
~~~ xml
select user_name from yg_customer WHERE id=#{id}
~~~
**Dao 方法定义**
~~~ java
String queryCustomerNameById(int id);
~~~
#### Java Bean
**Statement定义**
~~~ xml
select id,user_name as userName,user_pwd as userPwd from user where id=#{id}
~~~
#### List
**Statement 定义**
~~~ xml
id,user_name,user_pwd
select
from user where user_name like concat("%",#{userName},"%")
~~~
#### Map 类型数据
**Statement 定义**
~~~ xml
select id,user_name as userName,user_pwd as userPwd from user where id=#{id}
~~~
->
select id,user_name as userName,user_pwd as userPwd from user where id=#{id}
~~~
###
需要视频配套文档或更多资料+我们程序员小姐姐v:lezijie007(加好友时备注:b站-LT,不备注拒绝添加哟)