Issue 74 in rapid-framework: 分页代码问题

17 views
Skip to first unread message

rapid-f...@googlecode.com

unread,
May 17, 2011, 5:55:16 AM5/17/11
to rapid-f...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 74 by longlong...@gmail.com: 分页代码问题
http://code.google.com/p/rapid-framework/issues/detail?id=74

rapid版本:3.9.3

使用的相关插件组合是:springmvc+mybatis

按如下步骤重现错误:
1.复合查询中有列表参数(一组,多个checkbox)
2.在分页查询的时候执行的两条sql语句,第一条正常执行,示例:
SELECT
count(*)
FROM
order_form as order_form
WHERE
(
order_form.state = '已提交'
OR order_form.state = '已付款'
OR order_form.state = '已申请作废'
)
3.第二条无法取出list中的值,示例:
SELECT
*(为方便查看,隐去了字段)
FROM
order_form as order_form
WHERE
(
order_form.state = NULL
OR order_form.state = NULL
OR order_form.state = NULL
)

期待的结果是:同一个请求,中间未执行任何其他操作,应该能够查询出结果,可能在
分页处理中缓缓filters的地方把list的参数转换出了问题



rapid-f...@googlecode.com

unread,
May 17, 2011, 5:59:20 AM5/17/11
to rapid-f...@googlegroups.com

Comment #1 on issue 74 by longlong...@gmail.com: 分页代码问题
http://code.google.com/p/rapid-framework/issues/detail?id=74

mapper的配置
<sql id="OrderForm.findPage.where">
<where>
<!-- 其他干扰的业务部分去除 -->
<foreach collection="stateList" item="stateItem" open="AND ( "
separator="OR" close=" )">
order_form.state = #{stateItem}
</foreach>
</where>
</sql>

rapid-f...@googlecode.com

unread,
May 17, 2011, 7:33:56 AM5/17/11
to rapid-f...@googlegroups.com

Comment #2 on issue 74 by longlong...@gmail.com: 分页代码问题
http://code.google.com/p/rapid-framework/issues/detail?id=74

List list = sqlSession.selectList(statementName, filters, new
RowBounds(page.getFirstResult(),page.getPageSize()));
List list = sqlSession.selectList(statementName, filters);

前面的代码相同,在分页的时候如果使用上面第一个方法,则出现所描述问题,如果使
用第二个方法不分页,则没有问题

rapid-f...@googlecode.com

unread,
May 17, 2011, 9:07:44 AM5/17/11
to rapid-f...@googlegroups.com

Comment #3 on issue 74 by longlong...@gmail.com: 分页代码问题
http://code.google.com/p/rapid-framework/issues/detail?id=74

补充,期望结果:
在findPage的时候发出如下两条sql语句
SELECT
count(*)
FROM
order_form as order_form
WHERE
(
order_form.state = '已提交'
OR order_form.state = '已付款'
OR order_form.state = '已申请作废'
)

SELECT
*(为方便查看,隐去了字段)
FROM
order_form as order_form
WHERE
(

rapid-f...@googlecode.com

unread,
Aug 12, 2011, 5:48:22 AM8/12/11
to rapid-f...@googlegroups.com

Comment #4 on issue 74 by HanQZh...@gmail.com: 分页代码问题
http://code.google.com/p/rapid-framework/issues/detail?id=74

现在也遇到这个问题,问题解决没得?

rapid-f...@googlecode.com

unread,
Aug 13, 2011, 10:34:04 AM8/13/11
to rapid-f...@googlegroups.com

Comment #5 on issue 74 by HanQZh...@gmail.com: 分页代码问题
http://code.google.com/p/rapid-framework/issues/detail?id=74

现在用个变通的方法可以解决这个问题:
把#{item} 改为${item},不预编译这个参数,直接设置进去。

sql语句以前是:columnName=?;
现在变成了columnName=传的值。

Reply all
Reply to author
Forward
0 new messages