select b.store_id,c.store_name,b.show_time,IFNull(count(d.spu_id),0) as 'spu_count',IFNull(count(d.sku_id),0) as 'sku_count' from goblin_self_marketing as a
inner join goblin_marketing_zhengzai_relation as b on a.self_market_id = b.self_market_id
inner join goblin_store_info as c on c.store_id= b.store_id
left join goblin_marketing_zhengzai as d on d.self_market_id = b.self_market_id
select b.store_id,
c.store_name,
b.show_time,
IFNull(count(distinct d.spu_id), 0) as 'spu_count',
IFNull(count(distinct d.sku_id), 0) as 'sku_count'
from goblin_self_marketing as a
inner join goblin_marketing_zhengzai_relation as b on a.self_market_id = b.self_market_id
inner join goblin_store_info as c on c.store_id = b.store_id
left join goblin_marketing_zhengzai as d on d.self_market_id = b.self_market_id
where a.self_market_id = #{marketId}
GROUP BY b.store_id
</select>
...
...
@@ -68,13 +73,17 @@ GROUP BY b.store_id
gmzr.self_market_id
<where>
del_flag = 0
<iftest="purchaseName != null and purchaseName!=''">and gsm.name like concat('%', #{purchaseName}, '%') '%'</if>
<iftest="purchaseName != null and purchaseName!=''">and gsm.name like concat('%', #{purchaseName}, '%')
'%'
</if>
<iftest="ct != null and ct!=''">and gsm.created_at = #{ct}</if>
<iftest="st != null and et != null and st != '' and et != ''">and and gsm.start_time <![CDATA[ >= ]]> #{st} and
<iftest="st != null and et != null and st != '' and et != ''">and and gsm.start_time <![CDATA[ >= ]]> #{st}
and
gsm.end_time <![CDATA[ <= ]]> #{et}
</if>
<iftest="status==0">and gsm.start_time <![CDATA[ >= ]]> NOW() and gsm.status!=7</if>
<iftest="status==1">and gsm.start_time <![CDATA[ < ]]> NOW() and gsm.end_time <![CDATA[ > ]]> NOW() and gsm.status!=7
<iftest="status==1">and gsm.start_time <![CDATA[ < ]]> NOW() and gsm.end_time <![CDATA[ > ]]> NOW() and
gsm.status!=7
</if>
<iftest="status==2">and gsm.end_time <![CDATA[ <= ]]> NOW() and gsm.status!=7</if>