SqlExpressionGroup se = Cnd.exps("1", "=", 1);
if (taskId != null) {
se.and("taskId", "=", taskId);
}
se.and("status", "=", 1);
SqlExpressionGroup se2 = Cnd.exps("published", "is", false).or("published", "is", null);
// 获取未发布成功的数据,进行导入
Pager pager = dao.createPager(1, 5);
List<Record> records = dao.query(tableName Cnd.where(se).and(se2), pager);
报如下错误
SELECT * FROM task_publish_record WHERE (1=1 AND taskId=1 AND status=1) AND (published IS false OR published IS NULL ) LIMIT 0, 5
2019-08-06 17:19:34,485 [DEBUG] ao.impl.sql.run.NutDaoExecutor - SQLException
java.sql.SQLSyntaxErrorException: (conn=20342) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '0 OR published IS NULL ) LIMIT 0, 5' at line 1
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:242)
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:171)
SqlExpressionGroup se2 = Cnd.exps("published", "is", false).or("published", "is", null);
代码改成
SqlExpressionGroup se2 = Cnd.exps("published", "=", 0).or("published", "is", null);
就不报错了,上面的日志打印出的sql语句在mysql客户端程序执行都没问题,什么问题导致的?