hyperf-view/builder/Generator/Stubs/Controller/import.stub

26 lines
842 B
Plaintext

/**
* 数据导入
* @return ResponseInterface
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
#[PostMapping("import"), Permission("{IMPORT_PERMISSION}")]
public function import(): ResponseInterface
{
return $this->service->import({DTO_CLASS}) ? $this->success() : $this->error();
}
/**
* 下载导入模板
* @return ResponseInterface
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
#[PostMapping("downloadTemplate")]
public function downloadTemplate(): ResponseInterface
{
return (new \Builder\MineCollection)->export({DTO_CLASS}, '模板下载', []);
}