|
@@ -1,95 +1,92 @@
|
|
|
-package cn.iocoder.yudao.module.iscs.controller.admin.workstation;
|
|
|
|
|
-
|
|
|
|
|
-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.workstation.vo.*;
|
|
|
|
|
-import cn.iocoder.yudao.module.iscs.dal.dataobject.workstation.WorkstationDO;
|
|
|
|
|
-import cn.iocoder.yudao.module.iscs.service.workstation.WorkstationService;
|
|
|
|
|
-
|
|
|
|
|
-@Tag(name = "管理后台 - mars岗位")
|
|
|
|
|
-@RestController
|
|
|
|
|
-@RequestMapping("/iscs/workstation")
|
|
|
|
|
-@Validated
|
|
|
|
|
-public class WorkstationController {
|
|
|
|
|
-
|
|
|
|
|
- @Resource
|
|
|
|
|
- private WorkstationService workstationService;
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping("/insertWorkstation")
|
|
|
|
|
- @Operation(summary = "创建mars岗位")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:workstation:create')")
|
|
|
|
|
- public CommonResult<Long> insertWorkstation(@Valid @RequestBody WorkstationSaveReqVO createReqVO) {
|
|
|
|
|
- return success(workstationService.createWorkstation(createReqVO));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PutMapping("/updateWorkstation")
|
|
|
|
|
- @Operation(summary = "更新mars岗位")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:workstation:update')")
|
|
|
|
|
- public CommonResult<Boolean> updateWorkstation(@Valid @RequestBody WorkstationSaveReqVO updateReqVO) {
|
|
|
|
|
- workstationService.updateWorkstation(updateReqVO);
|
|
|
|
|
- return success(true);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @DeleteMapping("/deleteWorkstationList")
|
|
|
|
|
- @Parameter(name = "ids", description = "编号", required = true)
|
|
|
|
|
- @Operation(summary = "批量删除mars岗位")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:workstation:delete')")
|
|
|
|
|
- public CommonResult<Boolean> deleteWorkstationList(@RequestParam("ids") List<Long> ids) {
|
|
|
|
|
- workstationService.deleteWorkstationListByIds(ids);
|
|
|
|
|
- return success(true);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/selectWorkstationById")
|
|
|
|
|
- @Operation(summary = "获得mars岗位")
|
|
|
|
|
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:workstation:query')")
|
|
|
|
|
- public CommonResult<WorkstationRespVO> selectWorkstationById(@RequestParam("id") Long id) {
|
|
|
|
|
- WorkstationDO workstation = workstationService.getWorkstation(id);
|
|
|
|
|
- return success(BeanUtils.toBean(workstation, WorkstationRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/getWorkstationPage")
|
|
|
|
|
- @Operation(summary = "获得mars岗位分页")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:workstation:query')")
|
|
|
|
|
- public CommonResult<PageResult<WorkstationRespVO>> getWorkstationPage(@Valid WorkstationPageReqVO pageReqVO) {
|
|
|
|
|
- PageResult<WorkstationDO> pageResult = workstationService.getWorkstationPage(pageReqVO);
|
|
|
|
|
- return success(BeanUtils.toBean(pageResult, WorkstationRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/exportWorkstationExcel")
|
|
|
|
|
- @Operation(summary = "导出mars岗位 Excel")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:workstation:export')")
|
|
|
|
|
- @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
- public void exportWorkstationExcel(@Valid WorkstationPageReqVO pageReqVO,
|
|
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
|
|
- pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
- List<WorkstationDO> list = workstationService.getWorkstationPage(pageReqVO).getList();
|
|
|
|
|
- // 导出 Excel
|
|
|
|
|
- ExcelUtils.write(response, "mars岗位.xls", "数据", WorkstationRespVO.class,
|
|
|
|
|
- BeanUtils.toBean(list, WorkstationRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+package cn.iocoder.yudao.module.iscs.controller.admin.workstation;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
|
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.workstation.vo.WorkstationPageReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.workstation.vo.WorkstationRespVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.workstation.vo.WorkstationSaveReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.dal.dataobject.workstation.WorkstationDO;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.service.workstation.WorkstationService;
|
|
|
|
|
+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.servlet.http.HttpServletResponse;
|
|
|
|
|
+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.io.IOException;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
+
|
|
|
|
|
+@Tag(name = "管理后台 - mars岗位")
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/iscs/workstation")
|
|
|
|
|
+@Validated
|
|
|
|
|
+public class WorkstationController {
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private WorkstationService workstationService;
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping("/insertWorkstation")
|
|
|
|
|
+ @Operation(summary = "创建mars岗位")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:workstation:create')")
|
|
|
|
|
+ public CommonResult<Long> insertWorkstation(@Valid @RequestBody WorkstationSaveReqVO createReqVO) {
|
|
|
|
|
+ return success(workstationService.createWorkstation(createReqVO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PutMapping("/updateWorkstation")
|
|
|
|
|
+ @Operation(summary = "更新mars岗位")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:workstation:update')")
|
|
|
|
|
+ public CommonResult<Boolean> updateWorkstation(@Valid @RequestBody WorkstationSaveReqVO updateReqVO) {
|
|
|
|
|
+ workstationService.updateWorkstation(updateReqVO);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @DeleteMapping("/deleteWorkstationList")
|
|
|
|
|
+ @Parameter(name = "ids", description = "编号", required = true)
|
|
|
|
|
+ @Operation(summary = "批量删除mars岗位")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:workstation:delete')")
|
|
|
|
|
+ public CommonResult<Boolean> deleteWorkstationList(@RequestParam("ids") List<Long> ids) {
|
|
|
|
|
+ workstationService.deleteWorkstationListByIds(ids);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/selectWorkstationById")
|
|
|
|
|
+ @Operation(summary = "获得mars岗位")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:workstation:query')")
|
|
|
|
|
+ public CommonResult<WorkstationRespVO> selectWorkstationById(@RequestParam("id") Long id) {
|
|
|
|
|
+ WorkstationDO workstation = workstationService.getWorkstation(id);
|
|
|
|
|
+ return success(BeanUtils.toBean(workstation, WorkstationRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/getWorkstationPage")
|
|
|
|
|
+ @Operation(summary = "获得mars岗位分页")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:workstation:query')")
|
|
|
|
|
+ public CommonResult<PageResult<WorkstationRespVO>> getWorkstationPage(@Valid WorkstationPageReqVO pageReqVO) {
|
|
|
|
|
+ PageResult<WorkstationRespVO> pageResult = workstationService.getWorkstationPage(pageReqVO);
|
|
|
|
|
+ return success(pageResult);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/exportWorkstationExcel")
|
|
|
|
|
+ @Operation(summary = "导出mars岗位 Excel")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:workstation:export')")
|
|
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
+ public void exportWorkstationExcel(@Valid WorkstationPageReqVO pageReqVO,
|
|
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
+ List<WorkstationRespVO> list = workstationService.getWorkstationPage(pageReqVO).getList();
|
|
|
|
|
+ // 导出 Excel
|
|
|
|
|
+ ExcelUtils.write(response, "mars岗位.xls", "数据", WorkstationRespVO.class, list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|