|
|
@@ -1,95 +1,100 @@
|
|
|
-package cn.iocoder.yudao.module.iscs.controller.admin.jobcard;
|
|
|
-
|
|
|
-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.jobcard.vo.*;
|
|
|
-import cn.iocoder.yudao.module.iscs.dal.dataobject.jobcard.JobCardDO;
|
|
|
-import cn.iocoder.yudao.module.iscs.service.jobcard.JobCardService;
|
|
|
-
|
|
|
-@Tag(name = "管理后台 - 工作卡")
|
|
|
-@RestController
|
|
|
-@RequestMapping("/iscs/job-card")
|
|
|
-@Validated
|
|
|
-public class JobCardController {
|
|
|
-
|
|
|
- @Resource
|
|
|
- private JobCardService jobCardService;
|
|
|
-
|
|
|
- @PostMapping("/insertJobCard")
|
|
|
- @Operation(summary = "创建工作卡")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:job-card:create')")
|
|
|
- public CommonResult<Long> insertJobCard(@Valid @RequestBody JobCardSaveReqVO createReqVO) {
|
|
|
- return success(jobCardService.createJobCard(createReqVO));
|
|
|
- }
|
|
|
-
|
|
|
- @PutMapping("/updateJobCard")
|
|
|
- @Operation(summary = "更新工作卡")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:job-card:update')")
|
|
|
- public CommonResult<Boolean> updateJobCard(@Valid @RequestBody JobCardSaveReqVO updateReqVO) {
|
|
|
- jobCardService.updateJobCard(updateReqVO);
|
|
|
- return success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @DeleteMapping("/deleteJobCardList")
|
|
|
- @Parameter(name = "ids", description = "编号", required = true)
|
|
|
- @Operation(summary = "批量删除工作卡")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:job-card:delete')")
|
|
|
- public CommonResult<Boolean> deleteJobCardList(@RequestParam("ids") List<Long> ids) {
|
|
|
- jobCardService.deleteJobCardListByIds(ids);
|
|
|
- return success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/selectJobCardById")
|
|
|
- @Operation(summary = "获得工作卡")
|
|
|
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:job-card:query')")
|
|
|
- public CommonResult<JobCardRespVO> selectJobCardById(@RequestParam("id") Long id) {
|
|
|
- JobCardDO jobCard = jobCardService.getJobCard(id);
|
|
|
- return success(BeanUtils.toBean(jobCard, JobCardRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/getJobCardPage")
|
|
|
- @Operation(summary = "获得工作卡分页")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:job-card:query')")
|
|
|
- public CommonResult<PageResult<JobCardRespVO>> getJobCardPage(@Valid JobCardPageReqVO pageReqVO) {
|
|
|
- PageResult<JobCardDO> pageResult = jobCardService.getJobCardPage(pageReqVO);
|
|
|
- return success(BeanUtils.toBean(pageResult, JobCardRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/exportJobCardExcel")
|
|
|
- @Operation(summary = "导出工作卡 Excel")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:job-card:export')")
|
|
|
- @ApiAccessLog(operateType = EXPORT)
|
|
|
- public void exportJobCardExcel(@Valid JobCardPageReqVO pageReqVO,
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
- pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
- List<JobCardDO> list = jobCardService.getJobCardPage(pageReqVO).getList();
|
|
|
- // 导出 Excel
|
|
|
- ExcelUtils.write(response, "工作卡.xls", "数据", JobCardRespVO.class,
|
|
|
- BeanUtils.toBean(list, JobCardRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+package cn.iocoder.yudao.module.iscs.controller.admin.jobcard;
|
|
|
+
|
|
|
+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.jobcard.vo.JobCardPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.jobcard.vo.JobCardRespVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.jobcard.vo.JobCardSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.dal.dataobject.jobcard.JobCardDO;
|
|
|
+import cn.iocoder.yudao.module.iscs.service.jobcard.JobCardService;
|
|
|
+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 = "管理后台 - 工作卡")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/iscs/job-card")
|
|
|
+@Validated
|
|
|
+public class JobCardController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private JobCardService jobCardService;
|
|
|
+
|
|
|
+ @PostMapping("/insertJobCard")
|
|
|
+ @Operation(summary = "创建工作卡")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:job-card:create')")
|
|
|
+ public CommonResult<Long> insertJobCard(@Valid @RequestBody JobCardSaveReqVO createReqVO) {
|
|
|
+ return success(jobCardService.createJobCard(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/updateJobCard")
|
|
|
+ @Operation(summary = "更新工作卡")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:job-card:update')")
|
|
|
+ public CommonResult<Boolean> updateJobCard(@Valid @RequestBody JobCardSaveReqVO updateReqVO) {
|
|
|
+ jobCardService.updateJobCard(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/deleteJobCardList")
|
|
|
+ @Parameter(name = "ids", description = "编号", required = true)
|
|
|
+ @Operation(summary = "批量删除工作卡")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:job-card:delete')")
|
|
|
+ public CommonResult<Boolean> deleteJobCardList(@RequestParam("ids") List<Long> ids) {
|
|
|
+ jobCardService.deleteJobCardListByIds(ids);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/selectJobCardById")
|
|
|
+ @Operation(summary = "获得工作卡")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:job-card:query')")
|
|
|
+ public CommonResult<JobCardRespVO> selectJobCardById(@RequestParam("id") Long id) {
|
|
|
+ JobCardDO jobCard = jobCardService.getJobCard(id);
|
|
|
+ return success(BeanUtils.toBean(jobCard, JobCardRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getJobCardPage")
|
|
|
+ @Operation(summary = "获得工作卡分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:job-card:query')")
|
|
|
+ public CommonResult<PageResult<JobCardRespVO>> getJobCardPage(@Valid JobCardPageReqVO pageReqVO) {
|
|
|
+ PageResult<JobCardDO> pageResult = jobCardService.getJobCardPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, JobCardRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/exportJobCardExcel")
|
|
|
+ @Operation(summary = "导出工作卡 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:job-card:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportJobCardExcel(@Valid JobCardPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<JobCardDO> list = jobCardService.getJobCardPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "工作卡.xls", "数据", JobCardRespVO.class,
|
|
|
+ BeanUtils.toBean(list, JobCardRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/insertJobCardByCabinet")
|
|
|
+ @Operation(summary = "机柜录入工作卡")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:job-card:create')")
|
|
|
+ public CommonResult<Boolean> insertJobCardByCabinet(@Valid @RequestBody JobCardDO jobCardDO) {
|
|
|
+ return success(jobCardService.insertJobCardByCabinet(jobCardDO));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|