Cnd where=Cnd.New(); where.and(new Static(" order by id" );
Cnd.orderBy()
我想要添加一个ordeby的 字符串
想生成怎样的sql?
select * from ABC order by ID asc,NAME desc ,其中 order by ID asc,NAME desc 是一个字符串
。。。 为毛(* ̄m ̄)要这样。。。
用1=1吧
不会是前端页面拼好传过来的吧?
if (!Strings.isBlank(req.orderSql)) { if (req.filters.size() == 0) { where.and("1", "=", "1"); where.and(new Static(" order by " + req.orderSql)); } else { where.and(new Static(" order by " + req.orderSql)); } } else { }
错误 'SELECT * FROM ADMIN_USER WHERE 1=? AND order by EXTRA_ID asc LIMIT 5, 5 '
Cnd where=Cnd.where.(new Static("1=1 order by id") );
但你从请求直接取值拼入sql,不怕注入?
试一试