|
@@ -1,95 +1,95 @@
|
|
|
-package cn.iocoder.yudao.module.iscs.controller.admin.materialstype;
|
|
|
|
|
-
|
|
|
|
|
-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.materialstype.vo.*;
|
|
|
|
|
-import cn.iocoder.yudao.module.iscs.dal.dataobject.materialstype.MaterialsTypeDO;
|
|
|
|
|
-import cn.iocoder.yudao.module.iscs.service.materialstype.MaterialsTypeService;
|
|
|
|
|
-
|
|
|
|
|
-@Tag(name = "管理后台 - 物资类型")
|
|
|
|
|
-@RestController
|
|
|
|
|
-@RequestMapping("/iscs/materials-type")
|
|
|
|
|
-@Validated
|
|
|
|
|
-public class MaterialsTypeController {
|
|
|
|
|
-
|
|
|
|
|
- @Resource
|
|
|
|
|
- private MaterialsTypeService materialsTypeService;
|
|
|
|
|
-
|
|
|
|
|
- @PostMapping("/insertMaterialsType")
|
|
|
|
|
- @Operation(summary = "创建物资类型")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-type:create')")
|
|
|
|
|
- public CommonResult<Long> insertMaterialsType(@Valid @RequestBody MaterialsTypeSaveReqVO createReqVO) {
|
|
|
|
|
- return success(materialsTypeService.createMaterialsType(createReqVO));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @PutMapping("/updateMaterialsType")
|
|
|
|
|
- @Operation(summary = "更新物资类型")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-type:update')")
|
|
|
|
|
- public CommonResult<Boolean> updateMaterialsType(@Valid @RequestBody MaterialsTypeSaveReqVO updateReqVO) {
|
|
|
|
|
- materialsTypeService.updateMaterialsType(updateReqVO);
|
|
|
|
|
- return success(true);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @DeleteMapping("/deleteMaterialsTypeList")
|
|
|
|
|
- @Parameter(name = "ids", description = "编号", required = true)
|
|
|
|
|
- @Operation(summary = "批量删除物资类型")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-type:delete')")
|
|
|
|
|
- public CommonResult<Boolean> deleteMaterialsTypeList(@RequestParam("ids") List<Long> ids) {
|
|
|
|
|
- materialsTypeService.deleteMaterialsTypeListByIds(ids);
|
|
|
|
|
- return success(true);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/selectMaterialsTypeById")
|
|
|
|
|
- @Operation(summary = "获得物资类型")
|
|
|
|
|
- @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-type:query')")
|
|
|
|
|
- public CommonResult<MaterialsTypeRespVO> selectMaterialsTypeById(@RequestParam("id") Long id) {
|
|
|
|
|
- MaterialsTypeDO materialsType = materialsTypeService.getMaterialsType(id);
|
|
|
|
|
- return success(BeanUtils.toBean(materialsType, MaterialsTypeRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/getMaterialsTypePage")
|
|
|
|
|
- @Operation(summary = "获得物资类型分页")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-type:query')")
|
|
|
|
|
- public CommonResult<PageResult<MaterialsTypeRespVO>> getMaterialsTypePage(@Valid MaterialsTypePageReqVO pageReqVO) {
|
|
|
|
|
- PageResult<MaterialsTypeDO> pageResult = materialsTypeService.getMaterialsTypePage(pageReqVO);
|
|
|
|
|
- return success(BeanUtils.toBean(pageResult, MaterialsTypeRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @GetMapping("/exportMaterialsTypeExcel")
|
|
|
|
|
- @Operation(summary = "导出物资类型 Excel")
|
|
|
|
|
- @PreAuthorize("@ss.hasPermission('iscs:materials-type:export')")
|
|
|
|
|
- @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
- public void exportMaterialsTypeExcel(@Valid MaterialsTypePageReqVO pageReqVO,
|
|
|
|
|
- HttpServletResponse response) throws IOException {
|
|
|
|
|
- pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
- List<MaterialsTypeDO> list = materialsTypeService.getMaterialsTypePage(pageReqVO).getList();
|
|
|
|
|
- // 导出 Excel
|
|
|
|
|
- ExcelUtils.write(response, "物资类型.xls", "数据", MaterialsTypeRespVO.class,
|
|
|
|
|
- BeanUtils.toBean(list, MaterialsTypeRespVO.class));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-}
|
|
|
|
|
|
|
+package cn.iocoder.yudao.module.iscs.controller.admin.materialstype;
|
|
|
|
|
+
|
|
|
|
|
+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.materialstype.vo.*;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.dal.dataobject.materialstype.MaterialsTypeDO;
|
|
|
|
|
+import cn.iocoder.yudao.module.iscs.service.materialstype.MaterialsTypeService;
|
|
|
|
|
+
|
|
|
|
|
+@Tag(name = "管理后台 - 物资类型")
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/iscs/materials-type")
|
|
|
|
|
+@Validated
|
|
|
|
|
+public class MaterialsTypeController {
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private MaterialsTypeService materialsTypeService;
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping("/insertMaterialsType")
|
|
|
|
|
+ @Operation(summary = "创建物资类型")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-type:create')")
|
|
|
|
|
+ public CommonResult<Long> insertMaterialsType(@Valid @RequestBody MaterialsTypeSaveReqVO createReqVO) {
|
|
|
|
|
+ return success(materialsTypeService.createMaterialsType(createReqVO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PutMapping("/updateMaterialsType")
|
|
|
|
|
+ @Operation(summary = "更新物资类型")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-type:update')")
|
|
|
|
|
+ public CommonResult<Boolean> updateMaterialsType(@Valid @RequestBody MaterialsTypeSaveReqVO updateReqVO) {
|
|
|
|
|
+ materialsTypeService.updateMaterialsType(updateReqVO);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @DeleteMapping("/deleteMaterialsTypeList")
|
|
|
|
|
+ @Parameter(name = "ids", description = "编号", required = true)
|
|
|
|
|
+ @Operation(summary = "批量删除物资类型")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-type:delete')")
|
|
|
|
|
+ public CommonResult<Boolean> deleteMaterialsTypeList(@RequestParam("ids") List<Long> ids) {
|
|
|
|
|
+ materialsTypeService.deleteMaterialsTypeListByIds(ids);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/selectMaterialsTypeById")
|
|
|
|
|
+ @Operation(summary = "获得物资类型")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-type:query')")
|
|
|
|
|
+ public CommonResult<MaterialsTypeRespVO> selectMaterialsTypeById(@RequestParam("id") Long id) {
|
|
|
|
|
+ MaterialsTypeDO materialsType = materialsTypeService.getMaterialsType(id);
|
|
|
|
|
+ return success(BeanUtils.toBean(materialsType, MaterialsTypeRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/getMaterialsTypePage")
|
|
|
|
|
+ @Operation(summary = "获得物资类型分页")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-type:query')")
|
|
|
|
|
+ public CommonResult<PageResult<MaterialsTypeRespVO>> getMaterialsTypePage(@Valid MaterialsTypePageReqVO pageReqVO) {
|
|
|
|
|
+ PageResult<MaterialsTypeDO> pageResult = materialsTypeService.getMaterialsTypePage(pageReqVO);
|
|
|
|
|
+ return success(BeanUtils.toBean(pageResult, MaterialsTypeRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/exportMaterialsTypeExcel")
|
|
|
|
|
+ @Operation(summary = "导出物资类型 Excel")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-type:export')")
|
|
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
+ public void exportMaterialsTypeExcel(@Valid MaterialsTypePageReqVO pageReqVO,
|
|
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
+ List<MaterialsTypeDO> list = materialsTypeService.getMaterialsTypePage(pageReqVO).getList();
|
|
|
|
|
+ // 导出 Excel
|
|
|
|
|
+ ExcelUtils.write(response, "物资类型.xls", "数据", MaterialsTypeRespVO.class,
|
|
|
|
|
+ BeanUtils.toBean(list, MaterialsTypeRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|