@At
@Ok("json:full")
@RequiresPermissions("sys.manager.role")
public Object selectData(@Param("roleid") String roleid, @Param("name") String name, @Param("length") int length, @Param("start") int start, @Param("draw") int draw, @Param("::order") List<DataTableOrder> order, @Param("::columns") List<DataTableColumn> columns) {
String sql = "SELECT a.* FROM sys_user a WHERE 1=1 ";
if (!Strings.isBlank(roleid)) {
sql += " and a.id NOT IN(SELECT b.userId FROM sys_user_role b WHERE b.roleId='" + roleid + "')";
}
if (!Strings.isBlank(name)) {
sql += " and (a.loginname like '%" + name + "%' or a.nickname like '%" + name + "%') ";
}
String s = sql;
if (order != null && order.size() > 0) {
for (DataTableOrder o : order) {
DataTableColumn col = columns.get(o.getColumn());
s += " order by a." + Sqls.escapeSqlFieldValue(col.getData()).toString() + " " + o.getDir();
}
}
return roleService.data(length, start, draw, Sqls.create(sql), Sqls.create(s));
}
SysRoleController中函数selectData写的sql有问题,字段名称nickname不存在,实际应该是username
望及时更正