| @@ -471,7 +471,7 @@ | |||||
| o.order_status,o.create_date,o.update_date,o.detail,'[多商户交易]' merchant_name,cubi.`name` c_user_name,cubi.phone | o.order_status,o.create_date,o.update_date,o.detail,'[多商户交易]' merchant_name,cubi.`name` c_user_name,cubi.phone | ||||
| from | from | ||||
| ( | ( | ||||
| select o.* from wx_order o where o.type=0 and o.id in( | |||||
| select o.* from wx_order o where o.type=0 and o.order_status = 1 and o.id in( | |||||
| select o.id from wx_order o left join wx_coupon_merchant cm | select o.id from wx_order o left join wx_coupon_merchant cm | ||||
| on o.product_id=cm.product_id group by o.id having count(o.id)>1)) o | on o.product_id=cm.product_id group by o.id having count(o.id)>1)) o | ||||
| left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id | left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id | ||||
| @@ -480,7 +480,7 @@ | |||||
| o.order_status,o.create_date,o.update_date,o.detail,m.`name` merchant_name,cubi.`name` c_user_name,cubi.phone | o.order_status,o.create_date,o.update_date,o.detail,m.`name` merchant_name,cubi.`name` c_user_name,cubi.phone | ||||
| from( | from( | ||||
| select o.*,cm.merchant_id from ( | select o.*,cm.merchant_id from ( | ||||
| select o.* from wx_order o where o.type=0 and o.id not in( | |||||
| select o.* from wx_order o where o.type=0 and o.order_status = 1 and o.id not in( | |||||
| select o.id from wx_order o left join wx_coupon_merchant cm | select o.id from wx_order o left join wx_coupon_merchant cm | ||||
| on o.product_id=cm.product_id group by o.id having count(o.id)>1) | on o.product_id=cm.product_id group by o.id having count(o.id)>1) | ||||
| ) o | ) o | ||||
| @@ -488,7 +488,7 @@ | |||||
| union all | union all | ||||
| select o.*,mbu.merchant_id from wx_order o | select o.*,mbu.merchant_id from wx_order o | ||||
| left join wx_merchant_b_user mbu on o.product_id=mbu.id | left join wx_merchant_b_user mbu on o.product_id=mbu.id | ||||
| where type in (1,2))o | |||||
| where o.type in (1,2) and o.order_status = 1 ) o | |||||
| left join wx_merchant m on o.merchant_id=m.id | left join wx_merchant m on o.merchant_id=m.id | ||||
| left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id | left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id | ||||
| union all | union all | ||||
| @@ -496,7 +496,7 @@ | |||||
| o.order_status,o.create_date,o.update_date,o.detail,m.`name` merchant_name,cubi.`name` c_user_name,cubi.phone | o.order_status,o.create_date,o.update_date,o.detail,m.`name` merchant_name,cubi.`name` c_user_name,cubi.phone | ||||
| from wx_order o left join wx_merchant m on o.product_id=m.id | from wx_order o left join wx_merchant m on o.product_id=m.id | ||||
| left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id | left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id | ||||
| where o.type=3 | |||||
| where o.type=3 and o.order_status = 1 | |||||
| ) o | ) o | ||||
| <where> | <where> | ||||
| <if test="tenantId!=null"> | <if test="tenantId!=null"> | ||||
| @@ -516,49 +516,49 @@ | |||||
| <select id="queryOrderForMerchantCount" resultType="Long" parameterType="hashmap"> | <select id="queryOrderForMerchantCount" resultType="Long" parameterType="hashmap"> | ||||
| select count(*) merchantCount from ( | select count(*) merchantCount from ( | ||||
| select distinct merchant_id from ( | select distinct merchant_id from ( | ||||
| select o.*,m.`name` merchantName from ( | |||||
| select o.*, m.`name` merchantName from ( | |||||
| select o.*,cm.merchant_id from wx_order o | select o.*,cm.merchant_id from wx_order o | ||||
| left join wx_coupon_merchant cm on o.product_id=cm.product_id | left join wx_coupon_merchant cm on o.product_id=cm.product_id | ||||
| where type in (0,3)) o | |||||
| where o.type in (0,3) and o.order_status = 1) o1 | |||||
| left join wx_merchant m on o.merchant_id=m.id | left join wx_merchant m on o.merchant_id=m.id | ||||
| union all | union all | ||||
| select o.*,m.`name` merchantName from ( | select o.*,m.`name` merchantName from ( | ||||
| select o.*,mbu.merchant_id from wx_order o | select o.*,mbu.merchant_id from wx_order o | ||||
| left join wx_merchant_b_user mbu on o.product_id=mbu.id | left join wx_merchant_b_user mbu on o.product_id=mbu.id | ||||
| where type in (1,2)) o | |||||
| where o.type in (1,2) and o.order_status = 1) o1 | |||||
| left join wx_merchant m on o.merchant_id=m.id | left join wx_merchant m on o.merchant_id=m.id | ||||
| ) o | ) o | ||||
| <where> | <where> | ||||
| <if test="tenantId!=null"> | <if test="tenantId!=null"> | ||||
| and tenant_id =#{tenantId} | |||||
| and o.tenant_id =#{tenantId} | |||||
| </if> | </if> | ||||
| <if test="startdate!=null and enddate!=null"> | <if test="startdate!=null and enddate!=null"> | ||||
| and create_date between #{startdate} and #{enddate} | |||||
| and o.create_date between #{startdate} and #{enddate} | |||||
| </if> | </if> | ||||
| </where> | </where> | ||||
| ) o | ) o | ||||
| </select> | </select> | ||||
| <select id="queryOrderForSum" resultType="Long" parameterType="hashmap"> | <select id="queryOrderForSum" resultType="Long" parameterType="hashmap"> | ||||
| select ifnull(sum(payment),0) payment from ( | |||||
| select ifnull(sum(o.payment),0) payment from ( | |||||
| select o.*,m.`name` merchantName from ( | select o.*,m.`name` merchantName from ( | ||||
| select o.*,cm.merchant_id from wx_order o | select o.*,cm.merchant_id from wx_order o | ||||
| left join wx_coupon_merchant cm on o.product_id=cm.product_id | left join wx_coupon_merchant cm on o.product_id=cm.product_id | ||||
| where type in (0,3)) o | |||||
| where o.type in (0,3) and o.order_status = 1) o1 | |||||
| left join wx_merchant m on o.merchant_id=m.id | left join wx_merchant m on o.merchant_id=m.id | ||||
| union all | union all | ||||
| select o.*,m.`name` merchantName from ( | select o.*,m.`name` merchantName from ( | ||||
| select o.*,mbu.merchant_id from wx_order o | select o.*,mbu.merchant_id from wx_order o | ||||
| left join wx_merchant_b_user mbu on o.product_id=mbu.id | left join wx_merchant_b_user mbu on o.product_id=mbu.id | ||||
| where type in (1,2)) o | |||||
| where o.type in (1,2) and o.order_status = 1) o1 | |||||
| left join wx_merchant m on o.merchant_id=m.id | left join wx_merchant m on o.merchant_id=m.id | ||||
| ) o | ) o | ||||
| <where> | <where> | ||||
| <if test="tenantId!=null"> | <if test="tenantId!=null"> | ||||
| and tenant_id =#{tenantId} | |||||
| and o.tenant_id =#{tenantId} | |||||
| </if> | </if> | ||||
| <if test="startdate!=null and enddate!=null"> | <if test="startdate!=null and enddate!=null"> | ||||
| and create_date between #{startdate} and #{enddate} | |||||
| and o.create_date between #{startdate} and #{enddate} | |||||
| </if> | </if> | ||||
| </where> | </where> | ||||
| </select> | </select> | ||||