Db.paginate分页出错

String sql=" FROM shop_food_order o,shop_restaurant r ,security_user u where o.sEmpCode=r.id and u.user_info_id=o.memberId  and sn like '%'".concat("?").concat("%'");

            //sb.append(" and sn like '%").append(sn).append("%'");

    list = Db.paginate(pageNumber, PAGE_SIZE,"SELECT o.*,r.name as rname,u.realname ",sql,sn);

带条件查询出不来

list = Db.paginate(pageNumber, PAGE_SIZE,"SELECT o.*,r.name as rname,u.realname "," FROM shop_food_order o,shop_restaurant r ,security_user u where o.sEmpCode=r.id and u.user_info_id=o.memberId ");

没有条件的没报错,求指点

评论区

莫知莫言

2019-01-10 18:07

sn like '%"多了一个单引号,

JFinal

2019-01-10 18:16

这篇文档中有关于 like 的使用:
https://www.jfinal.com/doc/5-13

莫知莫言

2019-01-11 09:35

@JFinal ,示例中的all.sql文件是放在webapp根目录下吗

莫知莫言

2019-01-11 09:39

莫知莫言

2019-01-11 10:08

@JFinal #sql("findorder")
SELECT o.*,r.name as rname,u.realname FROM shop_food_order o,shop_restaurant r ,security_user u where o.sEmpCode=r.id and u.user_info_id=o.memberId and o.sn like concat('%', #para(0), '%')
#end
SqlPara sqlPara = Db.getSqlPara("findorder", sn);
list =Db.paginate(pageNumber, PAGE_SIZE, sqlPara);
System.out.print(list);
结果
pageNumber : 1
pageSize : 20
totalPage : 1
totalRow : 3 为什么结果还是出不来呢

莫知莫言

2019-01-11 10:12

@JFinal 应该说是页面上还是显示所有的记录而不是查询出来的3条

莫知莫言

2019-01-11 10:15

@JFinal 已解决是别的错误,不好意思

热门反馈

扫码入社