|
|
@@ -1,95 +1,74 @@
|
|
|
-package cn.iocoder.yudao.module.iscs.controller.admin.sop;
|
|
|
-
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-import jakarta.annotation.Resource;
|
|
|
-import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
-import io.swagger.v3.oas.annotations.Parameter;
|
|
|
-import io.swagger.v3.oas.annotations.Operation;
|
|
|
-
|
|
|
-import jakarta.validation.constraints.*;
|
|
|
-import jakarta.validation.*;
|
|
|
-import jakarta.servlet.http.*;
|
|
|
-import java.util.*;
|
|
|
-import java.io.IOException;
|
|
|
-
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
-import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
-import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
-import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
-
|
|
|
-import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
-
|
|
|
-import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
-import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
|
-
|
|
|
-import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.*;
|
|
|
-import cn.iocoder.yudao.module.iscs.dal.dataobject.sop.SopDO;
|
|
|
-import cn.iocoder.yudao.module.iscs.service.sop.SopService;
|
|
|
-
|
|
|
-@Tag(name = "管理后台 - SOP信息")
|
|
|
-@RestController
|
|
|
-@RequestMapping("/iscs/sop")
|
|
|
-@Validated
|
|
|
-public class SopController {
|
|
|
-
|
|
|
- @Resource
|
|
|
- private SopService sopService;
|
|
|
-
|
|
|
- @PostMapping("/insertSop")
|
|
|
- @Operation(summary = "创建SOP信息")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:sop:create')")
|
|
|
- public CommonResult<Long> insertSop(@Valid @RequestBody SopSaveReqVO createReqVO) {
|
|
|
- return success(sopService.createSop(createReqVO));
|
|
|
- }
|
|
|
-
|
|
|
- @PutMapping("/updateSop")
|
|
|
- @Operation(summary = "更新SOP信息")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:sop:update')")
|
|
|
- public CommonResult<Boolean> updateSop(@Valid @RequestBody SopSaveReqVO updateReqVO) {
|
|
|
- sopService.updateSop(updateReqVO);
|
|
|
- return success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @DeleteMapping("/deleteSopList")
|
|
|
- @Parameter(name = "ids", description = "编号", required = true)
|
|
|
- @Operation(summary = "批量删除SOP信息")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:sop:delete')")
|
|
|
- public CommonResult<Boolean> deleteSopList(@RequestParam("ids") List<Long> ids) {
|
|
|
- sopService.deleteSopListByIds(ids);
|
|
|
- return success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/selectSopById")
|
|
|
- @Operation(summary = "获得SOP信息")
|
|
|
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:sop:query')")
|
|
|
- public CommonResult<SopRespVO> selectSopById(@RequestParam("id") Long id) {
|
|
|
- SopDO sop = sopService.getSop(id);
|
|
|
- return success(BeanUtils.toBean(sop, SopRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/getSopPage")
|
|
|
- @Operation(summary = "获得SOP信息分页")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:sop:query')")
|
|
|
- public CommonResult<PageResult<SopRespVO>> getSopPage(@Valid SopPageReqVO pageReqVO) {
|
|
|
- PageResult<SopDO> pageResult = sopService.getSopPage(pageReqVO);
|
|
|
- return success(BeanUtils.toBean(pageResult, SopRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/exportSopExcel")
|
|
|
- @Operation(summary = "导出SOP信息 Excel")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:sop:export')")
|
|
|
- @ApiAccessLog(operateType = EXPORT)
|
|
|
- public void exportSopExcel(@Valid SopPageReqVO pageReqVO,
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
- pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
- List<SopDO> list = sopService.getSopPage(pageReqVO).getList();
|
|
|
- // 导出 Excel
|
|
|
- ExcelUtils.write(response, "SOP信息.xls", "数据", SopRespVO.class,
|
|
|
- BeanUtils.toBean(list, SopRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+package cn.iocoder.yudao.module.iscs.controller.admin.sop;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopRespVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.dal.dataobject.sop.SopDO;
|
|
|
+import cn.iocoder.yudao.module.iscs.service.sop.SopService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import jakarta.annotation.Resource;
|
|
|
+import jakarta.validation.Valid;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
+
|
|
|
+@Tag(name = "管理后台 - SOP信息")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/iscs/sop")
|
|
|
+@Validated
|
|
|
+public class SopController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private SopService sopService;
|
|
|
+
|
|
|
+ @PostMapping("/insertSop")
|
|
|
+ @Operation(summary = "创建SOP信息")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:sop:create')")
|
|
|
+ public CommonResult<Long> insertSop(@Valid @RequestBody SopSaveReqVO createReqVO) {
|
|
|
+ return success(sopService.createSop(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/updateSop")
|
|
|
+ @Operation(summary = "更新SOP信息")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:sop:update')")
|
|
|
+ public CommonResult<Boolean> updateSop(@Valid @RequestBody SopSaveReqVO updateReqVO) {
|
|
|
+ sopService.updateSop(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/deleteSopList")
|
|
|
+ @Parameter(name = "ids", description = "编号", required = true)
|
|
|
+ @Operation(summary = "批量删除SOP信息")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:sop:delete')")
|
|
|
+ public CommonResult<Boolean> deleteSopList(@RequestParam("ids") List<Long> ids) {
|
|
|
+ sopService.deleteSopListByIds(ids);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/selectSopById")
|
|
|
+ @Operation(summary = "获得SOP信息")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:sop:query')")
|
|
|
+ public CommonResult<SopRespVO> selectSopById(@RequestParam("id") Long id) {
|
|
|
+ SopDO sop = sopService.getSop(id);
|
|
|
+ return success(BeanUtils.toBean(sop, SopRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getSopPage")
|
|
|
+ @Operation(summary = "获得SOP信息分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:sop:query')")
|
|
|
+ public CommonResult<PageResult<SopRespVO>> getSopPage(@Valid SopPageReqVO pageReqVO) {
|
|
|
+ PageResult<SopDO> pageResult = sopService.getSopPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, SopRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|