|
|
@@ -1,95 +1,92 @@
|
|
|
-package cn.iocoder.yudao.module.iscs.controller.admin.materialsinstructions;
|
|
|
-
|
|
|
-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.materialsinstructions.vo.*;
|
|
|
-import cn.iocoder.yudao.module.iscs.dal.dataobject.materialsinstructions.MaterialsInstructionsDO;
|
|
|
-import cn.iocoder.yudao.module.iscs.service.materialsinstructions.MaterialsInstructionsService;
|
|
|
-
|
|
|
-@Tag(name = "管理后台 - 物资使用说明")
|
|
|
-@RestController
|
|
|
-@RequestMapping("/iscs/materials-instructions")
|
|
|
-@Validated
|
|
|
-public class MaterialsInstructionsController {
|
|
|
-
|
|
|
- @Resource
|
|
|
- private MaterialsInstructionsService materialsInstructionsService;
|
|
|
-
|
|
|
- @PostMapping("/insertMaterialsInstructions")
|
|
|
- @Operation(summary = "创建物资使用说明")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-instructions:create')")
|
|
|
- public CommonResult<Long> insertMaterialsInstructions(@Valid @RequestBody MaterialsInstructionsSaveReqVO createReqVO) {
|
|
|
- return success(materialsInstructionsService.createMaterialsInstructions(createReqVO));
|
|
|
- }
|
|
|
-
|
|
|
- @PutMapping("/updateMaterialsInstructions")
|
|
|
- @Operation(summary = "更新物资使用说明")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-instructions:update')")
|
|
|
- public CommonResult<Boolean> updateMaterialsInstructions(@Valid @RequestBody MaterialsInstructionsSaveReqVO updateReqVO) {
|
|
|
- materialsInstructionsService.updateMaterialsInstructions(updateReqVO);
|
|
|
- return success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @DeleteMapping("/deleteMaterialsInstructionsList")
|
|
|
- @Parameter(name = "ids", description = "编号", required = true)
|
|
|
- @Operation(summary = "批量删除物资使用说明")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-instructions:delete')")
|
|
|
- public CommonResult<Boolean> deleteMaterialsInstructionsList(@RequestParam("ids") List<Long> ids) {
|
|
|
- materialsInstructionsService.deleteMaterialsInstructionsListByIds(ids);
|
|
|
- return success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/selectMaterialsInstructionsById")
|
|
|
- @Operation(summary = "获得物资使用说明")
|
|
|
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-instructions:query')")
|
|
|
- public CommonResult<MaterialsInstructionsRespVO> selectMaterialsInstructionsById(@RequestParam("id") Long id) {
|
|
|
- MaterialsInstructionsDO materialsInstructions = materialsInstructionsService.getMaterialsInstructions(id);
|
|
|
- return success(BeanUtils.toBean(materialsInstructions, MaterialsInstructionsRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/getMaterialsInstructionsPage")
|
|
|
- @Operation(summary = "获得物资使用说明分页")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-instructions:query')")
|
|
|
- public CommonResult<PageResult<MaterialsInstructionsRespVO>> getMaterialsInstructionsPage(@Valid MaterialsInstructionsPageReqVO pageReqVO) {
|
|
|
- PageResult<MaterialsInstructionsDO> pageResult = materialsInstructionsService.getMaterialsInstructionsPage(pageReqVO);
|
|
|
- return success(BeanUtils.toBean(pageResult, MaterialsInstructionsRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/exportMaterialsInstructionsExcel")
|
|
|
- @Operation(summary = "导出物资使用说明 Excel")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-instructions:export')")
|
|
|
- @ApiAccessLog(operateType = EXPORT)
|
|
|
- public void exportMaterialsInstructionsExcel(@Valid MaterialsInstructionsPageReqVO pageReqVO,
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
- pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
- List<MaterialsInstructionsDO> list = materialsInstructionsService.getMaterialsInstructionsPage(pageReqVO).getList();
|
|
|
- // 导出 Excel
|
|
|
- ExcelUtils.write(response, "物资使用说明.xls", "数据", MaterialsInstructionsRespVO.class,
|
|
|
- BeanUtils.toBean(list, MaterialsInstructionsRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+package cn.iocoder.yudao.module.iscs.controller.admin.materialsinstructions;
|
|
|
+
|
|
|
+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.materialsinstructions.vo.MaterialsInstructionsPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.materialsinstructions.vo.MaterialsInstructionsRespVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.materialsinstructions.vo.MaterialsInstructionsSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.dal.dataobject.materialsinstructions.MaterialsInstructionsDO;
|
|
|
+import cn.iocoder.yudao.module.iscs.service.materialsinstructions.MaterialsInstructionsService;
|
|
|
+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/materials-instructions")
|
|
|
+@Validated
|
|
|
+public class MaterialsInstructionsController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private MaterialsInstructionsService materialsInstructionsService;
|
|
|
+
|
|
|
+ @PostMapping("/insertMaterialsInstructions")
|
|
|
+ @Operation(summary = "创建物资使用说明")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-instructions:create')")
|
|
|
+ public CommonResult<Long> insertMaterialsInstructions(@Valid @RequestBody MaterialsInstructionsSaveReqVO createReqVO) {
|
|
|
+ return success(materialsInstructionsService.createMaterialsInstructions(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/updateMaterialsInstructions")
|
|
|
+ @Operation(summary = "更新物资使用说明")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-instructions:update')")
|
|
|
+ public CommonResult<Boolean> updateMaterialsInstructions(@Valid @RequestBody MaterialsInstructionsSaveReqVO updateReqVO) {
|
|
|
+ materialsInstructionsService.updateMaterialsInstructions(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/deleteMaterialsInstructionsList")
|
|
|
+ @Parameter(name = "ids", description = "编号", required = true)
|
|
|
+ @Operation(summary = "批量删除物资使用说明")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-instructions:delete')")
|
|
|
+ public CommonResult<Boolean> deleteMaterialsInstructionsList(@RequestParam("ids") List<Long> ids) {
|
|
|
+ materialsInstructionsService.deleteMaterialsInstructionsListByIds(ids);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/selectMaterialsInstructionsById")
|
|
|
+ @Operation(summary = "获得物资使用说明")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-instructions:query')")
|
|
|
+ public CommonResult<MaterialsInstructionsRespVO> selectMaterialsInstructionsById(@RequestParam("id") Long id) {
|
|
|
+ MaterialsInstructionsDO materialsInstructions = materialsInstructionsService.getMaterialsInstructions(id);
|
|
|
+ return success(BeanUtils.toBean(materialsInstructions, MaterialsInstructionsRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getMaterialsInstructionsPage")
|
|
|
+ @Operation(summary = "获得物资使用说明分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-instructions:query')")
|
|
|
+ public CommonResult<PageResult<MaterialsInstructionsRespVO>> getMaterialsInstructionsPage(@Valid MaterialsInstructionsPageReqVO pageReqVO) {
|
|
|
+ PageResult<MaterialsInstructionsRespVO> pageResult = materialsInstructionsService.getMaterialsInstructionsPage(pageReqVO);
|
|
|
+ return success(pageResult);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/exportMaterialsInstructionsExcel")
|
|
|
+ @Operation(summary = "导出物资使用说明 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-instructions:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportMaterialsInstructionsExcel(@Valid MaterialsInstructionsPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<MaterialsInstructionsRespVO> list = materialsInstructionsService.getMaterialsInstructionsPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "物资使用说明.xls", "数据", MaterialsInstructionsRespVO.class, list);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|