From b0ba33dce8487581d2bb3c49f886d158724dc44e Mon Sep 17 00:00:00 2001
From: shiyunteng <shiyunteng@example.com>
Date: 星期一, 08 六月 2026 17:19:49 +0800
Subject: [PATCH] fix:产品列表接口

---
 platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ProductController.java |   63 +++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 1 deletions(-)

diff --git a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ProductController.java b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ProductController.java
index 4b74887..a56adf7 100644
--- a/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ProductController.java
+++ b/platformx-business-finance-biz/src/main/java/com/by4cloud/platformx/business/controller/ProductController.java
@@ -2,6 +2,7 @@
 
 import cn.hutool.core.util.ArrayUtil;
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -9,6 +10,7 @@
 import com.by4cloud.platformx.common.log.annotation.SysLog;
 import com.by4cloud.platformx.business.entity.Product;
 import com.by4cloud.platformx.business.service.ProductService;
+import com.by4cloud.platformx.common.security.annotation.Inner;
 import org.springframework.security.access.prepost.PreAuthorize;
 import com.by4cloud.platformx.common.excel.annotation.ResponseExcel;
 import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -48,7 +50,66 @@
     @PreAuthorize("@pms.hasPermission('business_product_view')" )
     public R getProductPage(@ParameterObject Page page, @ParameterObject Product product) {
         LambdaQueryWrapper<Product> wrapper = Wrappers.lambdaQuery();
-        return R.ok(productService.page(page, wrapper));
+        wrapper.eq(product.getParentId()!=null,Product::getParentId,product.getParentId());
+        wrapper.like(StrUtil.isNotEmpty(product.getProductName()),Product::getProductName,product.getProductName());
+        wrapper.like(StrUtil.isNotEmpty(product.getMainCode()),Product::getMainCode,product.getMainCode());
+        wrapper.like(StrUtil.isNotEmpty(product.getErpCode()),Product::getErpCode,product.getErpCode());
+		wrapper.orderByDesc(Product::getCreateTime);
+        Page<Product> page1 = productService.pageByScope(page, wrapper);
+        List<Product> list = page1.getRecords();
+        for(Product product1 : list){
+            Product  parent = productService.getById(product1.getParentId());
+            if(parent==null){
+                product1.setParentName("鏍圭骇浜у搧");
+            }else {
+                product1.setParentName(parent.getProductName());
+            }
+        }
+        page1.setRecords(list);
+        return R.ok(page1);
+    }
+
+    /**
+     * 鍒嗛〉鏌ヨ
+     * @param product 浜у搧淇℃伅
+     * @return
+     */
+    @Operation(summary = "鍒嗛〉鏌ヨ" , description = "鍒嗛〉鏌ヨ" )
+    @GetMapping("/list" )
+    @PreAuthorize("@pms.hasPermission('business_product_view')" )
+    @Inner(value = false)
+    public R getProductList(@ParameterObject Product product) {
+        return R.ok(productService.getProductList(product));
+    }
+
+    /**
+     * 鍒嗛〉鏌ヨ
+     * @param product 浜у搧淇℃伅
+     * @return
+     */
+    @Operation(summary = "鍒嗛〉鏌ヨ" , description = "鍒嗛〉鏌ヨ" )
+    @GetMapping("/listByParentId" )
+    @PreAuthorize("@pms.hasPermission('business_product_view')" )
+    //@Inner(value = false)
+    public R getProductListByParentId(@ParameterObject Product product) {
+        LambdaQueryWrapper<Product> wrapper = Wrappers.lambdaQuery();
+        wrapper.like(StrUtil.isNotEmpty(product.getProductName()),Product::getProductName,product.getProductName());
+        wrapper.eq(product.getParentId()!=null,Product::getParentId,product.getParentId());
+        wrapper.last("limit 30");
+        return R.ok(productService.listByScope(wrapper));
+    }
+
+    /**
+     * 灞傜骇鏌ヨ
+     * @param product 鍟嗗搧琛�
+     * @return
+     */
+    @Operation(summary = "灞傜骇鏌ヨ" , description = "灞傜骇鏌ヨ" )
+    @GetMapping("/treeList" )
+    //@PreAuthorize("@pms.hasPermission('business_product_view')" )
+    @Inner(value = false)
+    public R getNewsCategoryTree(@ParameterObject Product product) {
+        return R.ok(productService.treeList(product.getParentId(), product.getProductName()));
     }
 
 

--
Gitblit v1.9.1