|
|
@@ -6,7 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
<!-- 站点产品列表查询(联表查询) -->
|
|
|
<select id="selectSiteProductPage" resultType="org.dromara.product.domain.vo.SiteProductVo">
|
|
|
- SELECT DISTINCT
|
|
|
+ SELECT
|
|
|
b.id,
|
|
|
b.product_no AS productNo,
|
|
|
b.item_name AS productName,
|
|
|
@@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
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'
|
|
|
@@ -38,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
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_gift_category_link gcl ON b.product_no = gcl.product_no AND gcl.del_flag = '0'
|
|
|
<where>
|
|
|
b.del_flag = '0'
|
|
|
<if test="bo.keyword != null and bo.keyword != ''">
|
|
|
@@ -65,6 +67,181 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
AND b.product_status = #{bo.productStatus}
|
|
|
</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
|
|
|
+ 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
|
|
|
+ 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'
|
|
|
+ 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'
|
|
|
+ <where>
|
|
|
+ b.del_flag = '0'
|
|
|
+ <if test="bo.productNo != null and bo.productNo != ''">
|
|
|
+ AND b.product_no LIKE CONCAT('%', #{bo.productNo}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="bo.itemName != null and bo.itemName != ''">
|
|
|
+ AND b.item_name LIKE CONCAT('%', #{bo.itemName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="bo.brandId != null">
|
|
|
+ AND b.brand_id = #{bo.brandId}
|
|
|
+ </if>
|
|
|
+ <if test="bo.productStatus != null and bo.productStatus != ''">
|
|
|
+ AND b.product_status = #{bo.productStatus}
|
|
|
+ </if>
|
|
|
+ <if test="bo.topCategoryId != null">
|
|
|
+ AND b.top_category_id = #{bo.topCategoryId}
|
|
|
+ </if>
|
|
|
+ <if test="bo.mediumCategoryId != null">
|
|
|
+ AND b.medium_category_id = #{bo.mediumCategoryId}
|
|
|
+ </if>
|
|
|
+ <if test="bo.bottomCategoryId != null">
|
|
|
+ AND b.bottom_category_id = #{bo.bottomCategoryId}
|
|
|
+ </if>
|
|
|
+ <if test="bo.homeRecommended != null and bo.homeRecommended != ''">
|
|
|
+ AND b.home_recommended = #{bo.homeRecommended}
|
|
|
+ </if>
|
|
|
+ <if test="bo.categoryRecommendation != null and bo.categoryRecommendation != ''">
|
|
|
+ AND b.category_recommendation = #{bo.categoryRecommendation}
|
|
|
+ </if>
|
|
|
+ <if test="bo.cartRecommendation != null and bo.cartRecommendation != ''">
|
|
|
+ AND b.cart_recommendation = #{bo.cartRecommendation}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY b.recommended_product_order ASC, b.create_time DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 商品运营列表查询(联表查询) -->
|
|
|
+ <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
|
|
|
+ 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'
|
|
|
+ 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'
|
|
|
+ <where>
|
|
|
+ b.del_flag = '0'
|
|
|
+ <if test="bo.productNo != null and bo.productNo != ''">
|
|
|
+ AND b.product_no LIKE CONCAT('%', #{bo.productNo}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="bo.itemName != null and bo.itemName != ''">
|
|
|
+ AND b.item_name LIKE CONCAT('%', #{bo.itemName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="bo.brandId != null">
|
|
|
+ AND b.brand_id = #{bo.brandId}
|
|
|
+ </if>
|
|
|
+ <if test="bo.productStatus != null and bo.productStatus != ''">
|
|
|
+ AND b.product_status = #{bo.productStatus}
|
|
|
+ </if>
|
|
|
+ <if test="bo.topCategoryId != null">
|
|
|
+ AND b.top_category_id = #{bo.topCategoryId}
|
|
|
+ </if>
|
|
|
+ <if test="bo.mediumCategoryId != null">
|
|
|
+ AND b.medium_category_id = #{bo.mediumCategoryId}
|
|
|
+ </if>
|
|
|
+ <if test="bo.bottomCategoryId != null">
|
|
|
+ AND b.bottom_category_id = #{bo.bottomCategoryId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY b.create_time DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 商品简化列表查询(用于选择弹窗) -->
|
|
|
+ <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
|
|
|
+ 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'
|
|
|
+ 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'
|
|
|
+ <where>
|
|
|
+ b.del_flag = '0'
|
|
|
+ <if test="bo.productNo != null and bo.productNo != ''">
|
|
|
+ AND b.product_no LIKE CONCAT('%', #{bo.productNo}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="bo.itemName != null and bo.itemName != ''">
|
|
|
+ AND b.item_name LIKE CONCAT('%', #{bo.itemName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="bo.productStatus != null and bo.productStatus != ''">
|
|
|
+ AND b.product_status = #{bo.productStatus}
|
|
|
+ </if>
|
|
|
+ <if test="bo.topCategoryId != null">
|
|
|
+ AND b.top_category_id = #{bo.topCategoryId}
|
|
|
+ </if>
|
|
|
+ <if test="bo.mediumCategoryId != null">
|
|
|
+ AND b.medium_category_id = #{bo.mediumCategoryId}
|
|
|
+ </if>
|
|
|
+ <if test="bo.bottomCategoryId != null">
|
|
|
+ AND b.bottom_category_id = #{bo.bottomCategoryId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
ORDER BY b.create_time DESC
|
|
|
</select>
|
|
|
<select id="selectAllList" resultType="org.dromara.product.domain.vo.ProductBaseVo">
|