hope-onely / rapid-framework

Automatically exported from code.google.com/p/rapid-framework
0 stars 0 forks source link

分页代码问题 #74

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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的�
��数转换出了问题

Original issue reported on code.google.com by longlong...@gmail.com on 17 May 2011 at 9:54

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

Original comment by longlong...@gmail.com on 17 May 2011 at 9:57

GoogleCodeExporter commented 8 years ago
List list = sqlSession.selectList(statementName, filters, new 
RowBounds(page.getFirstResult(),page.getPageSize()));
List list = sqlSession.selectList(statementName, filters);

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

Original comment by longlong...@gmail.com on 17 May 2011 at 11:32

GoogleCodeExporter commented 8 years ago
补充,期望结果:
在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
        (
            order_form.state = '已提交' 
            OR order_form.state = '已付款' 
            OR order_form.state = '已申请作废' 
        )

Original comment by longlong...@gmail.com on 17 May 2011 at 1:06

GoogleCodeExporter commented 8 years ago
现在也遇到这个问题,问题解决没得?

Original comment by HanQZh...@gmail.com on 12 Aug 2011 at 9:47

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

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

Original comment by HanQZh...@gmail.com on 13 Aug 2011 at 2:33