|
|
@@ -1,95 +1,92 @@
|
|
|
-package cn.iocoder.yudao.module.iscs.controller.admin.materialschangerecord;
|
|
|
-
|
|
|
-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.materialschangerecord.vo.*;
|
|
|
-import cn.iocoder.yudao.module.iscs.dal.dataobject.materialschangerecord.MaterialsChangeRecordDO;
|
|
|
-import cn.iocoder.yudao.module.iscs.service.materialschangerecord.MaterialsChangeRecordService;
|
|
|
-
|
|
|
-@Tag(name = "管理后台 - 物资更换记录")
|
|
|
-@RestController
|
|
|
-@RequestMapping("/iscs/materials-change-record")
|
|
|
-@Validated
|
|
|
-public class MaterialsChangeRecordController {
|
|
|
-
|
|
|
- @Resource
|
|
|
- private MaterialsChangeRecordService materialsChangeRecordService;
|
|
|
-
|
|
|
- @PostMapping("/insertMaterialsChangeRecord")
|
|
|
- @Operation(summary = "创建物资更换记录")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-change-record:create')")
|
|
|
- public CommonResult<Long> insertMaterialsChangeRecord(@Valid @RequestBody MaterialsChangeRecordSaveReqVO createReqVO) {
|
|
|
- return success(materialsChangeRecordService.createMaterialsChangeRecord(createReqVO));
|
|
|
- }
|
|
|
-
|
|
|
- @PutMapping("/updateMaterialsChangeRecord")
|
|
|
- @Operation(summary = "更新物资更换记录")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-change-record:update')")
|
|
|
- public CommonResult<Boolean> updateMaterialsChangeRecord(@Valid @RequestBody MaterialsChangeRecordSaveReqVO updateReqVO) {
|
|
|
- materialsChangeRecordService.updateMaterialsChangeRecord(updateReqVO);
|
|
|
- return success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @DeleteMapping("/deleteMaterialsChangeRecordList")
|
|
|
- @Parameter(name = "ids", description = "编号", required = true)
|
|
|
- @Operation(summary = "批量删除物资更换记录")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-change-record:delete')")
|
|
|
- public CommonResult<Boolean> deleteMaterialsChangeRecordList(@RequestParam("ids") List<Long> ids) {
|
|
|
- materialsChangeRecordService.deleteMaterialsChangeRecordListByIds(ids);
|
|
|
- return success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/selectMaterialsChangeRecordById")
|
|
|
- @Operation(summary = "获得物资更换记录")
|
|
|
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-change-record:query')")
|
|
|
- public CommonResult<MaterialsChangeRecordRespVO> selectMaterialsChangeRecordById(@RequestParam("id") Long id) {
|
|
|
- MaterialsChangeRecordDO materialsChangeRecord = materialsChangeRecordService.getMaterialsChangeRecord(id);
|
|
|
- return success(BeanUtils.toBean(materialsChangeRecord, MaterialsChangeRecordRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/getMaterialsChangeRecordPage")
|
|
|
- @Operation(summary = "获得物资更换记录分页")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-change-record:query')")
|
|
|
- public CommonResult<PageResult<MaterialsChangeRecordRespVO>> getMaterialsChangeRecordPage(@Valid MaterialsChangeRecordPageReqVO pageReqVO) {
|
|
|
- PageResult<MaterialsChangeRecordDO> pageResult = materialsChangeRecordService.getMaterialsChangeRecordPage(pageReqVO);
|
|
|
- return success(BeanUtils.toBean(pageResult, MaterialsChangeRecordRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/exportMaterialsChangeRecordExcel")
|
|
|
- @Operation(summary = "导出物资更换记录 Excel")
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-change-record:export')")
|
|
|
- @ApiAccessLog(operateType = EXPORT)
|
|
|
- public void exportMaterialsChangeRecordExcel(@Valid MaterialsChangeRecordPageReqVO pageReqVO,
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
- pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
- List<MaterialsChangeRecordDO> list = materialsChangeRecordService.getMaterialsChangeRecordPage(pageReqVO).getList();
|
|
|
- // 导出 Excel
|
|
|
- ExcelUtils.write(response, "物资更换记录.xls", "数据", MaterialsChangeRecordRespVO.class,
|
|
|
- BeanUtils.toBean(list, MaterialsChangeRecordRespVO.class));
|
|
|
- }
|
|
|
-
|
|
|
-}
|
|
|
+package cn.iocoder.yudao.module.iscs.controller.admin.materialschangerecord;
|
|
|
+
|
|
|
+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.materialschangerecord.vo.MaterialsChangeRecordPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.materialschangerecord.vo.MaterialsChangeRecordRespVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.materialschangerecord.vo.MaterialsChangeRecordSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.iscs.dal.dataobject.materialschangerecord.MaterialsChangeRecordDO;
|
|
|
+import cn.iocoder.yudao.module.iscs.service.materialschangerecord.MaterialsChangeRecordService;
|
|
|
+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-change-record")
|
|
|
+@Validated
|
|
|
+public class MaterialsChangeRecordController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private MaterialsChangeRecordService materialsChangeRecordService;
|
|
|
+
|
|
|
+ @PostMapping("/insertMaterialsChangeRecord")
|
|
|
+ @Operation(summary = "创建物资更换记录")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-change-record:create')")
|
|
|
+ public CommonResult<Long> insertMaterialsChangeRecord(@Valid @RequestBody MaterialsChangeRecordSaveReqVO createReqVO) {
|
|
|
+ return success(materialsChangeRecordService.createMaterialsChangeRecord(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/updateMaterialsChangeRecord")
|
|
|
+ @Operation(summary = "更新物资更换记录")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-change-record:update')")
|
|
|
+ public CommonResult<Boolean> updateMaterialsChangeRecord(@Valid @RequestBody MaterialsChangeRecordSaveReqVO updateReqVO) {
|
|
|
+ materialsChangeRecordService.updateMaterialsChangeRecord(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/deleteMaterialsChangeRecordList")
|
|
|
+ @Parameter(name = "ids", description = "编号", required = true)
|
|
|
+ @Operation(summary = "批量删除物资更换记录")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-change-record:delete')")
|
|
|
+ public CommonResult<Boolean> deleteMaterialsChangeRecordList(@RequestParam("ids") List<Long> ids) {
|
|
|
+ materialsChangeRecordService.deleteMaterialsChangeRecordListByIds(ids);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/selectMaterialsChangeRecordById")
|
|
|
+ @Operation(summary = "获得物资更换记录")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-change-record:query')")
|
|
|
+ public CommonResult<MaterialsChangeRecordRespVO> selectMaterialsChangeRecordById(@RequestParam("id") Long id) {
|
|
|
+ MaterialsChangeRecordDO materialsChangeRecord = materialsChangeRecordService.getMaterialsChangeRecord(id);
|
|
|
+ return success(BeanUtils.toBean(materialsChangeRecord, MaterialsChangeRecordRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getMaterialsChangeRecordPage")
|
|
|
+ @Operation(summary = "获得物资更换记录分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-change-record:query')")
|
|
|
+ public CommonResult<PageResult<MaterialsChangeRecordRespVO>> getMaterialsChangeRecordPage(@Valid MaterialsChangeRecordPageReqVO pageReqVO) {
|
|
|
+ PageResult<MaterialsChangeRecordRespVO> pageResult = materialsChangeRecordService.getMaterialsChangeRecordPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, MaterialsChangeRecordRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/exportMaterialsChangeRecordExcel")
|
|
|
+ @Operation(summary = "导出物资更换记录 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-change-record:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportMaterialsChangeRecordExcel(@Valid MaterialsChangeRecordPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<MaterialsChangeRecordRespVO> list = materialsChangeRecordService.getMaterialsChangeRecordPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "物资更换记录.xls", "数据", MaterialsChangeRecordRespVO.class, list);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|