wangming 2 долоо хоног өмнө
parent
commit
d210d6f18f

+ 4 - 0
yami-shop-bean/src/main/java/com/yami/shop/bean/vo/SkuStatisticsVo.java

@@ -25,4 +25,8 @@ public class SkuStatisticsVo {
 
     @ApiModelProperty("商品总数量")
     private Integer prodCount;
+
+    @ApiModelProperty("小计")
+    private Double total;
+
 }

+ 4 - 4
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/SkuController.java

@@ -16,7 +16,7 @@ import com.yami.shop.bean.model.Sku;
 import com.yami.shop.bean.po.FreightStatisticsPo;
 import com.yami.shop.bean.po.SkuStatisticsPo;
 import com.yami.shop.bean.vo.FreightStatisticsVo;
-import com.yami.shop.bean.vo.SkuStatistics;
+import com.yami.shop.bean.vo.SkuStatisticsVo;
 import com.yami.shop.common.util.PageParam;
 import com.yami.shop.common.util.R;
 import com.yami.shop.service.SkuService;
@@ -52,14 +52,14 @@ public class SkuController {
 
     @GetMapping("/skuStatisticsList")
     @ApiOperation(value = "对账单汇总表(商品)-列表")
-    public R<IPage<SkuStatistics>> skuStatisticsList(PageParam<SkuStatisticsPo> page, SkuStatisticsPo po) {
-        IPage<SkuStatistics> commList = new Page<>();
-        return R.SUCCESS(commList);
+    public R<IPage<SkuStatisticsVo>> skuStatisticsList(PageParam<SkuStatisticsPo> page, SkuStatisticsPo po) {
+        return R.SUCCESS(skuService.skuStatisticsList(page,po));
     }
 
     @GetMapping("/skuStatisticsExcel")
     @ApiOperation("对账单汇总表(商品)-导出")
     public R<Void> skuStatisticsExcel(HttpServletResponse response, SkuStatisticsPo po) {
+        skuService.skuStatisticsExcel(response,po);
         return R.SUCCESS();
     }
 

+ 1 - 0
yami-shop-security/yami-shop-security-platform/src/main/java/com/yami/shop/security/platform/config/ResourceServerConfiguration.java

@@ -65,6 +65,7 @@ public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter
                     "/admin/enterprise/downloadExcel",
                     "/admin/enterprise/downloadErrorExcel",
                     "/admin/enterprise/export",
+                    "/platform/sku/**",
                     "/captcha.jpg").permitAll()
             .and()
             .authorizeRequests()

+ 10 - 0
yami-shop-service/src/main/java/com/yami/shop/dao/SkuMapper.java

@@ -13,7 +13,9 @@ package com.yami.shop.dao;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yami.shop.bean.model.Sku;
+import com.yami.shop.bean.po.SkuStatisticsPo;
 import com.yami.shop.bean.vo.SkuBuyTogetherOftenVo;
+import com.yami.shop.bean.vo.SkuStatisticsVo;
 import com.yami.shop.common.util.PageParam;
 import org.apache.ibatis.annotations.Param;
 
@@ -57,4 +59,12 @@ public interface SkuMapper extends BaseMapper<Sku> {
                                                   @Param("channelId") Long channelId,
                                                   @Param("userId") String userId
     );
+
+    Double goodsTotalPrice(@Param("po")SkuStatisticsPo po);
+    Double totalPoints(@Param("po")SkuStatisticsPo po);
+    Double totalCash(@Param("po")SkuStatisticsPo po);
+    Double totalFreight(@Param("po")SkuStatisticsPo po);
+
+    IPage<SkuStatisticsVo> skuStatisticsList(@Param("page") PageParam<SkuStatisticsPo> page, @Param("po") SkuStatisticsPo po);
+    List<SkuStatisticsVo> skuStatisticsList2(@Param("po") SkuStatisticsPo po);
 }

+ 7 - 0
yami-shop-service/src/main/java/com/yami/shop/service/SkuService.java

@@ -13,9 +13,12 @@ package com.yami.shop.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.yami.shop.bean.model.Sku;
+import com.yami.shop.bean.po.SkuStatisticsPo;
 import com.yami.shop.bean.vo.SkuBuyTogetherOftenVo;
+import com.yami.shop.bean.vo.SkuStatisticsVo;
 import com.yami.shop.common.util.PageParam;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -66,4 +69,8 @@ public interface SkuService extends IService<Sku> {
     void removeSkuCacheBySkuId(Long skuId, Long prodId);
 
     IPage<SkuBuyTogetherOftenVo> buyTogetherOften(PageParam<SkuBuyTogetherOftenVo> page, Long prodId,Long shopId,Long channelId,String userId);
+
+    IPage<SkuStatisticsVo> skuStatisticsList(PageParam<SkuStatisticsPo> page, SkuStatisticsPo po);
+
+    void skuStatisticsExcel(HttpServletResponse response, SkuStatisticsPo po);
 }

+ 24 - 0
yami-shop-service/src/main/java/com/yami/shop/service/impl/SkuServiceImpl.java

@@ -13,7 +13,10 @@ package com.yami.shop.service.impl;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yami.shop.bean.model.Sku;
+import com.yami.shop.bean.po.SkuStatisticsPo;
 import com.yami.shop.bean.vo.SkuBuyTogetherOftenVo;
+import com.yami.shop.bean.vo.SkuStatistics;
+import com.yami.shop.bean.vo.SkuStatisticsVo;
 import com.yami.shop.common.util.PageParam;
 import com.yami.shop.dao.SkuMapper;
 import com.yami.shop.service.SkuService;
@@ -22,6 +25,7 @@ import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.Caching;
 import org.springframework.stereotype.Service;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -71,4 +75,24 @@ public class SkuServiceImpl extends ServiceImpl<SkuMapper, Sku> implements SkuSe
     public IPage<SkuBuyTogetherOftenVo> buyTogetherOften(PageParam<SkuBuyTogetherOftenVo> page, Long prodId,Long shopId,Long channelId,String userId) {
         return skuMapper.buyTogetherOften(page, prodId,shopId,channelId,userId);
     }
+
+    @Override
+    public IPage<SkuStatisticsVo> skuStatisticsList(PageParam<SkuStatisticsPo> page, SkuStatisticsPo po) {
+        return skuMapper.skuStatisticsList(page, po);
+    }
+
+    @Override
+    public void skuStatisticsExcel(HttpServletResponse response, SkuStatisticsPo po) {
+        SkuStatistics skuStatistics = new SkuStatistics();
+        skuStatistics.setGoodsTotalPrice(skuMapper.goodsTotalPrice(po));
+        System.out.println(1);
+        skuStatistics.setTotalPoints(skuMapper.totalPoints(po));
+        System.out.println(2);
+        skuStatistics.setTotalCash(skuMapper.totalCash(po));
+        System.out.println(3);
+        skuStatistics.setTotalFreight(skuMapper.totalFreight(po));
+        System.out.println(4);
+        skuStatistics.setSkuStatisticsList(skuMapper.skuStatisticsList2(po));
+        System.out.println(skuStatistics);
+    }
 }

+ 390 - 0
yami-shop-service/src/main/resources/mapper/SkuMapper.xml

@@ -200,4 +200,394 @@
         ORDER BY a.rec_time desc, a.order_item_id desc
     </select>
 
+    <select id="goodsTotalPrice" resultType="Double">
+        SELECT (SELECT SUM(IFNULL(total,0)) goods_total_price FROM tz_order
+        WHERE is_payed=1
+        <if test="po.startTime != null and po.startTime != ''">
+            and create_time&gt;= #{po.startTime}
+        </if>
+
+        <if test="po.endTime != null and po.endTime != ''">
+            and create_time&lt;= #{po.endTime}
+        </if>
+        <if test="po.skuId != null or (po.skuName != null and po.skuName != '') or (po.spec != null and po.spec != '')">
+        and order_number in(SELECT a.order_number FROM tz_order_item a LEFT JOIN tz_sku b on a.sku_id=b.sku_id
+                                                <where>
+                                                    <if test="po.skuId != null">
+                                                        AND a.sku_id like concat('%',#{po.skuId} ,'%')
+                                                    </if>
+
+                                                    <if test="po.skuName != null and po.skuName != ''">
+                                                        AND a.sku_name like concat('%',#{po.skuName} ,'%')
+                                                    </if>
+
+                                                    <if test="po.spec != null and po.spec != ''">
+                                                        AND b.spec like concat('%',#{po.spec} ,'%')
+                                                    </if>
+                                                </where>
+            )
+        </if>
+
+          and channel_id in
+        <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        )
+        -
+        (SELECT IFNULL(SUM(a.sku_price * product_count),0)
+        FROM `tz_order_refund_sku` a
+        LEFT JOIN tz_order_refund b on a.order_refund_id=b.refund_id
+        LEFT JOIN tz_order c on b.order_number=c.order_number
+        LEFT JOIN tz_sku d on a.sku_id=d.sku_id
+        WHERE b.return_money_sts=70
+        <if test="po.startTime != null and po.startTime != ''">
+            and b.apply_time&gt;= #{po.startTime}
+        </if>
+
+        <if test="po.endTime != null and po.endTime != ''">
+            and b.apply_time&lt;= #{po.endTime}
+        </if>
+        and c.channel_id in
+        <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+
+        <if test="po.skuId != null">
+            AND a.sku_id like concat('%',#{po.skuId} ,'%')
+        </if>
+
+        <if test="po.skuName != null and po.skuName != ''">
+            AND d.sku_name like concat('%',#{po.skuName} ,'%')
+        </if>
+
+        <if test="po.spec != null and po.spec != ''">
+            AND d.spec like concat('%',#{po.spec} ,'%')
+        </if>
+
+        ) goods_total_price
+    </select>
+
+    <select id="totalPoints" resultType="Double">
+        SELECT TRUNCATE(((SELECT SUM(IFNULL(offset_points,0)) FROM tz_order
+        WHERE is_payed=1
+        <if test="po.startTime != null and po.startTime != ''">
+            and create_time&gt;= #{po.startTime}
+        </if>
+
+        <if test="po.endTime != null and po.endTime != ''">
+            and create_time&lt;= #{po.endTime}
+        </if>
+        and channel_id in
+        <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        <if test="po.skuId != null or (po.skuName != null and po.skuName != '') or (po.spec != null and po.spec != '')">
+            and order_number in(SELECT a.order_number FROM tz_order_item a LEFT JOIN tz_sku b on a.sku_id=b.sku_id
+            <where>
+                <if test="po.skuId != null">
+                    AND a.sku_id like concat('%',#{po.skuId} ,'%')
+                </if>
+
+                <if test="po.skuName != null and po.skuName != ''">
+                    AND a.sku_name like concat('%',#{po.skuName} ,'%')
+                </if>
+
+                <if test="po.spec != null and po.spec != ''">
+                    AND b.spec like concat('%',#{po.spec} ,'%')
+                </if>
+            </where>
+            )
+        </if>
+        )
+        -
+        (SELECT  SUM(total_offset_points) FROM (SELECT
+        CASE
+        WHEN refund_type=1 THEN total_offset_points
+        ELSE total_offset_points+ (freight_amount * 100)
+        END AS total_offset_points
+        FROM tz_order_refund a
+        LEFT JOIN (SELECT SUM(tor.offset_points) total_offset_points ,tor.order_number
+        FROM tz_order_refund tor
+        WHERE tor.return_money_sts=70
+        <if test="po.startTime != null and po.startTime != ''">
+            and tor.apply_time&gt;= #{po.startTime}
+        </if>
+
+        <if test="po.endTime != null and po.endTime != ''">
+            and tor.apply_time&lt;= #{po.endTime}
+        </if>
+            and tor.order_number in(SELECT ao.order_number FROM tz_order_item ao
+                LEFT JOIN tz_sku b on ao.sku_id=b.sku_id
+                LEFT JOIN tz_order c on ao.order_number=c.order_number
+            <where>
+                 c.channel_id in
+                <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+                <if test="po.skuId != null or (po.skuName != null and po.skuName != '') or (po.spec != null and po.spec != '')">
+                <if test="po.skuId != null">
+                    AND ao.sku_id like concat('%',#{po.skuId} ,'%')
+                </if>
+                <if test="po.skuName != null and po.skuName != ''">
+                    AND ao.sku_name like concat('%',#{po.skuName} ,'%')
+                </if>
+                <if test="po.spec != null and po.spec != ''">
+                    AND b.spec like concat('%',#{po.spec} ,'%')
+                </if>
+                </if>
+            </where>
+            )
+        GROUP BY tor.order_number) b on a.order_number=b.order_number
+        WHERE return_money_sts=70
+        <if test="po.startTime != null and po.startTime != ''">
+            and apply_time &gt;= #{po.startTime}
+        </if>
+
+        <if test="po.endTime != null and po.endTime != ''">
+            and apply_time &lt;= #{po.endTime}
+        </if>
+            and a.order_number in(SELECT ao2.order_number FROM tz_order_item ao2
+        LEFT JOIN tz_sku b on ao2.sku_id=b.sku_id
+        LEFT JOIN tz_order c on ao2.order_number=c.order_number
+        <where>
+            c.channel_id in
+            <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+            <if test="po.skuId != null or (po.skuName != null and po.skuName != '') or (po.spec != null and po.spec != '')">
+                <if test="po.skuId != null">
+                    AND ao2.sku_id like concat('%',#{po.skuId} ,'%')
+                </if>
+                <if test="po.skuName != null and po.skuName != ''">
+                    AND ao2.sku_name like concat('%',#{po.skuName} ,'%')
+                </if>
+                <if test="po.spec != null and po.spec != ''">
+                    AND b.spec like concat('%',#{po.spec} ,'%')
+                </if>
+            </if>
+        </where>
+        )
+        GROUP BY a.order_number) a)) /100,2) total_offset_points
+    </select>
+
+    <select id="totalCash" resultType="Double">
+        SELECT (SELECT SUM(IFNULL(actual_total,0)) FROM tz_order WHERE is_payed=1
+        <if test="po.startTime != null and po.startTime != ''">
+            and create_time&gt;= #{po.startTime}
+        </if>
+
+        <if test="po.endTime != null and po.endTime != ''">
+            and create_time&lt;= #{po.endTime}
+        </if>
+        and channel_id in
+        <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        <if test="po.skuId != null or (po.skuName != null and po.skuName != '') or (po.spec != null and po.spec != '')">
+            and order_number in(SELECT a.order_number FROM tz_order_item a LEFT JOIN tz_sku b on a.sku_id=b.sku_id
+            <where>
+                <if test="po.skuId != null">
+                    AND a.sku_id like concat('%',#{po.skuId} ,'%')
+                </if>
+                <if test="po.skuName != null and po.skuName != ''">
+                    AND a.sku_name like concat('%',#{po.skuName} ,'%')
+                </if>
+                <if test="po.spec != null and po.spec != ''">
+                    AND b.spec like concat('%',#{po.spec} ,'%')
+                </if>
+            </where>
+            )
+        </if>
+                                                                 )
+        -
+        (SELECT SUM(refund_amount) FROM tz_order_refund WHERE return_money_sts=70
+        <if test="po.startTime != null and po.startTime != ''">
+            and apply_time&gt;= #{po.startTime}
+        </if>
+
+        <if test="po.endTime != null and po.endTime != ''">
+            and apply_time&lt;= #{po.endTime}
+        </if>
+        and order_number in(SELECT a.order_number FROM tz_order_item a
+        LEFT JOIN tz_sku b on a.sku_id=b.sku_id
+        LEFT JOIN tz_order c on a.order_number=c.order_number
+        <where>
+            c.channel_id in
+            <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+            <if test="po.skuId != null or (po.skuName != null and po.skuName != '') or (po.spec != null and po.spec != '')">
+                <if test="po.skuId != null">
+                    AND a.sku_id like concat('%',#{po.skuId} ,'%')
+                </if>
+                <if test="po.skuName != null and po.skuName != ''">
+                    AND a.sku_name like concat('%',#{po.skuName} ,'%')
+                </if>
+                <if test="po.spec != null and po.spec != ''">
+                    AND b.spec like concat('%',#{po.spec} ,'%')
+                </if>
+            </if>
+        </where>
+        )) cash
+    </select>
+
+    <select id="totalFreight" resultType="Double">
+        SELECT (SELECT SUM(IFNULL(freight_amount,0)) total_freight FROM tz_order
+        WHERE is_payed=1
+        <if test="po.startTime != null and po.startTime != ''">
+            and create_time&gt;= #{po.startTime}
+        </if>
+
+        <if test="po.endTime != null and po.endTime != ''">
+            and create_time&lt;= #{po.endTime}
+        </if>
+        and channel_id in
+        <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        <if test="po.skuId != null or (po.skuName != null and po.skuName != '') or (po.spec != null and po.spec != '')">
+            and order_number in(SELECT a.order_number FROM tz_order_item a LEFT JOIN tz_sku b on a.sku_id=b.sku_id
+            <where>
+                <if test="po.skuId != null">
+                    AND a.sku_id like concat('%',#{po.skuId} ,'%')
+                </if>
+
+                <if test="po.skuName != null and po.skuName != ''">
+                    AND a.sku_name like concat('%',#{po.skuName} ,'%')
+                </if>
+
+                <if test="po.spec != null and po.spec != ''">
+                    AND b.spec like concat('%',#{po.spec} ,'%')
+                </if>
+            </where>
+            )
+        </if>
+        )
+        -
+        (SELECT SUM(IFNULL(freight_amount,0))
+        FROM `tz_order_refund`
+        WHERE return_money_sts=70
+        <if test="po.startTime != null and po.startTime != ''">
+            and apply_time&gt;= #{po.startTime}
+        </if>
+
+        <if test="po.endTime != null and po.endTime != ''">
+            and apply_time&lt;= #{po.endTime}
+        </if>
+          and refund_type=1
+        and order_number in(SELECT a.order_number FROM tz_order_item a
+        LEFT JOIN tz_sku b on a.sku_id=b.sku_id
+        LEFT JOIN tz_order c on a.order_number=c.order_number
+        <where>
+            c.channel_id in
+            <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+            <if test="po.skuId != null or (po.skuName != null and po.skuName != '') or (po.spec != null and po.spec != '')">
+                <if test="po.skuId != null">
+                    AND a.sku_id like concat('%',#{po.skuId} ,'%')
+                </if>
+                <if test="po.skuName != null and po.skuName != ''">
+                    AND a.sku_name like concat('%',#{po.skuName} ,'%')
+                </if>
+                <if test="po.spec != null and po.spec != ''">
+                    AND b.spec like concat('%',#{po.spec} ,'%')
+                </if>
+            </if>
+        </where>
+        ))
+    </select>
+
+    <select id="skuStatisticsList" resultType="com.yami.shop.bean.vo.SkuStatisticsVo">
+        SELECT a.prod_id,a.sku_id,a.sku_name,c.spec,TRUNCATE(IFNULL(SUM(a.price*a.prod_count)/SUM(a.prod_count),0),2) price,IFNULL(SUM(a.prod_count),0)-IFNULL(d.product_count,0) as prod_count,
+        TRUNCATE(IFNULL(SUM(a.price*a.prod_count)/SUM(a.prod_count),0),2) * (IFNULL(SUM(a.prod_count),0)-IFNULL(d.product_count,0)) total
+        FROM tz_order_item a
+        LEFT JOIN tz_order b on a.order_number=b.order_number
+        LEFT JOIN tz_sku c on a.sku_id=c.sku_id
+        LEFT JOIN (SELECT a.sku_id,SUM(a.product_count) product_count
+        FROM `tz_order_refund_sku` a
+        LEFT JOIN tz_order_refund b on a.order_refund_id=b.refund_id
+        WHERE return_money_sts=70
+
+        <if test="po.startTime != null and po.startTime != ''">
+            and b.apply_time&gt;= #{po.startTime}
+        </if>
+
+        <if test="po.endTime != null and po.endTime != ''">
+            and b.apply_time&lt;= #{po.endTime}
+        </if>
+        GROUP BY a.sku_id) d on a.sku_id = d.sku_id
+
+        WHERE b.is_payed=1
+        <if test="po.startTime != null and po.startTime != ''">
+            and a.rec_time&gt;= #{po.startTime}
+        </if>
+
+        <if test="po.endTime != null and po.endTime != ''">
+            and a.rec_time&lt;= #{po.endTime}
+        </if>
+        and b.channel_id in
+        <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        <if test="po.skuId != null">
+            AND a.sku_id like concat('%',#{po.skuId} ,'%')
+        </if>
+
+        <if test="po.skuName != null and po.skuName != ''">
+            AND a.sku_name like concat('%',#{po.skuName} ,'%')
+        </if>
+
+        <if test="po.spec != null and po.spec != ''">
+            AND c.spec like concat('%',#{po.spec} ,'%')
+        </if>
+        GROUP BY a.sku_id HAVING prod_count>0
+    </select>
+
+    <select id="skuStatisticsList2" resultType="com.yami.shop.bean.vo.SkuStatisticsVo">
+        SELECT a.prod_id,a.sku_id,a.sku_name,c.spec,TRUNCATE(IFNULL(SUM(a.price*a.prod_count)/SUM(a.prod_count),0),2) price,IFNULL(SUM(a.prod_count),0)-IFNULL(d.product_count,0) as prod_count,
+        TRUNCATE(IFNULL(SUM(a.price*a.prod_count)/SUM(a.prod_count),0),2) * (IFNULL(SUM(a.prod_count),0)-IFNULL(d.product_count,0)) total
+        FROM tz_order_item a
+        LEFT JOIN tz_order b on a.order_number=b.order_number
+        LEFT JOIN tz_sku c on a.sku_id=c.sku_id
+        LEFT JOIN (SELECT a.sku_id,SUM(a.product_count) product_count
+        FROM `tz_order_refund_sku` a
+        LEFT JOIN tz_order_refund b on a.order_refund_id=b.refund_id
+        WHERE return_money_sts=70
+
+        <if test="po.startTime != null and po.startTime != ''">
+            and b.apply_time&gt;= #{po.startTime}
+        </if>
+
+        <if test="po.endTime != null and po.endTime != ''">
+            and b.apply_time&lt;= #{po.endTime}
+        </if>
+        GROUP BY a.sku_id) d on a.sku_id = d.sku_id
+
+        WHERE b.is_payed=1
+        <if test="po.startTime != null and po.startTime != ''">
+            and a.rec_time&gt;= #{po.startTime}
+        </if>
+
+        <if test="po.endTime != null and po.endTime != ''">
+            and a.rec_time&lt;= #{po.endTime}
+        </if>
+        and b.channel_id in
+        <foreach collection="po.channelIds" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        <if test="po.skuId != null">
+            AND a.sku_id like concat('%',#{po.skuId} ,'%')
+        </if>
+
+        <if test="po.skuName != null and po.skuName != ''">
+            AND a.sku_name like concat('%',#{po.skuName} ,'%')
+        </if>
+
+        <if test="po.spec != null and po.spec != ''">
+            AND c.spec like concat('%',#{po.spec} ,'%')
+        </if>
+        GROUP BY a.sku_id HAVING prod_count>0
+    </select>
+
 </mapper>