select * from(
SELECT
TMM.ORDER_ID,
TMM.IMPORT_ID,
TMM.TMALL_ORDER_ID,
TMM.MEMBER_NAME,
TMM.ALIPAY_USER_NAME,
TMM.ALIPAY_PAID_FEE,
TMM.MESSAGE,
TMM.MESSAGE_SOURCE,
CASE TMM.MESSAGE_SOURCE
WHEN 'app' THEN
'app端'
WHEN 'pc' THEN
'PC端'
WHEN 'wap' THEN
'wap端'
WHEN 'tm' THEN
'天猫'
END AS MESSAGE_SOURCE_NAME,
TMM.RECEIVE_USER,
replace(TMM.RECEIVE_FULL_ADDRESS,substr(TMM.RECEIVE_FULL_ADDRESS,round(length(TMM.RECEIVE_FULL_ADDRESS)
, ),nvl(#strLength#,)),'*****') RECEIVE_FULL_ADDRESS,
replace(
TMM.RECEIVE_TEL, substr( TMM.RECEIVE_TEL, , nvl(#strLength#,)),
'****') AS RECEIVE_TEL,
TMM.ORDER_CREATE_TIME,
TMM.GOODS_NO,
TMM.GOODS_TOPIC,
TMM.GOODS_COUNT,
TMM.IS_CALLBACK,
DECODE(TMM.IS_CALLBACK,'N','未回访','Y','已回访') as IS_CALLBACK_NAME,
TMM.IS_BUY,
DECODE(tmm.IS_BUY,'N','未购买','Y','已购买') as IS_BUY_NAME,
TMM.NOT_BUY_REASON,
TMM.NOT_BUY_REASON_NOTE,
TMM.CALLBACK_TIME,
TMM.COMMIT_USERID,
TMM.CALLBACK_USERID,
TMM.USER_TYPE,
DECODE(tmm.USER_TYPE,'N','一次购买用户','Y','二次购买用户') as USER_TYPE_NAME,
TMM.CUSTOMER_NATURE,
CASE TMM.CUSTOMER_NATURE
WHEN 'dg' THEN
'代购'
WHEN 'zy' THEN
'自用'
WHEN 'yf' THEN
'药贩'
END AS CUSTOMER_NATURE_NAME,
DECODE(tmm.DISTRIBUTION_TYPE,'N','未分配','A','系统自动分配','H','手动分配') as DISTRIBUTION_TYPE_NAME,
TMM.DISTRIBUTION_TYPE,
(select user_name from fecerp.sys_user where user_id = tmm.SERVICE_NUM and
is_delete='N') AS SERVICE_NAME,
TMM.MESSAGE_TIME,
(select s.code_value from sys_code s where s.code_id=TMM.NOT_BUY_REASON and s.is_delete='N') as NOT_BUY_REASON_NAME,
tmm.ASSIGN_NUM,
(select user_id from fecerp.sys_user where user_name = TMM.ASSIGN_NUM and is_delete = 'N') as ASSIGN_ID,
ALIPAY_ORDER_FEE,
ALIPAY_DELIVERY_FEE,
ALIPAY_TOTAL_FEE,
(select s.code_type_no
from sys_code s
where s.code_id = NOT_BUY_REASON
and s.is_delete = 'N') as CODE_TYPE_NO,
NOTE
FROM TMALL_TC_MESSAGE TMM
where TMM.Is_Delete='N') mai
05-11 15:10