|
@@ -486,21 +486,65 @@
|
|
|
</update>
|
|
|
|
|
|
<select id="getYfkOrderUserSum" resultType="int">
|
|
|
- select count(1) from (select user_id,count(user_id) as counts from mall_order where pay_status = 2 group by user_id) u
|
|
|
+ select count(1) from (select o.user_id,count(o.user_id) as counts from mall_order o
|
|
|
+ inner join mall_merch_user mu on o.user_id=mu.user_id and o.merch_sn=mu.merch_sn and o.store_id=mu.store_id
|
|
|
+ where pay_status = 2
|
|
|
+ <if test="storeId != null and storeId != ''">
|
|
|
+ AND o.store_id = #{storeId}
|
|
|
+ </if>
|
|
|
+ <if test="merchSn != null and merchSn.trim() != ''">
|
|
|
+ AND o.merch_sn = #{merchSn}
|
|
|
+ </if>
|
|
|
+ group by o.user_id) u
|
|
|
</select>
|
|
|
<select id="getOderUserSum" resultType="int">
|
|
|
- select count(1) from (select user_id,count(user_id) as counts from mall_order group by user_id) u
|
|
|
+ select count(1) from (select o.user_id,count(o.user_id) as counts from mall_order o
|
|
|
+ inner join mall_merch_user mu on o.user_id=mu.user_id and o.merch_sn=mu.merch_sn and o.store_id=mu.store_id
|
|
|
+ where 1=1
|
|
|
+ <if test="storeId != null and storeId != ''">
|
|
|
+ AND o.store_id = #{storeId}
|
|
|
+ </if>
|
|
|
+ <if test="merchSn != null and merchSn.trim() != ''">
|
|
|
+ AND o.merch_sn = #{merchSn}
|
|
|
+ </if>
|
|
|
+ group by o.user_id) u
|
|
|
</select>
|
|
|
<select id="getTodayUserOrder" resultType="int">
|
|
|
- select count(1) from mall_order where pay_status = 2 and pay_time > date_format(sysdate(), '%Y-%m-%d')
|
|
|
+ select count(1) from mall_order o where pay_status = 2 and pay_time > date_format(sysdate(), '%Y-%m-%d')
|
|
|
+ <if test="storeId != null and storeId != ''">
|
|
|
+ AND o.store_id = #{storeId}
|
|
|
+ </if>
|
|
|
+ <if test="merchSn != null and merchSn.trim() != ''">
|
|
|
+ AND o.merch_sn = #{merchSn}
|
|
|
+ </if>
|
|
|
+
|
|
|
</select>
|
|
|
<select id="getTodayUserSales" resultType="int">
|
|
|
- select ifnull(sum(actual_price),0) from mall_order where pay_status = 2 and pay_time > date_format(sysdate(), '%Y-%m-%d')
|
|
|
+ select ifnull(sum(actual_price),0) from mall_order o where pay_status = 2 and pay_time > date_format(sysdate(), '%Y-%m-%d')
|
|
|
+ <if test="storeId != null and storeId != ''">
|
|
|
+ AND o.store_id = #{storeId}
|
|
|
+ </if>
|
|
|
+ <if test="merchSn != null and merchSn.trim() != ''">
|
|
|
+ AND o.merch_sn = #{merchSn}
|
|
|
+ </if>
|
|
|
+
|
|
|
</select>
|
|
|
<select id="getIncomeSum" resultType="int">
|
|
|
select ifnull(sum(actual_price),0) from mall_order where pay_status = 2
|
|
|
+ <if test="storeId != null and storeId != ''">
|
|
|
+ AND store_id = #{storeId}
|
|
|
+ </if>
|
|
|
+ <if test="merchSn != null and merchSn.trim() != ''">
|
|
|
+ AND merch_sn = #{merchSn}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
<select id="getPayedOrderCount" resultType="int">
|
|
|
- select count(1) from mall_order where pay_status = 2
|
|
|
+ select count(1) from mall_order where pay_status = 2 and is_onffline_order = 0
|
|
|
+ <if test="storeId != null and storeId != ''">
|
|
|
+ AND store_id = #{storeId}
|
|
|
+ </if>
|
|
|
+ <if test="merchSn != null and merchSn.trim() != ''">
|
|
|
+ AND merch_sn = #{merchSn}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
</mapper>
|