zhou zhou
1 天以前 1dcfa3702505f0c431757312b5304531029f90f6
rsf-server/src/main/java/com/vincent/rsf/server/system/controller/RoleController.java
@@ -21,6 +21,7 @@
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import com.vincent.rsf.server.manager.utils.buildPageRowsUtils;
import jakarta.servlet.http.HttpServletResponse;
import java.util.*;
@@ -73,25 +74,25 @@
    public R page(@RequestBody Map<String, Object> map) {
        BaseParam baseParam = buildParam(map, BaseParam.class);
        PageParam<Role, BaseParam> pageParam = new PageParam<>(baseParam, Role.class);
        return R.ok().add(roleService.page(pageParam, pageParam.buildWrapper(true)));
        return R.ok().add(buildPageRowsUtils.rowsMap(roleService.page(pageParam, pageParam.buildWrapper(true))));
    }
    @PreAuthorize("hasAuthority('system:role:list')")
    @PostMapping("/role/list")
    public R list(@RequestBody Map<String, Object> map) {
        return R.ok().add(roleService.list());
        return R.ok().add(buildPageRowsUtils.rowsMap(roleService.list()));
    }
    @PreAuthorize("hasAuthority('system:role:list')")
    @PostMapping({"/role/many/{ids}", "/roles/many/{ids}"})
    public R many(@PathVariable Long[] ids) {
        return R.ok().add(roleService.listByIds(Arrays.asList(ids)));
        return R.ok().add(buildPageRowsUtils.rowsMap(roleService.listByIds(Arrays.asList(ids))));
    }
    @PreAuthorize("hasAuthority('system:role:list')")
    @GetMapping("/role/{id}")
    public R get(@PathVariable("id") Long id) {
        return R.ok().add(roleService.getById(id));
        return R.ok().add(buildPageRowsUtils.rowsMap(roleService.getById(id)));
    }
    @PreAuthorize("hasAuthority('system:role:save')")
@@ -111,7 +112,7 @@
        if (!roleService.save(role)) {
            return R.error("Save Fail");
        }
        return R.ok("Save Success").add(role);
        return R.ok("Save Success").add(buildPageRowsUtils.rowsMap(role));
    }
    @PreAuthorize("hasAuthority('system:role:update')")
@@ -132,7 +133,7 @@
        if (!roleService.updateById(role)) {
            return R.error("Update Fail");
        }
        return R.ok("Update Success").add(role);
        return R.ok("Update Success").add(buildPageRowsUtils.rowsMap(role));
    }
    @PreAuthorize("hasAuthority('system:role:remove')")
@@ -148,7 +149,7 @@
                throw new CoolException("Internal Server Error!");
            }
        }
        return R.ok("Delete Success").add(ids);
        return R.ok("Delete Success").add(buildPageRowsUtils.rowsMap(ids));
    }
    @PreAuthorize("hasAuthority('system:role:list')")
@@ -162,7 +163,7 @@
        roleService.page(new Page<>(1, 30), wrapper).getRecords().forEach(
                item -> vos.add(new KeyValVo(item.getId(), item.getName()))
        );
        return R.ok().add(vos);
        return R.ok().add(buildPageRowsUtils.rowsMap(vos));
    }
    @PreAuthorize("hasAuthority('system:role:list')")
@@ -174,7 +175,7 @@
    @PreAuthorize("hasAuthority('system:role:list')")
    @GetMapping("/role/scope/list")
    public R scopeList(@RequestParam Long roleId) {
        return R.ok().add(roleMenuService.listStrictlyMenuByRoleId(roleId));
        return R.ok().add(buildPageRowsUtils.rowsMap(roleMenuService.listStrictlyMenuByRoleId(roleId)));
    }
    @PreAuthorize("hasAuthority('system:role:update')")
@@ -201,7 +202,7 @@
        for (Long id : ids) {
            nameList.add(roleService.getById(id).getName());
        }
        return R.ok().add(nameList);
        return R.ok().add(buildPageRowsUtils.rowsMap(nameList));
    }
}