Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

Lijingyang 1 месяц назад
Родитель
Сommit
b5904ecccb

+ 33 - 18
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/controller/pc/PcOrderController.java

@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.time.LocalDate;
+import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -279,25 +280,37 @@ public class PcOrderController extends BaseController {
 
             // 设置订单商品列表
             // mainBo.setOrderProductBos(bo.getOrderProductBos());
+            Map<Long, Long> productNumMap;
             // 1. 获取购物车项
-            Set<Long> productShoppingCartIds = bo.getProductShoppingCartId();
-            if (productShoppingCartIds == null || productShoppingCartIds.isEmpty()) {
-                throw new IllegalArgumentException("购物车项ID不能为空");
-            }
-
-            List<RemoteProductShoppingCartVo> shoppingCartList = remoteProductShoppingCartService.getShoppingCartList(productShoppingCartIds);
-            if (shoppingCartList.isEmpty()) {
-                throw new IllegalStateException("购物车数据不存在");
+            if (bo.getPlaceOrderType() == 1) {
+                Set<Long> productShoppingCartIds = bo.getProductShoppingCartId();
+                if (productShoppingCartIds == null || productShoppingCartIds.isEmpty()) {
+                    throw new IllegalArgumentException("购物车项ID不能为空");
+                }
+
+                List<RemoteProductShoppingCartVo> shoppingCartList = remoteProductShoppingCartService.getShoppingCartList(productShoppingCartIds);
+                if (shoppingCartList.isEmpty()) {
+                    throw new IllegalStateException("购物车数据不存在");
+                }
+
+                // 2. 构建 productId -> productNum 映射(防御性:过滤 null key)
+                productNumMap = shoppingCartList.stream()
+                    .filter(item -> item.getProductId() != null && item.getProductNum() != null)
+                    .collect(Collectors.toMap(
+                        RemoteProductShoppingCartVo::getProductId,
+                        RemoteProductShoppingCartVo::getProductNum,
+                        (existing, replacement) -> existing // 防止重复 key 冲突(理论上不应发生)
+                    ));
+            } else {
+                productNumMap = bo.getProductInfo().stream()
+                    .filter(item -> item.getProductId() != null && item.getProductNum() != null)
+                    .collect(Collectors.toMap(
+                        PcSubmitOrderBo.PcOrderProduct::getProductId,
+                        PcSubmitOrderBo.PcOrderProduct::getProductNum,
+                        (existing, replacement) -> existing // 防止重复 key 冲突(理论上不应发生)
+                    ));
             }
 
-            // 2. 构建 productId -> productNum 映射(防御性:过滤 null key)
-            Map<Long, Long> productNumMap = shoppingCartList.stream()
-                .filter(item -> item.getProductId() != null && item.getProductNum() != null)
-                .collect(Collectors.toMap(
-                    RemoteProductShoppingCartVo::getProductId,
-                    RemoteProductShoppingCartVo::getProductNum,
-                    (existing, replacement) -> existing // 防止重复 key 冲突(理论上不应发生)
-                ));
 
             // 3. 提取所有商品 ID(使用 List/Collection,而非拼接字符串!)
             List<Long> productIds = new ArrayList<>(productNumMap.keySet());
@@ -344,8 +357,10 @@ public class PcOrderController extends BaseController {
             if (orderId != null && orderId > 0) {
                 //初始化审批流程
                 orderCustomerFlowService.initOrderFlow(orderId);
-                // 成功下单后,删除对应的购物车项
-                remoteProductShoppingCartService.deleteWithValidByIds(productShoppingCartIds);
+                if (bo.getPlaceOrderType() == 1) {
+                    // 成功下单后,删除对应的购物车项
+                    remoteProductShoppingCartService.deleteWithValidByIds(bo.getProductShoppingCartId());
+                }
             } else {
                 throw new RuntimeException("订单创建失败");
             }

+ 29 - 0
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/domain/bo/PcSubmitOrderBo.java

@@ -4,6 +4,7 @@ import jakarta.validation.constraints.NotNull;
 import lombok.Data;
 
 import java.math.BigDecimal;
+import java.util.List;
 import java.util.Set;
 
 @Data
@@ -44,8 +45,36 @@ public class PcSubmitOrderBo {
      */
     private BigDecimal shippingFee;
 
+    /**
+    * 下单方式  1为购物车下单  2为直接下单
+    * */
+    private Integer placeOrderType;
+
     /**
      * 购物车项id
      */
     private Set<Long> productShoppingCartId;
+
+    /**
+    * 商品信息
+    * */
+    private List<PcOrderProduct> productInfo;
+
+
+    @Data
+    public class PcOrderProduct {
+        /**
+         * 商品ID
+         */
+        @NotNull(message = "商品ID不能为空")
+        private Long productId;
+
+        /**
+         * 商品数量
+         */
+        @NotNull(message = "商品数量不能为空")
+        private Long productNum;
+     }
 }
+
+

+ 1 - 0
ruoyi-modules/ruoyi-order/src/main/java/org/dromara/order/service/impl/OrderMainServiceImpl.java

@@ -575,6 +575,7 @@ public class OrderMainServiceImpl extends ServiceImpl<OrderMainMapper, OrderMain
         }
         OrderMain order = new OrderMain();
         order.setId(orderId);
+        order.setPayType(payType);
         order.setOrderStatus(OrderStatus.PENDING_CONFIRMATION.getCode());
         Boolean result = baseMapper.updateById(order) > 0;
         if (!result) {

+ 4 - 0
ruoyi-modules/ruoyi-product/src/main/java/org/dromara/product/domain/bo/PcProductBo.java

@@ -15,6 +15,10 @@ public class PcProductBo {
      * */
     private String searchKeyword;
     /**
+    * 商品编号
+    * */
+    private String productNo;
+    /**
     * 客户id
     * */
     private Long customerId;

+ 30 - 1
ruoyi-modules/ruoyi-product/src/main/java/org/dromara/product/domain/vo/ProductSpecialLinkVo.java

@@ -10,6 +10,7 @@ import lombok.Data;
 
 import java.io.Serial;
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 
 
@@ -29,7 +30,7 @@ public class ProductSpecialLinkVo implements Serializable {
     private static final long serialVersionUID = 1L;
 
     /**
-     * 
+     *
      */
     @ExcelProperty(value = "")
     private Long id;
@@ -59,5 +60,33 @@ public class ProductSpecialLinkVo implements Serializable {
     @ExcelProperty(value = "备注")
     private String remark;
 
+    /**
+     * 产品图片URL
+     */
+    private String productImage;
+
+    /**
+     * 产品名称
+     */
+    private String itemName;
+
+    /**
+     * 市场价
+     * */
+    @ExcelProperty(value = "市场价")
+    private BigDecimal marketPrice;
+
+    /**
+     * 平台价
+     */
+    private BigDecimal minSellingPrice;
+
+    /**
+     * 总库存
+     * */
+    private Long totalInventory;
+
+
+
 
 }

+ 4 - 0
ruoyi-modules/ruoyi-product/src/main/java/org/dromara/product/service/impl/ProductBaseServiceImpl.java

@@ -490,6 +490,9 @@ public class ProductBaseServiceImpl extends ServiceImpl<ProductBaseMapper, Produ
         LambdaEsQueryWrapper<ProductBaseVo> wrapper = new LambdaEsQueryWrapper<ProductBaseVo>()
             .eq(ProductBaseVo::getProductStatus, 1);
 
+        if(ObjectUtil.isNotEmpty(bo.getProductNo())){
+            wrapper.eq(ProductBaseVo::getProductNo, bo.getProductNo());
+        }
         if (ObjectUtil.isNotEmpty(bo.getBrandId())) {
             wrapper.eq(ProductBaseVo::getBrandId, bo.getBrandId());
         }
@@ -1443,6 +1446,7 @@ public class ProductBaseServiceImpl extends ServiceImpl<ProductBaseMapper, Produ
                 .or().like("br.brand_name", bo.getSearchKeyword())
             )
         );
+        lqw.like(StringUtils.isNotBlank(bo.getProductNo()), "b.product_no", bo.getProductNo());
         lqw.eq(ObjectUtil.isNotEmpty(bo.getBrandId()), "b.brand_id", bo.getBrandId());
         lqw.eq(ObjectUtil.isNotEmpty(bo.getTopCategoryId()), "b.top_category_id", bo.getTopCategoryId());
         lqw.eq(ObjectUtil.isNotEmpty(bo.getMiddleCategoryId()), "b.middle_category_id", bo.getMiddleCategoryId());

+ 22 - 0
ruoyi-modules/ruoyi-product/src/main/java/org/dromara/product/service/impl/ProductSpecialLinkServiceImpl.java

@@ -10,6 +10,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.dromara.product.domain.ProductBase;
+import org.dromara.product.domain.ProductPriceInventory;
+import org.dromara.product.domain.vo.ProductBaseVo;
+import org.dromara.product.mapper.ProductBaseMapper;
+import org.dromara.product.mapper.ProductPriceInventoryMapper;
 import org.springframework.stereotype.Service;
 import org.dromara.product.domain.bo.ProductSpecialLinkBo;
 import org.dromara.product.domain.vo.ProductSpecialLinkVo;
@@ -34,6 +39,10 @@ public class ProductSpecialLinkServiceImpl  extends ServiceImpl<ProductSpecialLi
 
     private final ProductSpecialLinkMapper baseMapper;
 
+    private final ProductBaseMapper productBaseMapper;
+
+    private final ProductPriceInventoryMapper priceInventoryMapper;
+
     /**
      * 查询特价商品
      *
@@ -56,6 +65,19 @@ public class ProductSpecialLinkServiceImpl  extends ServiceImpl<ProductSpecialLi
     public TableDataInfo<ProductSpecialLinkVo> queryPageList(ProductSpecialLinkBo bo, PageQuery pageQuery) {
         LambdaQueryWrapper<ProductSpecialLink> lqw = buildQueryWrapper(bo);
         Page<ProductSpecialLinkVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        result.getRecords().forEach(item -> {
+            ProductBase productBase = productBaseMapper.selectById(item.getProductId());
+            ProductPriceInventory productPriceInventory = priceInventoryMapper.selectById(item.getProductId());
+            if (productPriceInventory != null){
+                item.setMarketPrice(productPriceInventory.getMarketPrice());
+                item.setTotalInventory(productPriceInventory.getTotalInventory());
+                item.setMinSellingPrice(productPriceInventory.getMinSellingPrice());
+            }
+            if (productBase != null){
+                item.setProductImage(productBase.getProductImage());
+                item.setItemName(productBase.getItemName());
+            }
+        });
         return TableDataInfo.build(result);
     }
 

+ 168 - 166
ruoyi-modules/ruoyi-product/src/main/resources/mapper/product/ProductBaseMapper.xml

@@ -1,38 +1,38 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.dromara.product.mapper.ProductBaseMapper">
 
     <!-- 站点产品列表查询(联表查询) -->
     <select id="selectSiteProductPage" resultType="org.dromara.product.domain.vo.SiteProductVo">
         SELECT
-        b.id,
-        b.product_no AS productNo,
-        b.item_name AS productName,
-        b.product_image AS productImage,
-        b.is_self AS isSelf,
-        b.product_review_status AS productReviewStatus,
-        b.product_status AS productStatus,
-        p.market_price AS marketPrice,
-        p.member_price AS memberPrice,
-        p.min_selling_price AS minSellingPrice,
-        p.purchasing_price AS purchasingPrice,
-        p.max_purchase_price AS maxPurchasePrice,
-        p.total_inventory AS totalInventory,
-        p.now_inventory AS nowInventory,
-        p.virtual_inventory AS virtualInventory,
-        p.min_order_quantity AS minOrderQuantity,
-        b.brand_id AS brandId,
-        br.brand_name AS brandName,
-        b.top_category_id AS topCategoryId,
-        tc.category_name AS topCategoryName,
-        b.medium_category_id AS mediumCategoryId,
-        mc.category_name AS mediumCategoryName,
-        b.bottom_category_id AS bottomCategoryId,
-        bc.category_name AS bottomCategoryName,
-        GROUP_CONCAT(DISTINCT gcl.category_name) AS giftCategoryName,
-        b.remark
+            b.id,
+            b.product_no AS productNo,
+            b.item_name AS productName,
+            b.product_image AS productImage,
+            b.is_self AS isSelf,
+            b.product_review_status AS productReviewStatus,
+            b.product_status AS productStatus,
+            p.market_price AS marketPrice,
+            p.member_price AS memberPrice,
+            p.min_selling_price AS minSellingPrice,
+            p.purchasing_price AS purchasingPrice,
+            p.max_purchase_price AS maxPurchasePrice,
+            p.total_inventory AS totalInventory,
+            p.now_inventory AS nowInventory,
+            p.virtual_inventory AS virtualInventory,
+            p.min_order_quantity AS minOrderQuantity,
+            b.brand_id AS brandId,
+            br.brand_name AS brandName,
+            b.top_category_id AS topCategoryId,
+            tc.category_name AS topCategoryName,
+            b.medium_category_id AS mediumCategoryId,
+            mc.category_name AS mediumCategoryName,
+            b.bottom_category_id AS bottomCategoryId,
+            bc.category_name AS bottomCategoryName,
+            GROUP_CONCAT(DISTINCT gcl.category_name) AS giftCategoryName,
+            b.remark
         FROM product_base b
         LEFT JOIN product_price_inventory p ON b.id = p.product_id AND p.del_flag = '0'
         LEFT JOIN product_brand br ON b.brand_id = br.id AND br.del_flag = '0'
@@ -43,8 +43,7 @@
         <where>
             b.del_flag = '0'
             <if test="bo.keyword != null and bo.keyword != ''">
-                AND (b.product_no LIKE CONCAT('%', #{bo.keyword}, '%') OR b.item_name LIKE CONCAT('%', #{bo.keyword},
-                '%'))
+                AND (b.product_no LIKE CONCAT('%', #{bo.keyword}, '%') OR b.item_name LIKE CONCAT('%', #{bo.keyword}, '%'))
             </if>
             <if test="bo.brandId != null">
                 AND b.brand_id = #{bo.brandId}
@@ -69,32 +68,32 @@
             </if>
         </where>
         GROUP BY b.id, b.product_no, b.item_name, b.product_image, b.is_self,
-        b.product_review_status, b.product_status, b.brand_id,
-        b.top_category_id, b.medium_category_id, b.bottom_category_id, b.remark,
-        p.market_price, p.member_price, p.min_selling_price, p.purchasing_price,
-        p.max_purchase_price, p.total_inventory, p.now_inventory, p.virtual_inventory,
-        p.min_order_quantity, br.brand_name, tc.category_name, mc.category_name, bc.category_name
+                 b.product_review_status, b.product_status, b.brand_id,
+                 b.top_category_id, b.medium_category_id, b.bottom_category_id, b.remark,
+                 p.market_price, p.member_price, p.min_selling_price, p.purchasing_price,
+                 p.max_purchase_price, p.total_inventory, p.now_inventory, p.virtual_inventory,
+                 p.min_order_quantity, br.brand_name, tc.category_name, mc.category_name, bc.category_name
         ORDER BY b.create_time DESC
     </select>
 
     <!-- 推荐商品列表查询(联表查询分类名称) -->
     <select id="selectRecommendProductPage" resultType="org.dromara.product.domain.vo.RecommendProductVo">
         SELECT
-        b.id,
-        b.product_no AS productNo,
-        b.item_name AS itemName,
-        b.product_image AS productImage,
-        tc.category_name AS topCategoryName,
-        mc.category_name AS mediumCategoryName,
-        bc.category_name AS bottomCategoryName,
-        b.product_status AS productStatus,
-        b.home_recommended AS homeRecommended,
-        b.category_recommendation AS categoryRecommendation,
-        b.cart_recommendation AS cartRecommendation,
-        b.is_popular AS isPopular,
-        b.recommended_product_order AS recommendedProductOrder,
-        p.market_price AS marketPrice,
-        p.min_selling_price AS minSellingPrice
+            b.id,
+            b.product_no AS productNo,
+            b.item_name AS itemName,
+            b.product_image AS productImage,
+            tc.category_name AS topCategoryName,
+            mc.category_name AS mediumCategoryName,
+            bc.category_name AS bottomCategoryName,
+            b.product_status AS productStatus,
+            b.home_recommended AS homeRecommended,
+            b.category_recommendation AS categoryRecommendation,
+            b.cart_recommendation AS cartRecommendation,
+            b.is_popular AS isPopular,
+            b.recommended_product_order AS recommendedProductOrder,
+            p.market_price AS marketPrice,
+            p.min_selling_price AS minSellingPrice
         FROM product_base b
         LEFT JOIN product_price_inventory p ON b.id = p.product_id AND p.del_flag = '0'
         LEFT JOIN product_category tc ON b.top_category_id = tc.id AND tc.del_flag = '0'
@@ -139,27 +138,27 @@
     <!-- 商品运营列表查询(联表查询) -->
     <select id="selectProductOperationPage" resultType="org.dromara.product.domain.vo.ProductOperationVo">
         SELECT
-        b.id,
-        b.product_no AS productNo,
-        b.item_name AS itemName,
-        b.product_image AS productImage,
-        b.brand_id AS brandId,
-        br.brand_name AS brandName,
-        b.top_category_id AS topCategoryId,
-        tc.category_name AS topCategoryName,
-        b.medium_category_id AS mediumCategoryId,
-        mc.category_name AS mediumCategoryName,
-        b.bottom_category_id AS bottomCategoryId,
-        bc.category_name AS bottomCategoryName,
-        u.unit_name AS unitName,
-        p.min_order_quantity AS minOrderQuantity,
-        p.market_price AS marketPrice,
-        p.member_price AS memberPrice,
-        p.min_selling_price AS minSellingPrice,
-        p.total_inventory AS totalInventory,
-        p.now_inventory AS nowInventory,
-        p.virtual_inventory AS virtualInventory,
-        b.product_status AS productStatus
+            b.id,
+            b.product_no AS productNo,
+            b.item_name AS itemName,
+            b.product_image AS productImage,
+            b.brand_id AS brandId,
+            br.brand_name AS brandName,
+            b.top_category_id AS topCategoryId,
+            tc.category_name AS topCategoryName,
+            b.medium_category_id AS mediumCategoryId,
+            mc.category_name AS mediumCategoryName,
+            b.bottom_category_id AS bottomCategoryId,
+            bc.category_name AS bottomCategoryName,
+            u.unit_name AS unitName,
+            p.min_order_quantity AS minOrderQuantity,
+            p.market_price AS marketPrice,
+            p.member_price AS memberPrice,
+            p.min_selling_price AS minSellingPrice,
+            p.total_inventory AS totalInventory,
+            p.now_inventory AS nowInventory,
+            p.virtual_inventory AS virtualInventory,
+            b.product_status AS productStatus
         FROM product_base b
         LEFT JOIN product_price_inventory p ON b.id = p.product_id AND p.del_flag = '0'
         LEFT JOIN product_brand br ON b.brand_id = br.id AND br.del_flag = '0'
@@ -197,25 +196,25 @@
     <!-- 商品简化列表查询(用于选择弹窗) -->
     <select id="selectSimplePage" resultType="org.dromara.product.domain.vo.ProductBaseSimpleVo">
         SELECT
-        b.id,
-        b.product_no AS productNo,
-        b.item_name AS itemName,
-        b.product_image AS productImage,
-        p.market_price AS marketPrice,
-        p.member_price AS memberPrice,
-        e.specifications_code AS specification,
-        b.top_category_id AS topCategoryId,
-        tc.category_name AS topCategoryName,
-        b.medium_category_id AS mediumCategoryId,
-        mc.category_name AS mediumCategoryName,
-        b.bottom_category_id AS bottomCategoryId,
-        bc.category_name AS bottomCategoryName,
-        b.home_recommended AS homeRecommended,
-        b.category_recommendation AS categoryRecommendation,
-        b.cart_recommendation AS cartRecommendation,
-        b.recommended_product_order AS recommendedProductOrder,
-        b.is_popular AS isPopular,
-        b.product_status AS productStatus
+            b.id,
+            b.product_no AS productNo,
+            b.item_name AS itemName,
+            b.product_image AS productImage,
+            p.market_price AS marketPrice,
+            p.member_price AS memberPrice,
+            e.specifications_code AS specification,
+            b.top_category_id AS topCategoryId,
+            tc.category_name AS topCategoryName,
+            b.medium_category_id AS mediumCategoryId,
+            mc.category_name AS mediumCategoryName,
+            b.bottom_category_id AS bottomCategoryId,
+            bc.category_name AS bottomCategoryName,
+            b.home_recommended AS homeRecommended,
+            b.category_recommendation AS categoryRecommendation,
+            b.cart_recommendation AS cartRecommendation,
+            b.recommended_product_order AS recommendedProductOrder,
+            b.is_popular AS isPopular,
+            b.product_status AS productStatus
         FROM product_base b
         LEFT JOIN product_price_inventory p ON b.id = p.product_id AND p.del_flag = '0'
         LEFT JOIN product_extend e ON b.id = e.product_id AND e.del_flag = '0'
@@ -246,91 +245,94 @@
         ORDER BY b.create_time DESC
     </select>
     <select id="selectAllList" resultType="org.dromara.product.domain.vo.ProductBaseVo">
-        SELECT b.id,
-               b.product_no                AS productNo,
-               b.item_name                 AS itemName,
-               b.brand_id                  AS brandId,
-               br.brand_name               AS brandName,
-               b.top_category_id           AS topCategoryId,
-               tc.category_name            AS topCategoryName,
-               b.medium_category_id        AS mediumCategoryId,
-               mc.category_name            AS mediumCategoryName,
-               b.bottom_category_id        AS bottomCategoryId,
-               bc.category_name            AS bottomCategoryName,
-               bc.category_name            AS categoryName,
-               b.unit_id                   AS unitId,
-               u.unit_name                 AS unitName,
-               b.product_image             AS productImage,
-               b.is_self                   AS isSelf,
-               b.product_review_status     AS productReviewStatus,
-               b.home_recommended          AS homeRecommended,
-               b.category_recommendation   AS categoryRecommendation,
-               b.cart_recommendation       AS cartRecommendation,
-               b.recommended_product_order AS recommendedProductOrder,
-               b.is_popular                AS isPopular,
-               b.is_new                    AS isNew,
-               b.product_status            AS productStatus,
-               b.data_source               AS dataSource,
-               b.remark,
-
-               -- 扩展表字段
-               e.invoice_name              AS invoiceName,
-               e.invoice_specs             AS invoiceSpec,
-               e.bar_coding                AS upcBarcode,
-               e.product_weight            AS weight,
-               e.weight_unit               AS weightUnit,
-               e.product_volume            AS volume,
-               e.volume_unit               AS volumeUnit,
-               e.after_sales_service       AS afterSalesService,
-               e.service_guarantee         AS serviceGuarantee,
-               e.is_install_service        AS freeInstallation,
-               e.reference_link            AS referenceLink,
-               e.sales_volume              AS salesVolume,
-               e.is_customize              AS customizable,
-               e.custom_description        AS customDescription,
-               e.review_comments           AS reviewComments,
-               -- 价格库存表字段
-               p.market_price              AS marketPrice,
-               p.member_price              AS memberPrice,
-               p.min_selling_price         AS minSellingPrice,
-               p.purchasing_price          AS purchasingPrice,
-               p.market_price              AS midRangePrice,
-               p.member_price              AS standardPrice,
-               p.min_selling_price         AS certificatePrice,
-               p.purchasing_price          AS purchasePrice,
-               p.max_purchase_price        AS estimatedPurchasePrice,
-               p.tax_rate                  AS taxRate,
-               p.currency,
-               p.min_order_quantity        AS minOrderQuantity,
-               p.total_inventory           AS totalInventory,
-               p.now_inventory             AS nowInventory,
-               p.virtual_inventory         AS virtualInventory,
-               -- 属性分类表字段
-               c.attributes_list           AS attributesList
+        SELECT
+            b.id,
+            b.product_no AS productNo,
+            b.item_name AS itemName,
+            b.brand_id AS brandId,
+            br.brand_name AS brandName,
+            b.top_category_id AS topCategoryId,
+            tc.category_name AS topCategoryName,
+            b.medium_category_id AS mediumCategoryId,
+            mc.category_name AS mediumCategoryName,
+            b.bottom_category_id AS bottomCategoryId,
+            bc.category_name AS bottomCategoryName,
+            bc.category_name AS categoryName,
+            b.unit_id AS unitId,
+            u.unit_name AS unitName,
+            b.product_image AS productImage,
+            b.is_self AS isSelf,
+            b.product_review_status AS productReviewStatus,
+            b.home_recommended AS homeRecommended,
+            b.category_recommendation AS categoryRecommendation,
+            b.cart_recommendation AS cartRecommendation,
+            b.recommended_product_order AS recommendedProductOrder,
+            b.is_popular AS isPopular,
+            b.is_new AS isNew,
+            b.product_status AS productStatus,
+            b.data_source AS dataSource,
+            b.remark,
+            -- 扩展表字段
+            e.is_customize AS isCustomize,
+            e.invoice_name AS invoiceName,
+            e.invoice_specs AS invoiceSpec,
+            e.bar_coding AS upcBarcode,
+            e.product_weight AS weight,
+            e.weight_unit AS weightUnit,
+            e.product_volume AS volume,
+            e.volume_unit AS volumeUnit,
+            e.after_sales_service AS afterSalesService,
+            e.service_guarantee AS serviceGuarantee,
+            e.is_install_service AS freeInstallation,
+            e.reference_link AS referenceLink,
+            e.sales_volume AS salesVolume,
+            e.is_customize AS customizable,
+            e.custom_description AS customDescription,
+            e.review_comments AS reviewComments,
+            -- 价格库存表字段
+            p.market_price AS marketPrice,
+            p.member_price AS memberPrice,
+            p.min_selling_price AS minSellingPrice,
+            p.purchasing_price AS purchasingPrice,
+            p.market_price AS midRangePrice,
+            p.member_price AS standardPrice,
+            p.min_selling_price AS certificatePrice,
+            p.purchasing_price AS purchasePrice,
+            p.max_purchase_price AS estimatedPurchasePrice,
+            p.tax_rate AS taxRate,
+            p.currency,
+            p.min_order_quantity AS minOrderQuantity,
+            p.total_inventory AS totalInventory,
+            p.now_inventory AS nowInventory,
+            p.virtual_inventory AS virtualInventory,
+            -- 属性分类表字段
+            c.attributes_list AS attributesList
         FROM product_base b
-                 LEFT JOIN product_extend e ON b.id = e.product_id AND e.del_flag = '0'
-                 LEFT JOIN product_price_inventory p ON b.id = p.product_id AND p.del_flag = '0'
-                 LEFT JOIN product_classification c ON b.id = c.product_id AND c.del_flag = '0'
-                 LEFT JOIN product_brand br ON b.brand_id = br.id AND br.del_flag = '0'
-                 LEFT JOIN product_category tc ON b.top_category_id = tc.id AND tc.del_flag = '0'
-                 LEFT JOIN product_category mc ON b.medium_category_id = mc.id AND mc.del_flag = '0'
-                 LEFT JOIN product_category bc ON b.bottom_category_id = bc.id AND bc.del_flag = '0'
-                 LEFT JOIN product_unit u ON b.unit_id = u.id AND u.del_flag = '0' ${ew.customSqlSegment}
+        LEFT JOIN product_extend e ON b.id = e.product_id AND e.del_flag = '0'
+        LEFT JOIN product_price_inventory p ON b.id = p.product_id AND p.del_flag = '0'
+        LEFT JOIN product_classification c ON b.id = c.product_id AND c.del_flag = '0'
+        LEFT JOIN product_brand br ON b.brand_id = br.id AND br.del_flag = '0'
+        LEFT JOIN product_category tc ON b.top_category_id = tc.id AND tc.del_flag = '0'
+        LEFT JOIN product_category mc ON b.medium_category_id = mc.id AND mc.del_flag = '0'
+        LEFT JOIN product_category bc ON b.bottom_category_id = bc.id AND bc.del_flag = '0'
+        LEFT JOIN product_unit u ON b.unit_id = u.id AND u.del_flag = '0'
+        ${ew.customSqlSegment}
     </select>
 
     <!-- 查询商品状态统计信息(优化版) -->
     <select id="selectProductStatusCount" resultType="org.dromara.product.domain.vo.StatusCountVo">
-        SELECT COUNT(*)                                                             AS total,
-               SUM(CASE WHEN product_status = '1' THEN 1 ELSE 0 END)                AS onSale,
-               SUM(CASE WHEN product_review_status IN ('0', '3') THEN 1 ELSE 0 END) AS waitAudit,
-               SUM(CASE WHEN product_review_status = '1' THEN 1 ELSE 0 END)         AS auditPass,
-               SUM(CASE WHEN product_review_status = '2' THEN 1 ELSE 0 END)         AS auditReject
+        SELECT
+            COUNT(*) AS total,
+            SUM(CASE WHEN product_status = '1' THEN 1 ELSE 0 END) AS onSale,
+            SUM(CASE WHEN product_review_status IN ('0', '3') THEN 1 ELSE 0 END) AS waitAudit,
+            SUM(CASE WHEN product_review_status = '1' THEN 1 ELSE 0 END) AS auditPass,
+            SUM(CASE WHEN product_review_status = '2' THEN 1 ELSE 0 END) AS auditReject
         FROM product_base
         WHERE del_flag = '0'
     </select>
     <select id="selectBrandIdsByCategory" resultType="java.lang.Long">
         SELECT
-        product.brand_id
+            product.brand_id
         FROM product_base product
         INNER JOIN product_category category ON product.top_category_id = category.id
         <where>
@@ -338,7 +340,7 @@
                 AND category.id = #{categoryId}
             </if>
             <if test="categoryName != null and categoryName !=''">
-                AND category.category_Name LIKE CONCAT('%', #{categoryName}, '%')
+                AND  category.category_Name LIKE CONCAT('%', #{categoryName}, '%')
             </if>
         </where>