NutzCN Logo
问答 Sql setPage 出现重复的limit?
发布于 817天前 作者 imagebot.cn 1648 次浏览 复制 上一个帖子 下一个帖子
标签:
 String sqlstr = "select a.* from ai_patch as a,cl_region as r where a.product_id=@productId  " + dateRange + " and ST_Intersects(a.polygons,r.geom)=true and r.id=@regionId order by a.address asc,a.update_time asc";
        Sql sql = Sqls.create(sqlstr);
        sql.setEntity(aiPatchDao.getEntity());
        sql.setCallback(Sqls.callback.entities());
        sql.setParam("productId", request.getProductId());
        sql.setParam("start", request.getStart());
        sql.setParam("end", request.getEnd());
        sql.setParam("regionId",  userProductEntity.getRegionId());
        sql.setPager(pager);
        aiPatchDao.execute(sql);


org.nutz.dao.DaoException: !Nutz SQL Error: 'select a.* from ai_patch as a,cl_region as r where a.product_id='82a60ca5ec74400fb400abbc204b5c99'   and ST_Intersects(a.polygons,r.geom)=true and r.id=910 order by a.address asc,a.update_time asc LIMIT 10 OFFSET 0 LIMIT 10 OFFSET 0'
PreparedStatement: 
'select a.* from ai_patch as a,cl_region as r where a.product_id=?   and ST_Intersects(a.polygons,r.geom)=true and r.id=? order by a.address asc,a.update_time asc LIMIT 10 OFFSET 0 LIMIT 10 OFFSET 0'
CaseMessage=ERROR: syntax error at or near "LIMIT"
  位置:183
	at org.nutz.dao.impl.sql.run.NutDaoExecutor.exec(NutDaoExecutor.java:110)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:65)
	at org.nutz.dao.impl.interceptor.DaoLogInterceptor.filter(DaoLogInterceptor.java:22)
	at org.nutz.dao.DaoInterceptorChain.doChain(DaoInterceptorChain.java:63)
	at org.nutz.dao.DaoInterceptorChain.invoke(DaoInterceptorChain.java:138)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.runCallback(NutDaoRunner.java:163)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._runWithTransaction(NutDaoRunner.java:109)
	at org.nutz.dao.impl.sql.run.NutDaoRunner._run(NutDaoRunner.java:93)
	at org.nutz.dao.impl.sql.run.NutDaoRunner$1.run(NutDaoRunner.java:79)
	at org.nutz.trans.Trans.exec(Trans.java:174)
	at org.nutz.dao.impl.sql.run.NutDaoRunner.run(NutDaoRunner.java:77)
	at org.nutz.dao.impl.DaoSupport.run(DaoSupport.java:242)
	at org.nutz.dao.impl.DaoSupport._exec(DaoSupport.java:254)
	at org.nutz.dao.impl.DaoSupport.execute(DaoSupport.java:238)
	at org.nutz.dao.impl.NutDao.execute(NutDao.java:1097)
	at cn.mapway.dao.BaseDao.execute(BaseDao.java:687)
3 回复
 Pager pager = new Pager(request.getPage(), request.getPageSize());

Sql 执行了两遍 是不是第二次又添加了一次

添加回复
请先登陆
回到顶部