Sql sql = Sqls.create("select * from WebSite where Status != -1 and @whereParam");
sql.setParam("whereParam","id > 0");
System.out.println(sql.toString());
结果:select * from WebSite where Status != -1 and 'Id > 0'
怎么样让它不自动加引号呢?
@是参数, $是变量
Sql sql = Sqls.create("select * from WebSite where Status != -1 and $whereParam");
sql.setVal("whereParam","id > 0");
System.out.println(sql.toString());
建议用Cnd,而不是直接拼条件
Sql sql = Sqls.create("select * from WebSite @cnd and Status != -1");
sql.setParam("cnd", Cnd.where("id", ">", 0));
System.out.println(sql);
@wendal 谢谢