第一种方案:默认数组角标:
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
*
from
user_user_t
where
user_name = #{userName,jdbcType=
VARCHAR
}
and
user_area=#{userArea,jdbcType=
VARCHAR
}
</
select
>