success($this->service->getPageList($this->request->all())); } /** * 回收站角色分页列表 * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[GetMapping("recycle"), Permission("system:role:recycle")] public function recycle(): ResponseInterface { return $this->success($this->service->getPageListByRecycle($this->request->all())); } /** * 通过角色获取菜单 * @param int $id * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[GetMapping("getMenuByRole/{id}")] public function getMenuByRole(int $id): ResponseInterface { return $this->success($this->service->getMenuByRole($id)); } /** * 通过角色获取部门 * @param int $id * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[GetMapping("getDeptByRole/{id}")] public function getDeptByRole(int $id): ResponseInterface { return $this->success($this->service->getDeptByRole($id)); } /** * 获取角色列表 (不验证权限) * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[GetMapping("list")] public function list(): ResponseInterface { return $this->success($this->service->getList()); } /** * 新增角色 * @param SystemRoleRequest $request * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PostMapping("save"), Permission("system:role:save"), OperationLog] public function save(SystemRoleRequest $request): ResponseInterface { return $this->success(['id' => $this->service->save($request->all())]); } /** * 更新角色 * @param int $id * @param SystemRoleRequest $request * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PutMapping("update/{id}"), Permission("system:role:update"), OperationLog] public function update(int $id, SystemRoleRequest $request): ResponseInterface { return $this->service->update($id, $request->all()) ? $this->success() : $this->error(); } /** * 更新用户菜单权限 * @param int $id * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PutMapping("menuPermission/{id}"), Permission("system:role:menuPermission"), OperationLog] public function menuPermission(int $id): ResponseInterface { return $this->service->update($id, $this->request->all()) ? $this->success() : $this->error(); } /** * 更新用户数据权限 * @param int $id * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PutMapping("dataPermission/{id}"), Permission("system:role:dataPermission"), OperationLog] public function dataPermission(int $id): ResponseInterface { return $this->service->update($id, $this->request->all()) ? $this->success() : $this->error(); } /** * 单个或批量删除数据到回收站 * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[DeleteMapping("delete"), Permission("system:role:delete")] public function delete(): ResponseInterface { return $this->service->delete((array) $this->request->input('ids', [])) ? $this->success() : $this->error(); } /** * 单个或批量真实删除数据 (清空回收站) * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[DeleteMapping("realDelete"), Permission("system:role:realDelete"), OperationLog] public function realDelete(): ResponseInterface { return $this->service->realDelete((array) $this->request->input('ids', [])) ? $this->success() : $this->error(); } /** * 单个或批量恢复在回收站的数据 * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PutMapping("recovery"), Permission("system:role:recovery")] public function recovery(): ResponseInterface { return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error(); } /** * 更改角色状态 * @param SystemRoleRequest $request * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PutMapping("changeStatus"), Permission("system:role:changeStatus"), OperationLog] public function changeStatus(SystemRoleRequest $request): ResponseInterface { return $this->service->changeStatus((int) $request->input('id'), (string) $request->input('status')) ? $this->success() : $this->error(); } /** * 数字运算操作 * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PutMapping("numberOperation"), Permission("system:role:update"), OperationLog] public function numberOperation(): ResponseInterface { return $this->service->numberOperation( (int) $this->request->input('id'), (string) $this->request->input('numberName'), (int) $this->request->input('numberValue', 1), ) ? $this->success() : $this->error(); } }