这个是我查询的代码片段
Map<String,String> accountMap = new HashMap<>();
StringBuilder sqlBuilder = new StringBuilder("select info.id from account_info info,account_user user where info.id = user.accountId and info.delFlag = 0 and user.disabled = 0 ");
if(Strings.isNotBlank(nickname)){
accountMap.put("nickname",nickname.trim());
sqlBuilder.append( " and info.nickname like @nickname ");
}
if(Strings.isNotBlank(mobile)){
accountMap.put("mobile",mobile.trim());
sqlBuilder.append("and user.mobile like @mobile ");
}
sqlBuilder.append(" limit "+start+ ","+length );
Sql sql = Sqls.create(sqlBuilder.toString());
for(String key : accountMap.keySet()){
sql.setParam(key,accountMap.get(key)+"%");
}
accountInfoService.dao().execute(sql);
List<String> accountIdList = sql.getList(String.class) ;
accountIdList 是查询返回的结果