‘linchangsheng’ 1 week ago
parent
commit
92804f72aa
1 changed files with 4 additions and 3 deletions
  1. 4 3
      src/main/resources/mapper/CustomGoodsMapper.xml

+ 4 - 3
src/main/resources/mapper/CustomGoodsMapper.xml

@@ -99,15 +99,16 @@
 
     <select id="countByType" resultType="com.gree.mall.manager.bean.goods.GoodsTypeCount">
         select count(1) 'total', sum(if(status = true, 1, 0)) 'csz', sum(if(status = false, 1, 0)) 'ckz'
-        from goods a join goods_company b on a.goods_id = b.goods_id
+        from goods a
         where del = false
         <if test=' companyWechatIds != null and companyWechatIds.size > 0' >
-            AND b.company_id in
+            AND  a.goods_id in (select b.goods_id from goods_company b where b.company_id in
             <foreach collection="companyWechatIds" open="(" close=")" item="companyWechatId" separator=",">
                 #{companyWechatId}
             </foreach>
+            )
         </if>
-        group by a.goods_id
+
     </select>
 
     <select id="ysq" resultType="java.lang.Integer">