From 13afb7eafeffac6ecccc7c66d36974c54c5172d4 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 28 五月 2026 15:13:37 +0800
Subject: [PATCH] 库存管理增加库存类型,并返回相关数据显示
---
src/main/java/com/ruoyi/stock/controller/ManufacturerController.java | 149 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 149 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/ruoyi/stock/controller/ManufacturerController.java b/src/main/java/com/ruoyi/stock/controller/ManufacturerController.java
new file mode 100644
index 0000000..9fd4e3a
--- /dev/null
+++ b/src/main/java/com/ruoyi/stock/controller/ManufacturerController.java
@@ -0,0 +1,149 @@
+package com.ruoyi.stock.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.web.domain.R;
+import com.ruoyi.stock.dto.ManufacturerDto;
+import com.ruoyi.stock.execl.ManufacturerExcelDto;
+import com.ruoyi.stock.pojo.Manufacturer;
+import com.ruoyi.stock.service.ManufacturerService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 鍘傚鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-05-28 09:52:35
+ */
+@RestController
+@RequestMapping("/stock/manufacturer")
+@AllArgsConstructor
+@Tag(name = "鍘傚绠$悊")
+public class ManufacturerController {
+
+ private ManufacturerService manufacturerService;
+
+ /**
+ * 鍘傚鏂板
+ * @param manufacturer
+ * @return
+ */
+ @PostMapping("/add")
+ @Log(title = "鍘傚-鏂板", businessType = BusinessType.INSERT)
+ @Operation(summary = "鏂板鍘傚")
+ public R add(@RequestBody Manufacturer manufacturer) {
+ manufacturerService.saveManufacturer(manufacturer);
+ return R.ok();
+ }
+
+ /**
+ * 鍘傚鍒犻櫎
+ * @param ids
+ * @return
+ */
+ @DeleteMapping("/del")
+ @Log(title = "鍘傚-鍒犻櫎", businessType = BusinessType.DELETE)
+ @Operation(summary = "鍒犻櫎鍘傚")
+ public R delManufacturer(@RequestBody List<Long> ids) {
+ if(CollectionUtils.isEmpty(ids)){
+ return R.fail("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
+ }
+ manufacturerService.delManufacturer(ids);
+ return R.ok();
+ }
+
+ /**
+ * 鍘傚璇︽儏
+ * @param id
+ * @return
+ */
+ @GetMapping("/{id}")
+ @Log(title = "鍘傚-璇︽儏", businessType = BusinessType.OTHER)
+ @Operation(summary = "鍘傚璇︽儏")
+ public R manufacturerDetail(@PathVariable("id") Long id) {
+ return R.ok(manufacturerService.manufacturerDetail(id));
+ }
+
+ /**
+ * 鍘傚淇敼
+ * @param manufacturer
+ * @return
+ */
+ @PostMapping("/update")
+ @Log(title = "鍘傚-淇敼", businessType = BusinessType.UPDATE)
+ @Operation(summary = "淇敼鍘傚")
+ public R update(@RequestBody Manufacturer manufacturer) {
+ manufacturerService.manufacturerUpdate(manufacturer);
+ return R.ok();
+ }
+
+ /**
+ * 鍘傚绠$悊鍒嗛〉鏌ヨ
+ * @param page
+ * @param manufacturerDto
+ * @return
+ */
+ @GetMapping("/listPage")
+ @Log(title = "鍘傚-鍒嗛〉鏌ヨ", businessType = BusinessType.OTHER)
+ @Operation(summary = "鍘傚鍒嗛〉鏌ヨ")
+ public R manufacturerListPage(Page page, ManufacturerDto manufacturerDto) {
+ return R.ok(manufacturerService.manufacturerListPage(page, manufacturerDto));
+ }
+
+ /**
+ * 鍘傚瀵煎嚭
+ * @param response
+ * @param manufacturerDto
+ */
+ @PostMapping("/export")
+ @Log(title = "鍘傚-瀵煎嚭", businessType = BusinessType.EXPORT)
+ @Operation(summary = "鍘傚瀵煎嚭")
+ public void manufacturerExport(HttpServletResponse response, ManufacturerDto manufacturerDto) {
+ manufacturerService.manufacturerExport(response, manufacturerDto);
+ }
+
+ /**
+ * 涓嬭浇妯℃澘
+ * @param response
+ */
+ @PostMapping("/downloadTemplate")
+ @Log(title = "鍘傚-涓嬭浇妯℃澘", businessType = BusinessType.EXPORT)
+ @Operation(summary = "涓嬭浇鍘傚妯℃澘")
+ public void downloadTemplate(HttpServletResponse response) {
+ ExcelUtil<ManufacturerExcelDto> util = new ExcelUtil<>(ManufacturerExcelDto.class);
+ util.importTemplateExcel(response, "鍘傚妗f妯℃澘");
+ }
+
+ /**
+ * 鍘傚瀵煎叆
+ */
+ @PostMapping("/import")
+ @Log(title = "鍘傚-瀵煎叆", businessType = BusinessType.IMPORT)
+ @Operation(summary = "瀵煎叆鍘傚")
+ public R importData(MultipartFile file) {
+ return manufacturerService.importData(file);
+ }
+
+ /**
+ * 鍘傚閫夐」鎺ュ彛
+ * @return
+ */
+ @GetMapping("/getOptions")
+ @Log(title = "鍘傚-閫夐」鎺ュ彛", businessType = BusinessType.OTHER)
+ @Operation(summary = "鑾峰彇鍘傚閫夐」")
+ public R getOptions() {
+ return R.ok(manufacturerService.list());
+ }
+}
--
Gitblit v1.9.3