|
|
@@ -1,95 +1,92 @@
|
|
|
-package cn.iocoder.yudao.module.iscs.controller.admin.materialscheckplan;
|
|
|
-
|
|
|
-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.materialscheckplan.vo.*;
|
|
|
-import cn.iocoder.yudao.module.iscs.dal.dataobject.materialscheckplan.MaterialsCheckPlanDO;
|
|
|
-import cn.iocoder.yudao.module.iscs.service.materialscheckplan.MaterialsCheckPlanService;
|
|
|
-
|
|
|
-@Tag(name = "管理后台 - 物资检查计划")
|
|
|
-@RestController
|
|
|
-@RequestMapping("/iscs/materials-check-plan")
|
|
|
-@Validated
|
|
|
-public class MaterialsCheckPlanController {
|
|
|
-
|
|
|
- @Resource
|
|
|
- private MaterialsCheckPlanService materialsCheckPlanService;
|
|
|
-
|
|
|
- @PostMapping("/insertMaterialsCheckPlan")
|
|
|
- @Operation(summary = "创建物资检查计划")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-check-plan:create')")
|
|
|
- public CommonResult<Long> insertMaterialsCheckPlan(@Valid @RequestBody MaterialsCheckPlanSaveReqVO createReqVO) {
|
|
|
- return success(materialsCheckPlanService.createMaterialsCheckPlan(createReqVO));
|
|
|
- }
|
|
|
-
|
|
|
- @PutMapping("/updateMaterialsCheckPlan")
|
|
|
- @Operation(summary = "更新物资检查计划")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-check-plan:update')")
|
|
|
- public CommonResult<Boolean> updateMaterialsCheckPlan(@Valid @RequestBody MaterialsCheckPlanSaveReqVO updateReqVO) {
|
|
|
- materialsCheckPlanService.updateMaterialsCheckPlan(updateReqVO);
|
|
|
- return success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @DeleteMapping("/deleteMaterialsCheckPlanList")
|
|
|
- @Parameter(name = "ids", description = "编号", required = true)
|
|
|
- @Operation(summary = "批量删除物资检查计划")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-check-plan:delete')")
|
|
|
- public CommonResult<Boolean> deleteMaterialsCheckPlanList(@RequestParam("ids") List<Long> ids) {
|
|
|
- materialsCheckPlanService.deleteMaterialsCheckPlanListByIds(ids);
|
|
|
- return success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/selectMaterialsCheckPlanById")
|
|
|
- @Operation(summary = "获得物资检查计划")
|
|
|
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-check-plan:query')")
|
|
|
- public CommonResult<MaterialsCheckPlanRespVO> selectMaterialsCheckPlanById(@RequestParam("id") Long id) {
|
|
|
- MaterialsCheckPlanDO materialsCheckPlan = materialsCheckPlanService.getMaterialsCheckPlan(id);
|
|
|
- return success(BeanUtils.toBean(materialsCheckPlan, MaterialsCheckPlanRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/getMaterialsCheckPlanPage")
|
|
|
- @Operation(summary = "获得物资检查计划分页")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-check-plan:query')")
|
|
|
- public CommonResult<PageResult<MaterialsCheckPlanRespVO>> getMaterialsCheckPlanPage(@Valid MaterialsCheckPlanPageReqVO pageReqVO) {
|
|
|
- PageResult<MaterialsCheckPlanDO> pageResult = materialsCheckPlanService.getMaterialsCheckPlanPage(pageReqVO);
|
|
|
- return success(BeanUtils.toBean(pageResult, MaterialsCheckPlanRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/exportMaterialsCheckPlanExcel")
|
|
|
- @Operation(summary = "导出物资检查计划 Excel")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-check-plan:export')")
|
|
|
- @ApiAccessLog(operateType = EXPORT)
|
|
|
- public void exportMaterialsCheckPlanExcel(@Valid MaterialsCheckPlanPageReqVO pageReqVO,
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
- pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
- List<MaterialsCheckPlanDO> list = materialsCheckPlanService.getMaterialsCheckPlanPage(pageReqVO).getList();
|
|
|
- // 导出 Excel
|
|
|
- ExcelUtils.write(response, "物资检查计划.xls", "数据", MaterialsCheckPlanRespVO.class,
|
|
|
- BeanUtils.toBean(list, MaterialsCheckPlanRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+package cn.iocoder.yudao.module.iscs.controller.admin.materialscheckplan;
|
|
|
+
|
|
|
+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.materialscheckplan.vo.MaterialsCheckPlanPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.materialscheckplan.vo.MaterialsCheckPlanRespVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.materialscheckplan.vo.MaterialsCheckPlanSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.dal.dataobject.materialscheckplan.MaterialsCheckPlanDO;
|
|
|
+import cn.iocoder.yudao.module.iscs.service.materialscheckplan.MaterialsCheckPlanService;
|
|
|
+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-check-plan")
|
|
|
+@Validated
|
|
|
+public class MaterialsCheckPlanController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private MaterialsCheckPlanService materialsCheckPlanService;
|
|
|
+
|
|
|
+ @PostMapping("/insertMaterialsCheckPlan")
|
|
|
+ @Operation(summary = "创建物资检查计划")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-check-plan:create')")
|
|
|
+ public CommonResult<Long> insertMaterialsCheckPlan(@Valid @RequestBody MaterialsCheckPlanSaveReqVO createReqVO) {
|
|
|
+ return success(materialsCheckPlanService.createMaterialsCheckPlan(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/updateMaterialsCheckPlan")
|
|
|
+ @Operation(summary = "更新物资检查计划")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-check-plan:update')")
|
|
|
+ public CommonResult<Boolean> updateMaterialsCheckPlan(@Valid @RequestBody MaterialsCheckPlanSaveReqVO updateReqVO) {
|
|
|
+ materialsCheckPlanService.updateMaterialsCheckPlan(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/deleteMaterialsCheckPlanList")
|
|
|
+ @Parameter(name = "ids", description = "编号", required = true)
|
|
|
+ @Operation(summary = "批量删除物资检查计划")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-check-plan:delete')")
|
|
|
+ public CommonResult<Boolean> deleteMaterialsCheckPlanList(@RequestParam("ids") List<Long> ids) {
|
|
|
+ materialsCheckPlanService.deleteMaterialsCheckPlanListByIds(ids);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/selectMaterialsCheckPlanById")
|
|
|
+ @Operation(summary = "获得物资检查计划")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-check-plan:query')")
|
|
|
+ public CommonResult<MaterialsCheckPlanRespVO> selectMaterialsCheckPlanById(@RequestParam("id") Long id) {
|
|
|
+ MaterialsCheckPlanDO materialsCheckPlan = materialsCheckPlanService.getMaterialsCheckPlan(id);
|
|
|
+ return success(BeanUtils.toBean(materialsCheckPlan, MaterialsCheckPlanRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getMaterialsCheckPlanPage")
|
|
|
+ @Operation(summary = "获得物资检查计划分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-check-plan:query')")
|
|
|
+ public CommonResult<PageResult<MaterialsCheckPlanRespVO>> getMaterialsCheckPlanPage(@Valid MaterialsCheckPlanPageReqVO pageReqVO) {
|
|
|
+ PageResult<MaterialsCheckPlanRespVO> pageResult = materialsCheckPlanService.getMaterialsCheckPlanPage(pageReqVO);
|
|
|
+ return success(pageResult);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/exportMaterialsCheckPlanExcel")
|
|
|
+ @Operation(summary = "导出物资检查计划 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-check-plan:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportMaterialsCheckPlanExcel(@Valid MaterialsCheckPlanPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<MaterialsCheckPlanRespVO> list = materialsCheckPlanService.getMaterialsCheckPlanPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "物资检查计划.xls", "数据", MaterialsCheckPlanRespVO.class, list);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|