ibatis中,参数部分是用##表示的,这种格式的是字符串,会自动在内容两端加上单引号,$$表示的是原样输出,你这里有两个参数,且要求的是数值,所以要用$$,那么在ibatis的xml配置文件中,写法就是:
select *
from table
limit $count1$, $count2$.
而在java中,通过调用ibatis框架中的方法,将count1和count2变量的值传递进去就可以了。
public List
SqlSession session = null;
try {
session = getSession();
Map
m.put("count", pageSize);
m.put("begin", begin);
m.put("typeName", typeName);
List
log.debug("getAllSettingsPage() " + (list == null ? " empty " : "size:" + list.size()));
return list;
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if (session != null) {
session.close();
}
}
}
请参考