select*fromuser_user_twhereuser_name = #{0}..._service怎么穿到dao">
赞
踩
第一种方案:默认数组角标:
service
Public
User
selectUser(String
name
,String area);
mapper:
<
select
id=
"selectUser"
resultMap=
"BaseResultMap"
>
select
*
from
user_user_t
where
user_name = #{0}
and
user_area=#{1}
</
select
>
第二种方案:map集合传参:
service:
Map paramMap=new hashMap();
paramMap.put(“userName”,”对应具体的参数值”);
paramMap.put(“userArea”,”对应具体的参数值”);
Public
User
selectUser(Map paramMap);
mapper:
<
select
id=
" selectUser"
resultMap=
"BaseResultMap"
>
select
*
from
user_user_t
where
user_name = #{userName,jdbcType=
VARCHAR
}
and
user_area=#{userArea,jdbcType=
VARCHAR
}
</
select
>
第三种方案:参数修正
service
Public
User
selectUser(@param(“userName”)Stringname,@param(“userArea”)String area);
mapper:
<
select
id=
" selectUser"
resultMap=
"BaseResultMap"
>
select
*
fro
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。