|
@@ -103,6 +103,7 @@
|
|
|
mall_order o
|
|
|
LEFT JOIN mall_user u ON o.user_id = u.id
|
|
|
LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
|
|
|
+ left join mall_store s on o.store_id = s.id
|
|
|
WHERE 1=1
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
AND o.add_time <![CDATA[ > ]]> #{startTime}
|
|
@@ -113,6 +114,9 @@
|
|
|
<if test="storeId != null and storeId != ''">
|
|
|
AND o.store_id = #{storeId}
|
|
|
</if>
|
|
|
+ <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
|
|
|
+ AND s.third_party_merch_code = #{thirdPartyMerchCode}
|
|
|
+ </if>
|
|
|
<if test="merchOrderSn != null and merchOrderSn.trim() != ''">
|
|
|
AND o.merch_order_sn = #{merchOrderSn}
|
|
|
</if>
|
|
@@ -172,6 +176,7 @@
|
|
|
LEFT JOIN mall_user u ON o.user_id = u.id
|
|
|
LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
|
|
|
Left join mall_order_goods g on o.id = g.order_id
|
|
|
+ left join mall_store s on o.store_id = s.id
|
|
|
WHERE 1=1
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
AND o.add_time <![CDATA[ > ]]> #{startTime}
|
|
@@ -182,6 +187,9 @@
|
|
|
<if test="storeId != null and storeId != ''">
|
|
|
AND o.store_id = #{storeId}
|
|
|
</if>
|
|
|
+ <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
|
|
|
+ AND s.third_party_merch_code = #{thirdPartyMerchCode}
|
|
|
+ </if>
|
|
|
<if test="merchOrderSn != null and merchOrderSn.trim() != ''">
|
|
|
AND o.merch_order_sn = #{merchOrderSn}
|
|
|
</if>
|
|
@@ -226,7 +234,8 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="queryTotal" resultType="int">
|
|
|
- select count(*) from mall_order o WHERE 1=1
|
|
|
+ select count(*) from mall_order o
|
|
|
+ left join mall_store s on o.store_id = s.id WHERE 1=1
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
AND o.add_time <![CDATA[ > ]]> #{startTime}
|
|
|
</if>
|
|
@@ -236,6 +245,9 @@
|
|
|
<if test="storeId != null and storeId != ''">
|
|
|
AND o.store_id = #{storeId}
|
|
|
</if>
|
|
|
+ <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
|
|
|
+ AND s.third_party_merch_code = #{thirdPartyMerchCode}
|
|
|
+ </if>
|
|
|
<if test="merchOrderSn != null and merchOrderSn.trim() != ''">
|
|
|
AND o.merch_order_sn = #{merchOrderSn}
|
|
|
</if>
|
|
@@ -278,6 +290,7 @@
|
|
|
mall_order o
|
|
|
LEFT JOIN sys_user u ON o.user_id = u.user_id
|
|
|
LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
|
|
|
+ left join mall_store s on o.store_id = s.id
|
|
|
WHERE 1=1
|
|
|
<if test="storeId != null and storeId != ''">
|
|
|
AND o.store_id = #{storeId}
|
|
@@ -285,6 +298,9 @@
|
|
|
<if test="merchSn != null and merchSn.trim() != ''">
|
|
|
AND o.merch_sn = #{merchSn}
|
|
|
</if>
|
|
|
+ <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
|
|
|
+ AND s.third_party_merch_code = #{thirdPartyMerchCode}
|
|
|
+ </if>
|
|
|
<if test="orderSn != null and orderSn.trim() != ''">
|
|
|
AND o.order_sn LIKE concat('%',#{orderSn},'%')
|
|
|
</if>
|
|
@@ -488,6 +504,7 @@
|
|
|
<select id="getYfkOrderUserSum" resultType="int">
|
|
|
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
|
|
|
+ left join mall_store s on o.store_id = s.id
|
|
|
where pay_status = 2
|
|
|
<if test="storeId != null and storeId != ''">
|
|
|
AND o.store_id = #{storeId}
|
|
@@ -495,11 +512,15 @@
|
|
|
<if test="merchSn != null and merchSn.trim() != ''">
|
|
|
AND o.merch_sn = #{merchSn}
|
|
|
</if>
|
|
|
+ <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
|
|
|
+ AND s.third_party_merch_code = #{thirdPartyMerchCode}
|
|
|
+ </if>
|
|
|
group by o.user_id) u
|
|
|
</select>
|
|
|
<select id="getOderUserSum" resultType="int">
|
|
|
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
|
|
|
+ left join mall_store s on o.store_id = s.id
|
|
|
where 1=1
|
|
|
<if test="storeId != null and storeId != ''">
|
|
|
AND o.store_id = #{storeId}
|
|
@@ -507,44 +528,62 @@
|
|
|
<if test="merchSn != null and merchSn.trim() != ''">
|
|
|
AND o.merch_sn = #{merchSn}
|
|
|
</if>
|
|
|
+ <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
|
|
|
+ AND s.third_party_merch_code = #{thirdPartyMerchCode}
|
|
|
+ </if>
|
|
|
group by o.user_id) u
|
|
|
</select>
|
|
|
<select id="getTodayUserOrder" resultType="int">
|
|
|
- select count(1) from mall_order o where pay_status = 2 and pay_time > date_format(sysdate(), '%Y-%m-%d')
|
|
|
+ select count(1) from mall_order o
|
|
|
+ left join mall_store s on o.store_id = s.id
|
|
|
+ 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>
|
|
|
-
|
|
|
+ <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
|
|
|
+ AND s.third_party_merch_code = #{thirdPartyMerchCode}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
<select id="getTodayUserSales" resultType="int">
|
|
|
- select ifnull(sum(actual_price),0) from mall_order o where pay_status = 2 and pay_time > date_format(sysdate(), '%Y-%m-%d')
|
|
|
+ select ifnull(sum(o.actual_price),0) from mall_order o
|
|
|
+ left join mall_store s on o.store_id = s.id where o.pay_status = 2 and o.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>
|
|
|
-
|
|
|
+ <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
|
|
|
+ AND s.third_party_merch_code = #{thirdPartyMerchCode}
|
|
|
+ </if>
|
|
|
</select>
|
|
|
<select id="getIncomeSum" resultType="int">
|
|
|
- select ifnull(sum(actual_price),0) from mall_order where pay_status = 2
|
|
|
+ select ifnull(sum(actual_price),0) from mall_order o
|
|
|
+ left join mall_store s on o.store_id = s.id where o.pay_status = 2
|
|
|
<if test="storeId != null and storeId != ''">
|
|
|
- AND store_id = #{storeId}
|
|
|
+ AND o.store_id = #{storeId}
|
|
|
</if>
|
|
|
<if test="merchSn != null and merchSn.trim() != ''">
|
|
|
- AND merch_sn = #{merchSn}
|
|
|
+ AND o.merch_sn = #{merchSn}
|
|
|
+ </if>
|
|
|
+ <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
|
|
|
+ AND s.third_party_merch_code = #{thirdPartyMerchCode}
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="getPayedOrderCount" resultType="int">
|
|
|
- select count(1) from mall_order where pay_status = 2 and is_onffline_order = 0
|
|
|
+ select count(1) from mall_order o
|
|
|
+ left join mall_store s on o.store_id = s.id where o.pay_status = 2 and o.is_onffline_order = 0
|
|
|
<if test="storeId != null and storeId != ''">
|
|
|
- AND store_id = #{storeId}
|
|
|
+ AND o.store_id = #{storeId}
|
|
|
</if>
|
|
|
<if test="merchSn != null and merchSn.trim() != ''">
|
|
|
- AND merch_sn = #{merchSn}
|
|
|
+ AND o.merch_sn = #{merchSn}
|
|
|
+ </if>
|
|
|
+ <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
|
|
|
+ AND s.third_party_merch_code = #{thirdPartyMerchCode}
|
|
|
</if>
|
|
|
</select>
|
|
|
</mapper>
|