一、 當查詢的引數只有乙個時
findbyids(list ids)
a.如果引數的型別是list, 則在使用時,collection屬性要必須指定為 list
"getpostorderlistbyparam"
resulttype="com.qlyd.common.po.post.postinfo"
parametertype="com.qlyd.common.inparam.manage.postmanage.postmanagequeryparam">
select inner_id,circle_id, user_id, user_type,
word_content, img_content, status, publish_time, comment_sum,
view_sum, order_num, perfect_num from circle_posts_info
where
circle_id=# and order_num !=1000
or inner_id in
item="item" index="index" collection="postids"
open="(" separator=","
close=")">
#if>
order by order_num,publish_time desc
if>
perfect_num !=1000
or inner_id in
item="item" index="index" collection="postids"
open="(" separator=","
close=")">
#if>
order by perfect_num,publish_time desc
if>
findbyids(long ids)
b.如果引數的型別是array,則在使用時,collection屬性要必須指定為 array
select
"base_column_list" />
from jria where id in
open="(" separator="," close=")">
#foreach>
select>
二、當查詢的引數有多個時,例如 findbyids(string name, long ids)
這種情況需要特別注意,在傳引數時,一定要改用map方式, 這樣在collection屬性可以指定名稱
下面是乙個示例
mapparams = new hashmap(2);
params.put("name", name);
params.put("ids", ids);
select
"base_column_list" />
from jria where id in
open="(" separator="," close=")">
#foreach>
select>
mybatis中使用in查詢時的注意事項
1.當查詢的引數只有乙個時 findbyids listids 1.a 如果引數的型別是list,則在使用時,collection屬性要必須指定為 list findbyidsmap resultmap baseresultmap select base column list from jria ...
mybatis中使用in查詢時的注意事項
1.當查詢的引數只有乙個時 findbyids listids 1.a 如果引數的型別是list,則在使用時,collection屬性要必須指定為 list id findbyidsmap resultmap baseresultmap select refid base column list f...
mybatis中使用in查詢時的注意事項
1.當查詢的引數只有乙個時 findbyids listids 1.a 如果引數的型別是list,則在使用時,collection屬性要必須指定為 list findbyidsmap resultmap baseresultmap select base column list from jria ...