|
|
@@ -0,0 +1,95 @@
|
|
|
+package cn.iocoder.yudao.module.iscs.controller.admin.materialspropertyvalue;
|
|
|
+
|
|
|
+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.materialspropertyvalue.vo.*;
|
|
|
+import cn.iocoder.yudao.module.iscs.dal.dataobject.materialspropertyvalue.MaterialsPropertyValueDO;
|
|
|
+import cn.iocoder.yudao.module.iscs.service.materialspropertyvalue.MaterialsPropertyValueService;
|
|
|
+
|
|
|
+@Tag(name = "管理后台 - 物资属性值")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/iscs/materials-property-value")
|
|
|
+@Validated
|
|
|
+public class MaterialsPropertyValueController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private MaterialsPropertyValueService materialsPropertyValueService;
|
|
|
+
|
|
|
+ @PostMapping("/insertMaterialsPropertyValue")
|
|
|
+ @Operation(summary = "创建物资属性值")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-property-value:create')")
|
|
|
+ public CommonResult<Long> insertMaterialsPropertyValue(@Valid @RequestBody MaterialsPropertyValueSaveReqVO createReqVO) {
|
|
|
+ return success(materialsPropertyValueService.createMaterialsPropertyValue(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/updateMaterialsPropertyValue")
|
|
|
+ @Operation(summary = "更新物资属性值")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-property-value:update')")
|
|
|
+ public CommonResult<Boolean> updateMaterialsPropertyValue(@Valid @RequestBody MaterialsPropertyValueSaveReqVO updateReqVO) {
|
|
|
+ materialsPropertyValueService.updateMaterialsPropertyValue(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/deleteMaterialsPropertyValueList")
|
|
|
+ @Parameter(name = "ids", description = "编号", required = true)
|
|
|
+ @Operation(summary = "批量删除物资属性值")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-property-value:delete')")
|
|
|
+ public CommonResult<Boolean> deleteMaterialsPropertyValueList(@RequestParam("ids") List<Long> ids) {
|
|
|
+ materialsPropertyValueService.deleteMaterialsPropertyValueListByIds(ids);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/selectMaterialsPropertyValueById")
|
|
|
+ @Operation(summary = "获得物资属性值")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-property-value:query')")
|
|
|
+ public CommonResult<MaterialsPropertyValueRespVO> selectMaterialsPropertyValueById(@RequestParam("id") Long id) {
|
|
|
+ MaterialsPropertyValueDO materialsPropertyValue = materialsPropertyValueService.getMaterialsPropertyValue(id);
|
|
|
+ return success(BeanUtils.toBean(materialsPropertyValue, MaterialsPropertyValueRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/getMaterialsPropertyValuePage")
|
|
|
+ @Operation(summary = "获得物资属性值分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-property-value:query')")
|
|
|
+ public CommonResult<PageResult<MaterialsPropertyValueRespVO>> getMaterialsPropertyValuePage(@Valid MaterialsPropertyValuePageReqVO pageReqVO) {
|
|
|
+ PageResult<MaterialsPropertyValueDO> pageResult = materialsPropertyValueService.getMaterialsPropertyValuePage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, MaterialsPropertyValueRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/exportMaterialsPropertyValueExcel")
|
|
|
+ @Operation(summary = "导出物资属性值 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('iscs:materials-property-value:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportMaterialsPropertyValueExcel(@Valid MaterialsPropertyValuePageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<MaterialsPropertyValueDO> list = materialsPropertyValueService.getMaterialsPropertyValuePage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "物资属性值.xls", "数据", MaterialsPropertyValueRespVO.class,
|
|
|
+ BeanUtils.toBean(list, MaterialsPropertyValueRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|