Wizzercn / NutzWk

WK系列开发框架-V1至V5 Java开源企业级开发框架(单应用/微服务/分布式)
https://budwk.com
Apache License 2.0
1.62k stars 637 forks source link

角色绑定用户中的查询用户功能有个bug #101

Closed cranehe closed 6 years ago

cranehe commented 6 years ago

SysRoleController中函数selectData写的sql有问题,字段名称nickname不存在,实际应该是username

    @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));
    }

望及时更正

Wizzercn commented 6 years ago

这个我记得改过了啊,3.x还是4.x的?

cranehe commented 6 years ago

4.1.7的版本

Wizzercn commented 6 years ago

4.1.8已发布。