问题描述
调用平台提供的sqlQuery实现类时,如果sql参数是类似where ::filter ::orderBy时,前端js没有设置filter参数时,会出现以下错:
Caused by: com.justep.baas.data.sql.SQLException: SQL执行失败,SQL:SELECT u.fID , u.fName , u.fPhoneNumber , u.fAddress , COUNT(ord.fID) AS orderCount FROM takeout_user u LEFT JOIN takeout_order ord ON u.fID = ord.fUserID WHERE 1=1order by fID ASC LIMIT 0,5 at com.justep.baas.data.DataUtils.queryData(Unknown Source) at com.justep.baas.action.CRUD.sqlQuery(Unknown Source) at justep.Demo__do.queryUser(Demo__do.java:43) ... 20 more
注意,其中的WHERE 1=1order by fID ASC LIMIT 0,5
解决方案
此问题将在V3.5的正式版本中解决,在V3.5的正式版本之前,在::filter外加一对括号,例如where (::filter) ::orderBy
评一波