|
@@ -1,95 +1,92 @@
|
|
|
-package cn.iocoder.yudao.module.iscs.controller.admin.materialsloan;
|
|
|
|
|
-
|
|
|
|
|
-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.materialsloan.vo.*;
|
|
|
|
|
-import cn.iocoder.yudao.module.iscs.dal.dataobject.materialsloan.MaterialsLoanDO;
|
|
|
|
|
-import cn.iocoder.yudao.module.iscs.service.materialsloan.MaterialsLoanService;
|
|
|
|
|
-
|
|
|
|
|
-@Tag(name = "管理后台 - 物资借出")
|
|
|
|
|
-@RestController
|
|
|
|
|
-@RequestMapping("/iscs/materials-loan")
|
|
|
|
|
-@Validated
|
|
|
|
|
-public class MaterialsLoanController {
|
|
|
|
|
-
|
|
|
|
|
- @Resource
|
|
|
|
|
- private MaterialsLoanService materialsLoanService;
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping("/insertMaterialsLoan")
|
|
|
|
|
- @Operation(summary = "创建物资借出")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-loan:create')")
|
|
|
|
|
- public CommonResult<Long> insertMaterialsLoan(@Valid @RequestBody MaterialsLoanSaveReqVO createReqVO) {
|
|
|
|
|
- return success(materialsLoanService.createMaterialsLoan(createReqVO));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PutMapping("/updateMaterialsLoan")
|
|
|
|
|
- @Operation(summary = "更新物资借出")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-loan:update')")
|
|
|
|
|
- public CommonResult<Boolean> updateMaterialsLoan(@Valid @RequestBody MaterialsLoanSaveReqVO updateReqVO) {
|
|
|
|
|
- materialsLoanService.updateMaterialsLoan(updateReqVO);
|
|
|
|
|
- return success(true);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @DeleteMapping("/deleteMaterialsLoanList")
|
|
|
|
|
- @Parameter(name = "ids", description = "编号", required = true)
|
|
|
|
|
- @Operation(summary = "批量删除物资借出")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-loan:delete')")
|
|
|
|
|
- public CommonResult<Boolean> deleteMaterialsLoanList(@RequestParam("ids") List<Long> ids) {
|
|
|
|
|
- materialsLoanService.deleteMaterialsLoanListByIds(ids);
|
|
|
|
|
- return success(true);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/selectMaterialsLoanById")
|
|
|
|
|
- @Operation(summary = "获得物资借出")
|
|
|
|
|
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-loan:query')")
|
|
|
|
|
- public CommonResult<MaterialsLoanRespVO> selectMaterialsLoanById(@RequestParam("id") Long id) {
|
|
|
|
|
- MaterialsLoanDO materialsLoan = materialsLoanService.getMaterialsLoan(id);
|
|
|
|
|
- return success(BeanUtils.toBean(materialsLoan, MaterialsLoanRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/getMaterialsLoanPage")
|
|
|
|
|
- @Operation(summary = "获得物资借出分页")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-loan:query')")
|
|
|
|
|
- public CommonResult<PageResult<MaterialsLoanRespVO>> getMaterialsLoanPage(@Valid MaterialsLoanPageReqVO pageReqVO) {
|
|
|
|
|
- PageResult<MaterialsLoanDO> pageResult = materialsLoanService.getMaterialsLoanPage(pageReqVO);
|
|
|
|
|
- return success(BeanUtils.toBean(pageResult, MaterialsLoanRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/exportMaterialsLoanExcel")
|
|
|
|
|
- @Operation(summary = "导出物资借出 Excel")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-loan:export')")
|
|
|
|
|
- @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
- public void exportMaterialsLoanExcel(@Valid MaterialsLoanPageReqVO pageReqVO,
|
|
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
|
|
- pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
- List<MaterialsLoanDO> list = materialsLoanService.getMaterialsLoanPage(pageReqVO).getList();
|
|
|
|
|
- // 导出 Excel
|
|
|
|
|
- ExcelUtils.write(response, "物资借出.xls", "数据", MaterialsLoanRespVO.class,
|
|
|
|
|
- BeanUtils.toBean(list, MaterialsLoanRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+package cn.iocoder.yudao.module.iscs.controller.admin.materialsloan;
|
|
|
|
|
+
|
|
|
|
|
+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.materialsloan.vo.MaterialsLoanPageReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.materialsloan.vo.MaterialsLoanRespVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.controller.admin.materialsloan.vo.MaterialsLoanSaveReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.dal.dataobject.materialsloan.MaterialsLoanDO;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.service.materialsloan.MaterialsLoanService;
|
|
|
|
|
+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-loan")
|
|
|
|
|
+@Validated
|
|
|
|
|
+public class MaterialsLoanController {
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private MaterialsLoanService materialsLoanService;
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping("/insertMaterialsLoan")
|
|
|
|
|
+ @Operation(summary = "创建物资借出")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-loan:create')")
|
|
|
|
|
+ public CommonResult<Long> insertMaterialsLoan(@Valid @RequestBody MaterialsLoanSaveReqVO createReqVO) {
|
|
|
|
|
+ return success(materialsLoanService.createMaterialsLoan(createReqVO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PutMapping("/updateMaterialsLoan")
|
|
|
|
|
+ @Operation(summary = "更新物资借出")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-loan:update')")
|
|
|
|
|
+ public CommonResult<Boolean> updateMaterialsLoan(@Valid @RequestBody MaterialsLoanSaveReqVO updateReqVO) {
|
|
|
|
|
+ materialsLoanService.updateMaterialsLoan(updateReqVO);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @DeleteMapping("/deleteMaterialsLoanList")
|
|
|
|
|
+ @Parameter(name = "ids", description = "编号", required = true)
|
|
|
|
|
+ @Operation(summary = "批量删除物资借出")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-loan:delete')")
|
|
|
|
|
+ public CommonResult<Boolean> deleteMaterialsLoanList(@RequestParam("ids") List<Long> ids) {
|
|
|
|
|
+ materialsLoanService.deleteMaterialsLoanListByIds(ids);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/selectMaterialsLoanById")
|
|
|
|
|
+ @Operation(summary = "获得物资借出")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-loan:query')")
|
|
|
|
|
+ public CommonResult<MaterialsLoanRespVO> selectMaterialsLoanById(@RequestParam("id") Long id) {
|
|
|
|
|
+ MaterialsLoanDO materialsLoan = materialsLoanService.getMaterialsLoan(id);
|
|
|
|
|
+ return success(BeanUtils.toBean(materialsLoan, MaterialsLoanRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/getMaterialsLoanPage")
|
|
|
|
|
+ @Operation(summary = "获得物资借出分页")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-loan:query')")
|
|
|
|
|
+ public CommonResult<PageResult<MaterialsLoanRespVO>> getMaterialsLoanPage(@Valid MaterialsLoanPageReqVO pageReqVO) {
|
|
|
|
|
+ PageResult<MaterialsLoanRespVO> pageResult = materialsLoanService.getMaterialsLoanPage(pageReqVO);
|
|
|
|
|
+ return success(pageResult);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/exportMaterialsLoanExcel")
|
|
|
|
|
+ @Operation(summary = "导出物资借出 Excel")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-loan:export')")
|
|
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
+ public void exportMaterialsLoanExcel(@Valid MaterialsLoanPageReqVO pageReqVO,
|
|
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
+ List<MaterialsLoanRespVO> list = materialsLoanService.getMaterialsLoanPage(pageReqVO).getList();
|
|
|
|
|
+ // 导出 Excel
|
|
|
|
|
+ ExcelUtils.write(response, "物资借出.xls", "数据", MaterialsLoanRespVO.class, list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|