|
|
@@ -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>
|
|
|
|