SELECT * FROM SYS_USER WHERE "name" LIKE %@keyWord%
sql文件中这样写,生成的sql语句是这样的:
SELECT * FROM SYS_USER WHERE "name" LIKE %'八'%
而我需要的正确sql语句是这样的:
SELECT * FROM SYS_USER WHERE "name" LIKE '%八%'
public List<Sys_user> searchUser(String keyWord) {
nutDao.setSqlManager(new FileSqlManager("db"));
String sqls = nutDao.sqls().get("searchUser");
Sql sql = Sqls.create(sqls);
sql.params().set("keyWord",keyWord);
sql.setCallback(Sqls.callback.entities());
sql.setEntity(dao.getEntity(Sys_user.class));
dao.execute(sql);
List<Sys_user> list = sql.getList(Sys_user.class);
return list;
}