|
@@ -39,23 +39,22 @@
|
|
select
|
|
select
|
|
trade_name
|
|
trade_name
|
|
FROM ctop_product_material
|
|
FROM ctop_product_material
|
|
- <where>
|
|
|
|
- <if test="productId!=null">
|
|
|
|
- and product_id = #{productId}
|
|
|
|
- </if>
|
|
|
|
- <if test="tradeName!=null">
|
|
|
|
- and trade_name like CONCAT(CONCAT('%', #{tradeName}), '%')
|
|
|
|
- </if>
|
|
|
|
- <if test="startMonth!=null">
|
|
|
|
- and start_month >= #{startMonth}
|
|
|
|
- </if>
|
|
|
|
- <if test="endMonth!=null">
|
|
|
|
- and end_month <= #{endMonth}
|
|
|
|
- </if>
|
|
|
|
- <if test="itemRun!=null">
|
|
|
|
- and item_run = #{itemRun}
|
|
|
|
- </if>
|
|
|
|
- </where>
|
|
|
|
|
|
+ where video_url!=''
|
|
|
|
+ <if test="productId!=null">
|
|
|
|
+ and product_id = #{productId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="tradeName!=null">
|
|
|
|
+ and trade_name like CONCAT(CONCAT('%', #{tradeName}), '%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="startMonth!=null">
|
|
|
|
+ and start_month >= #{startMonth}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endMonth!=null">
|
|
|
|
+ and end_month <= #{endMonth}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="itemRun!=null">
|
|
|
|
+ and item_run = #{itemRun}
|
|
|
|
+ </if>
|
|
group by product_id,trade_name
|
|
group by product_id,trade_name
|
|
) t
|
|
) t
|
|
</select>
|
|
</select>
|
|
@@ -71,8 +70,7 @@
|
|
IFNULL(sum(t2.charge),0.00) as 'charge',
|
|
IFNULL(sum(t2.charge),0.00) as 'charge',
|
|
CONCAT(t1.start_month,' ~ ',t1.end_month) as 'time',
|
|
CONCAT(t1.start_month,' ~ ',t1.end_month) as 'time',
|
|
IFNULL(t3.realname,'-') as 'user',
|
|
IFNULL(t3.realname,'-') as 'user',
|
|
- (SELECT COUNT(1) FROM ctop_product_material tt WHERE tt.product_id = t1.product_id AND tt.trade_name =
|
|
|
|
- t1.trade_name) as 'videoCount'
|
|
|
|
|
|
+ t4.videoCount
|
|
FROM ctop_product_material t1
|
|
FROM ctop_product_material t1
|
|
LEFT JOIN
|
|
LEFT JOIN
|
|
(
|
|
(
|
|
@@ -90,24 +88,28 @@
|
|
</where>
|
|
</where>
|
|
GROUP BY signature
|
|
GROUP BY signature
|
|
) t2 ON t1.signature = t2.signature
|
|
) t2 ON t1.signature = t2.signature
|
|
- left join (select id, realname from sys_user)t3 on t1.user_id =t3.id
|
|
|
|
- <where>
|
|
|
|
- <if test="productId!=null">
|
|
|
|
- and t1.product_id = #{productId}
|
|
|
|
- </if>
|
|
|
|
- <if test="tradeName!=null">
|
|
|
|
- and t1.trade_name like CONCAT(CONCAT('%', #{tradeName}), '%')
|
|
|
|
- </if>
|
|
|
|
- <if test="startMonth!=null">
|
|
|
|
- and t1.start_month >= #{startMonth}
|
|
|
|
- </if>
|
|
|
|
- <if test="endMonth!=null">
|
|
|
|
- and t1.end_month <= #{endMonth}
|
|
|
|
- </if>
|
|
|
|
- <if test="itemRun!=null">
|
|
|
|
- and t1.item_run = #{itemRun}
|
|
|
|
- </if>
|
|
|
|
- </where>
|
|
|
|
|
|
+ LEFT JOIN (select id, realname from sys_user) t3 on t1.user_id =t3.id
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT product_id,trade_name,COUNT(signature) as 'videoCount' FROM ctop_product_material
|
|
|
|
+ WHERE video_url!=''
|
|
|
|
+ GROUP BY product_id,trade_name
|
|
|
|
+ ) t4 ON t1.product_id = t4.product_id AND t1.trade_name= t4.trade_name
|
|
|
|
+ where video_url!=''
|
|
|
|
+ <if test="productId!=null">
|
|
|
|
+ and t1.product_id = #{productId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="tradeName!=null">
|
|
|
|
+ and t1.trade_name like CONCAT(CONCAT('%', #{tradeName}), '%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="startMonth!=null">
|
|
|
|
+ and t1.start_month >= #{startMonth}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endMonth!=null">
|
|
|
|
+ and t1.end_month <= #{endMonth}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="itemRun!=null">
|
|
|
|
+ and t1.item_run = #{itemRun}
|
|
|
|
+ </if>
|
|
group by t1.product_id,t1.trade_name
|
|
group by t1.product_id,t1.trade_name
|
|
</select>
|
|
</select>
|
|
|
|
|