|
|
@@ -0,0 +1,126 @@
|
|
|
+package com.ktg.iscs.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.ktg.common.annotation.Log;
|
|
|
+import com.ktg.common.core.controller.BaseController;
|
|
|
+import com.ktg.common.enums.BusinessType;
|
|
|
+import com.ktg.common.pojo.CommonResult;
|
|
|
+import com.ktg.common.utils.poi.ExcelUtil;
|
|
|
+import com.ktg.iscs.domain.IsMaterials;
|
|
|
+import com.ktg.iscs.domain.dto.materials.MaterialsPageDTO;
|
|
|
+import com.ktg.iscs.domain.vo.materials.LoanMaterialDTO;
|
|
|
+import com.ktg.iscs.domain.vo.materials.MaterialsPageVO;
|
|
|
+import com.ktg.iscs.service.IIsMaterialsService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.Parameters;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 物资Controller
|
|
|
+ *
|
|
|
+ * @author cgj
|
|
|
+ * @date 2024-11-08
|
|
|
+ */
|
|
|
+@Api(tags = "物资")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/iscs/materials")
|
|
|
+public class IsMaterialsController extends BaseController
|
|
|
+{
|
|
|
+ @Autowired
|
|
|
+ private IIsMaterialsService isMaterialsService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询物资分页
|
|
|
+ */
|
|
|
+ @ApiOperation("查询物资-分页")
|
|
|
+ @Parameters({
|
|
|
+ @Parameter(name = "page", description = "Page"),
|
|
|
+ @Parameter(name = "dto", description = "实体参数")
|
|
|
+ })
|
|
|
+ @PreAuthorize("@ss.hasPermi('iscs:materials:list')")
|
|
|
+ @GetMapping("/getIsMaterialsPage")
|
|
|
+ public CommonResult<Page<MaterialsPageVO>> getIsMaterialsPage(Page<IsMaterials> page, MaterialsPageDTO dto)
|
|
|
+ {
|
|
|
+ Page<MaterialsPageVO> result = isMaterialsService.getIsMaterialsPage(page, dto);
|
|
|
+ return CommonResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出物资列表
|
|
|
+ */
|
|
|
+ @ApiOperation("导出物资列表")
|
|
|
+ @Parameter(name = "isMaterials", description = "实体参数")
|
|
|
+ @PreAuthorize("@ss.hasPermi('iscs:materials:export')")
|
|
|
+ @Log(title = "物资", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/exportIsMaterials")
|
|
|
+ public void exportIsMaterials(HttpServletResponse response, IsMaterials isMaterials)
|
|
|
+ {
|
|
|
+ List<IsMaterials> list = isMaterialsService.selectIsMaterialsList(isMaterials);
|
|
|
+ ExcelUtil<IsMaterials> util = new ExcelUtil<IsMaterials>(IsMaterials.class);
|
|
|
+ util.exportExcel(response, list, "物资数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取物资详细信息
|
|
|
+ */
|
|
|
+ @ApiOperation("获取物资详细信息")
|
|
|
+ @Parameter(name = "materialsId", description = "materialsId")
|
|
|
+ @PreAuthorize("@ss.hasPermi('iscs:materials:query')")
|
|
|
+ @GetMapping(value = "/selectIsMaterialsById")
|
|
|
+ public CommonResult<IsMaterials> selectIsMaterialsById(Long materialsId)
|
|
|
+ {
|
|
|
+ return CommonResult.success(isMaterialsService.selectIsMaterialsByMaterialsId(materialsId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增物资
|
|
|
+ */
|
|
|
+ @ApiOperation("新增物资")
|
|
|
+ @PreAuthorize("@ss.hasPermi('iscs:materials:add')")
|
|
|
+ @Log(title = "物资", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping("/insertIsMaterials")
|
|
|
+ public CommonResult<Boolean> insertIsMaterials(@RequestBody @Parameter(name = "isMaterials", description = "新增数据类,放到body") IsMaterials isMaterials)
|
|
|
+ {
|
|
|
+ return CommonResult.success(isMaterialsService.insertIsMaterials(isMaterials) == 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改物资
|
|
|
+ */
|
|
|
+ @ApiOperation("修改物资")
|
|
|
+ @PreAuthorize("@ss.hasPermi('iscs:materials:edit')")
|
|
|
+ @Log(title = "物资", businessType = BusinessType.UPDATE)
|
|
|
+ @PostMapping("/updateIsMaterials")
|
|
|
+ public CommonResult<Boolean> updateIsMaterials(@RequestBody @Parameter(name = "isMaterials", description = "修改数据类,放到body") IsMaterials isMaterials)
|
|
|
+ {
|
|
|
+ return CommonResult.success(isMaterialsService.updateIsMaterials(isMaterials) == 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("借出/归还物资")
|
|
|
+ @PreAuthorize("@ss.hasPermi('iscs:materials:loan')")
|
|
|
+ @Log(title = "借出/归还物资", businessType = BusinessType.UPDATE)
|
|
|
+ @PostMapping("/updateIsMaterialById")
|
|
|
+ public CommonResult<Boolean> updateIsMaterialById(@RequestBody @Parameter(name = "isMaterials", description = "修改数据类,放到body") LoanMaterialDTO dto)
|
|
|
+ {
|
|
|
+ return CommonResult.success(isMaterialsService.updateIsMaterialById(dto));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除物资
|
|
|
+ */
|
|
|
+ @ApiOperation("删除物资")
|
|
|
+ @PreAuthorize("@ss.hasPermi('iscs:materials:remove')")
|
|
|
+ @Log(title = "物资", businessType = BusinessType.DELETE)
|
|
|
+ @PostMapping("/deleteIsMaterialsByMaterialsIds")
|
|
|
+ public CommonResult<Boolean> deleteIsMaterialsByMaterialsIds(String materialsIds)
|
|
|
+ {
|
|
|
+ return CommonResult.success(isMaterialsService.deleteIsMaterialsByMaterialsIds(materialsIds) != 0);
|
|
|
+ }
|
|
|
+}
|