success($this->service->getPageList($this->request->all())); } /** * 快捷查询一个字典 * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[GetMapping("list")] public function list(): ResponseInterface { return $this->success($this->service->getList($this->request->all())); } /** * 快捷查询多个字典 * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[GetMapping("lists")] public function lists(): ResponseInterface { return $this->success($this->service->getLists($this->request->all())); } /** * 清除字典缓存 * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PostMapping("clearCache"), Permission("system:dict:clearCache"), OperationLog] public function clearCache(): ResponseInterface { return $this->service->clearCache() ? $this->success() : $this->error(); } /** * 回收站列表 * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[GetMapping("recycle"), Permission("system:dict:recycle")] public function recycle(): ResponseInterface { return $this->success($this->service->getPageListByRecycle($this->request->all())); } /** * 新增字典类型 * @param SystemDictDataRequest $request * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PostMapping("save"), Permission("system:dict:save"), OperationLog] public function save(SystemDictDataRequest $request): ResponseInterface { return $this->success(['id' => $this->service->save($request->all())]); } /** * 获取一个字典类型数据 * @param int $id * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[GetMapping("read/{id}"), Permission("system:dict:read")] public function read(int $id): ResponseInterface { return $this->success($this->service->read($id)); } /** * 更新一个字典类型 * @param int $id * @param SystemDictDataRequest $request * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PutMapping("update/{id}"), Permission("system:dict:update"), OperationLog] public function update(int $id, SystemDictDataRequest $request): ResponseInterface { return $this->service->update($id, $request->all()) ? $this->success() : $this->error(); } /** * 单个或批量字典数据 * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[DeleteMapping("delete"), Permission("system:dict: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:dict: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:dict:recovery")] public function recovery(): ResponseInterface { return $this->service->recovery((array) $this->request->input('ids', [])) ? $this->success() : $this->error(); } /** * 更改字典状态 * @param SystemDictDataRequest $request * @return ResponseInterface * @throws \Psr\Container\ContainerExceptionInterface * @throws \Psr\Container\NotFoundExceptionInterface */ #[PutMapping("changeStatus"), Permission("system:dict:update"), OperationLog] public function changeStatus(SystemDictDataRequest $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:dict: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(); } }