1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/gitee-community-gitee-7th-event-3

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
В этом репозитории не указан файл с открытой лицензией (LICENSE). При использовании обратитесь к конкретному описанию проекта и его зависимостям в коде.
Клонировать/Скачать
发个sql吧 去除了一些注释 5.4 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
活雷锋 Отправлено 09.06.2020 12:32 26c85a8
select
o.id,
o.user_name,
o.update_time,
o.creat_time,
o.is_rollout,
o.is_platform,
o.order_no,
o.appointed_time,
o.sku_level,
o.sku_name,
o.service_type_name,
o.repair_address,
o.address_details,
o.village,
o.remarks,
o.repair_remarks,
o.status,
o.status_name,
o.labor_cost,
o.material_cost,
o.additional_cost,
o.is_prepay,
o.prepayment,
o.merchant_id,
o.merchant_name,
o.is_assign,
o.longitude,
o.latitude,
o.is_activity,
o.activity_id,
o.activity_type,
o.activity_money,
o.is_coupon,
o.coupon_id,
o.coupon_money,
o.coupon_company_pay_money,
o.coupon_xg_pay_money,
o.coupon_dealer_pay_money,
o.coupon_merchant_pay_money,
o.payment_type,
o.end_type,
o.type,
o.origin,
o.count,
o.city_code,
o.city_name,
o.city_area,
o.city_area_name,
o.freezing_days,
o.commission_type,
o.dealer_commission,
o.xg_commission,
o.sku_type,
o.labor_cost_code,
o.material_cost_code,
o.additional_cost_code,
o.third_order_no,
o.sku_item_name,
o.sku_item_id,
o.quote_remarks,
o.merchant_order_no,
o.is_abnormality,
o.order_receiving_time,
o.retention_time,
o.refund_type,
o.refund_status,
o.material_cost_details,
o.additional_cost_details,
o.is_rewards_punish,
o.merchant_pay_type,
o.modify_count,
o.income_xg,
o.order_type,
o.groupon_id,
o.insurance_no1,
o.insurance_no2,
o.insurance_type,
o.unit,
o.price as cprice, o.price as bprice, a.name as activity_name,
CONCAT('每人',if(a.daily_limits is null,CONCAT(' ') , CONCAT('每天限',a.daily_limits,'单')),if(a.total_limits is null,' ' , CONCAT('总共限',a.total_limits,'单'))) as activity_summary,
-- p.details as problem_details,
IF(ro.id is null and o.is_duty_free!='1',
IF(o.sku_type = '1' ,
IF(o.commission_type = '2',
<!--
ROUND((o.labor_cost+o.additional_cost + o.material_cost) * (1 - 0.08) * (1 - o.xg_commission),
2),
ROUND(o.xg_commission * (1 - 0.08),
2)),
ROUND(o.price * (1 - 0.08) * (1 - o.xg_commission), 2)) -->
ROUND((o.labor_cost+o.additional_cost + o.material_cost) * (1 - 0.00) * (1 - o.xg_commission),
2),
ROUND(o.xg_commission * (1 - 0.00),
2)),
ROUND(o.price * (1 - 0.00) * (1 - o.xg_commission), 2))
,
IF(o.sku_type = '1' ,
IF(o.commission_type = '2',
ROUND((o.labor_cost+o.additional_cost + o.material_cost) * (1 - o.xg_commission),
2),
ROUND(o.xg_commission,
2)),
ROUND(o.price * (1 - 0.00), 2))
) AS fixed_xg_money,
ROUND(asku.preferential_value, 2) as xg_activity_money
FROM
t_order o
LEFT JOIN
t_activity_record ar ON o.id = ar.order_id AND ar.is_enable=1 AND ar.user_type=2
LEFT JOIN
t_activity a ON ar.activity_id = a.id AND a.is_enable=1
LEFT JOIN
t_activity_sku asku ON asku.activity_id = a.id AND asku.is_enable=1 AND asku.id=ar.activity_sku_id
LEFT JOIN
t_problem p ON o.problem_id = p.id
LEFT JOIN
t_merchant m ON o.merchant_id = m.id AND o.is_enable=1
LEFT JOIN
t_reward_order_record ro on o.id=ro.order_id and ro.type=1 and ro.is_tax=2 AND ro.is_enable = 1
<if test="objectT.status == 1" >
left join
t_grid_order tgo on o.id=tgo.order_id and tgo.is_enable=1
left join
(select s1.id as id, s1.suppliers_id as suppliers_id, s2.spu_id as spu_id, s1.grid_id as grid_id from t_suppliers_grid s1 inner join t_suppliers_spu s2 on s1.suppliers_id=s2.suppliers_id and s1.is_enable=1 and s2.is_enable=1) tsg
on tsg.spu_id=o.sku_item_id and tgo.grid_id=tsg.grid_id
</if>
WHERE o.is_enable=1
<if test="objectT.status == 1" > and o.status = 2
<!--<choose>-->
<!--<when test="objectT.suppliersId!=null and objectT.suppliersId!=0">-->
<!--and tsg.suppliers_id=#{objectT.suppliersId}-->
<!--</when>-->
<!--<otherwise>-->
<!--and if(tsg.id is not null ,o.down_time &lt; DATE_SUB(SYSDATE(),INTERVAL 10 MINUTE) ,1=1)-->
<!--</otherwise>-->
<!--</choose>-->
<if test="objectT.cityCode != null" > and o.city_code = #{objectT.cityCode} </if>
</if>
<if test="objectT.status == 2" > and o.status in (3,4,5,6,7,10,11,12,21)
<if test="objectT.xgId!= null" > and o.xg_id = #{objectT.xgId}</if>
</if>
<if test="objectT.status == 3" > and o.is_assign = 2 and o.status in (15,17,19)
<if test="objectT.xgId!= null" > and o.xg_id = #{objectT.xgId}</if>
</if>
<if test="objectT.status == 4" > and o.status in (8,9,16,14,13)
<if test="objectT.xgId!= null" > and o.xg_id = #{objectT.xgId}</if>
</if>
<if test="objectT.status == 6" >
AND o.`status` not in (1,22,23)
AND m.type =5
<if test="objectT.xgId!= null" >AND o.merchant_id =(select xg.merchant_id from t_xg xg where xg.id = #{objectT.xgId} )</if>
</if>
<if test="objectT.status == 1" >
AND ( (o.merchant_id is null or (o.merchant_id is not null and o.is_platform ='2')) or
IF(m.label_state = '2' AND o.is_platform = '1' ,
o.merchant_id = (SELECT
tl.merchant_id
FROM
t_xg_label tl
where tl.is_enable = 1
AND tl.merchant_id = o.merchant_id
AND tl.status = 3
AND tl.xg_id = #{objectT.xgId} limit 0,1),
1 = 1)
)
</if>
group by o.id
<if test="objectT.status == 4" >
order by o.update_time desc
</if>
<if test="objectT.status != 4 and objectT.status != 6 " >
order by o.appointed_time desc
</if>
<if test="objectT.status == 6" >
order by o.creat_time desc
</if>

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/gitee-community-gitee-7th-event-3.git
git@api.gitlife.ru:oschina-mirror/gitee-community-gitee-7th-event-3.git
oschina-mirror
gitee-community-gitee-7th-event-3
gitee-community-gitee-7th-event-3
master