From a76e1d17d67641993dea6335cb8e1465a94df58d Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期四, 21 五月 2026 15:39:05 +0800
Subject: [PATCH] feat(stock): 优化库存管理和成品树结构功能 1- 为ApproveProcessMapper.xml和ProductBomMapper.xml添加排序功能 2- 在ProductionProductMainDto中新增bomInputQty字段用于产品结构投入数量 3- 修改ProductionProductMainServiceImpl中投入数量计算逻辑,使用前端传入的bomInputQty值 4- 在ProductWorkOrderDto中添加bomInputQty字段并在服务实现中计算标准投入数量 5- 更新SalesLedgerMapper.xml查询逻辑,从product_summary获取电压信息 6- 为SalesLedgerProduct添加stockId字段并修改库存扣减逻辑使用具体库存ID 7- 重构StockInventoryController中的成品库存树查询接口和导入导出功能 8- 新增成品和非成品库存导入导出的数据模型和Excel工具类 9- 优化StockInventoryServiceImpl中的库存扣减逻辑,支持按特定库存ID操作 10- 更新库存导入导出功能,区分成品和非成品类型并提供相应模板

---
 src/main/java/com/ruoyi/framework/web/controller/BaseController.java |  111 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 88 insertions(+), 23 deletions(-)

diff --git a/src/main/java/com/ruoyi/framework/web/controller/BaseController.java b/src/main/java/com/ruoyi/framework/web/controller/BaseController.java
index 40724ba..5c6fe3e 100644
--- a/src/main/java/com/ruoyi/framework/web/controller/BaseController.java
+++ b/src/main/java/com/ruoyi/framework/web/controller/BaseController.java
@@ -11,8 +11,11 @@
 import com.github.pagehelper.PageInfo;
 import com.ruoyi.common.constant.HttpStatus;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.PageUtils;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.sql.SqlUtil;
+import com.ruoyi.framework.security.LoginUser;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.PageDomain;
 import com.ruoyi.framework.web.page.TableDataInfo;
@@ -49,14 +52,28 @@
      */
     protected void startPage()
     {
+        PageUtils.startPage();
+    }
+
+    /**
+     * 璁剧疆璇锋眰鎺掑簭鏁版嵁
+     */
+    protected void startOrderBy()
+    {
         PageDomain pageDomain = TableSupport.buildPageRequest();
-        Integer pageNum = pageDomain.getPageNum();
-        Integer pageSize = pageDomain.getPageSize();
-        if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize))
+        if (StringUtils.isNotEmpty(pageDomain.getOrderBy()))
         {
             String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
-            PageHelper.startPage(pageNum, pageSize, orderBy);
+            PageHelper.orderBy(orderBy);
         }
+    }
+
+    /**
+     * 娓呯悊鍒嗛〉鐨勭嚎绋嬪彉閲�
+     */
+    protected void clearPage()
+    {
+        PageUtils.clearPage();
     }
 
     /**
@@ -74,30 +91,11 @@
     }
 
     /**
-     * 鍝嶅簲杩斿洖缁撴灉
-     * 
-     * @param result 缁撴灉
-     * @return 鎿嶄綔缁撴灉
-     */
-    protected AjaxResult toAjax(boolean result)
-    {
-        return result ? success() : error();
-    }
-
-    /**
      * 杩斿洖鎴愬姛
      */
     public AjaxResult success()
     {
         return AjaxResult.success();
-    }
-
-    /**
-     * 杩斿洖澶辫触娑堟伅
-     */
-    public AjaxResult error()
-    {
-        return AjaxResult.error();
     }
 
     /**
@@ -109,11 +107,35 @@
     }
 
     /**
+     * 杩斿洖鎴愬姛娑堟伅
+     */
+    public AjaxResult success(Object data)
+    {
+        return AjaxResult.success(data);
+    }
+
+    /**
+     * 杩斿洖澶辫触娑堟伅
+     */
+    public AjaxResult error()
+    {
+        return AjaxResult.error();
+    }
+
+    /**
      * 杩斿洖澶辫触娑堟伅
      */
     public AjaxResult error(String message)
     {
         return AjaxResult.error(message);
+    }
+
+    /**
+     * 杩斿洖璀﹀憡娑堟伅
+     */
+    public AjaxResult warn(String message)
+    {
+        return AjaxResult.warn(message);
     }
 
     /**
@@ -126,4 +148,47 @@
     {
         return rows > 0 ? AjaxResult.success() : AjaxResult.error();
     }
+
+    /**
+     * 鍝嶅簲杩斿洖缁撴灉
+     * 
+     * @param result 缁撴灉
+     * @return 鎿嶄綔缁撴灉
+     */
+    protected AjaxResult toAjax(boolean result)
+    {
+        return result ? success() : error();
+    }
+
+    /**
+     * 鑾峰彇鐢ㄦ埛缂撳瓨淇℃伅
+     */
+    public LoginUser getLoginUser()
+    {
+        return SecurityUtils.getLoginUser();
+    }
+
+    /**
+     * 鑾峰彇鐧诲綍鐢ㄦ埛id
+     */
+    public Long getUserId()
+    {
+        return getLoginUser().getUserId();
+    }
+
+    /**
+     * 鑾峰彇鐧诲綍閮ㄩ棬id
+     */
+    public Long [] getDeptId()
+    {
+        return getLoginUser().getDeptIds();
+    }
+
+    /**
+     * 鑾峰彇鐧诲綍鐢ㄦ埛鍚�
+     */
+    public String getUsername()
+    {
+        return getLoginUser().getUsername();
+    }
 }

--
Gitblit v1.9.3