Commit c5e74ab4 by 章家宝

七月大版本dml

1 parent f3e07643
......@@ -35,18 +35,35 @@ VALUES (
now() created_date
from (
select custodian_phone 员工id,''''4s店商户号,''''业务类型, ''''scene_type, custodian 员工姓名,'''' 门店,custodian_phone as 员工手机号 from inspection_asset_management where deleted_flag=''N'' and custodian_phone not in (
select distinct phone_number 员工手机号 from dj_car_life_staff_info where deleted_flag = ''N''
and staff_uuid in (select distinct seller_user_id from
( select ifnull(b.success_date,a.order_time) order_time ,a.merchant_id, a.merchant_name, a.seller_user_id,a.scene_type,a.seller_name,a.status, a.deleted_flag, a.upgrade_flag
from dj_car_life_goods_order a
left join (select * from dj_car_life_pay_order where deleted_flag = ''N'' and order_code is not null) b on a.order_code=b.order_code) dclgo
where dclgo.deleted_flag=''N''
and dclgo.status in (2, 4, 6)
and dclgo.upgrade_flag in (''Y'',''N'')
and seller_user_id is not null
and scene_type in (0,1)
and DATE_FORMAT(dclgo.order_time,''%Y-%m-%d'') between date_sub(date_format(''starttimexxxxxx'',''%Y-%m-%d''),INTERVAL 1 month)and ''endtimexxxxxx''
SELECT
iam.custodian_phone AS 员工id,
'' AS 4s店商户号,
'' AS 业务类型,
'' AS scene_type,
iam.custodian AS 员工姓名,
'' AS 门店,
iam.custodian_phone AS 员工手机号
FROM inspection_asset_management iam
WHERE iam.deleted_flag = 'N'
AND NOT EXISTS (
SELECT 1
FROM dj_car_life_staff_info dclsi
WHERE dclsi.deleted_flag = 'N'
AND dclsi.phone_number = iam.custodian_phone
AND EXISTS (
SELECT 1
FROM dj_car_life_goods_order a
LEFT JOIN dj_car_life_pay_order b ON a.order_code = b.order_code
AND b.deleted_flag = 'N'
AND b.order_code IS NOT NULL
WHERE a.seller_user_id = dclsi.staff_uuid
AND a.deleted_flag = 'N'
AND a.status IN (2, 4, 6)
AND a.upgrade_flag IN ('Y', 'N')
AND a.seller_user_id IS NOT NULL
AND a.scene_type IN (0, 1)
AND DATE_FORMAT(IFNULL(b.success_date, a.order_time), '%Y-%m-%d')
BETWEEN DATE_SUB(DATE_FORMAT('starttimexxxxxx', '%Y-%m-%d'), INTERVAL 1 MONTH) AND 'endtimexxxxxx'
)
)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!