云管家跟进列表树状结构取数
时间:2020-04-22
本文章向大家介绍 云管家跟进列表树状结构取数,主要包括 云管家跟进列表树状结构取数使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
通过对相应的数值判断,获取对应的。
有空的时候进行学习
--odps sql --********************************************************************-- --description:云管家服务跟进记录明细表(JZSJZN-20628,分析师:何柏喜) --author:shanwei --create time:2020-04-20 16:43:34 --********************************************************************-- insert overwrite table a_jz_after_cloud_visit_record_detail select rec.order_id --订单ID ,rec.customer_passport_id --客户passort id ,ord.category_text as category_name --业务类型 ,rec.create_time as record_create_time --跟进创建时间 ,ord.sign_pass_time --审核通过单时间 ,ord.city_name --城市 ,ord.audit_adviser_name as order_audit_adviser_name --审核订单归属经纪人 ,rec.creater_name as cloud_housekeeper_name --管家姓名 ,user.office_name as cloud_housekeepe_office_name --云管家小组 ,item.service_name as item_service_name --服务项名称 ,worker_num.order_worker_num --订单劳动者数 ,ord.status_text as order_status --订单状态 ,ord.sign_type_text as sign_type --订单类型 ,new_cpid.cpid as new_worker_cpid --(最新)劳动者id ,worker.real_name as new_worker_name --(最新)劳动者姓名 ,ord.appointment_begin_date ,ord.appointment_end_date ,item.service_days ,item.service_end_time ,item.service_begin_time ,ord.cancel_submit_time ,ord.cancel_pass_time ,case when rec.service_target_type = 1 then '客户' when rec.service_target_type = 2 then '商家' else rec.service_target_type end as service_target_type --服务对象类型 ,rec.service_type --服务类型 ,rec_lab.service_lable_name --服务标签 ,rec_lab.service_parent_lable_name1 --服务标签父级节点1 ,rec_lab.service_parent_lable_name2 --服务标签父级节点2 ,rec_lab.service_parent_lable_name3 --服务标签父级节点3 ,rec_lab.service_parent_lable_name4 --服务标签父级节点4 ,rec_lab.service_parent_lable_name5 --服务标签父级节点5 ,rec_lab.service_parent_lable_name6 --服务标签父级节点6 ,rec.service_description --服务描述 from f_jz_after_service_visit_record rec left join f_jz_order_common ord on rec.order_id = ord.id left join f_jz_order_item item on rec.order_item_id = item.id left join ( select order_id,count(distinct cpid) as order_worker_num from f_jz_order_item group by order_id ) worker_num on rec.order_id = worker_num.order_id left join ( select order_id,cpid from ( select order_id,cpid ,row_number() over(partition by order_id order by item_create_time desc) as desc_num from f_jz_order_item ) t where desc_num = 1 ) new_cpid on rec.order_id = new_cpid.order_id left join f_jz_worker_info worker on new_cpid.cpid = worker.cpassportid left join d_sys_user user on rec.creater_id = user.id left join ( select t1.id,t2.lable_name as service_lable_name ,if(t2.parent_lable_name6 is not null ,t2.parent_lable_name6 ,if(t2.parent_lable_name5 is not null ,t2.parent_lable_name5 ,if(t2.parent_lable_name4 is not null ,t2.parent_lable_name4 ,if(t2.parent_lable_name3 is not null ,t2.parent_lable_name3 ,if(t2.parent_lable_name2 is not null ,t2.parent_lable_name2 ,t2.parent_lable_name1))))) as service_parent_lable_name1 ,if(t2.parent_lable_name6 is not null and t2.parent_lable_name5 is not null ,t2.parent_lable_name5 ,if(t2.parent_lable_name5 is not null and t2.parent_lable_name4 is not null ,t2.parent_lable_name4 ,if(t2.parent_lable_name4 is not null and t2.parent_lable_name3 is not null ,t2.parent_lable_name3 ,if(t2.parent_lable_name3 is not null and t2.parent_lable_name2 is not null ,t2.parent_lable_name2 ,if(t2.parent_lable_name2 is not null and t2.parent_lable_name1 is not null ,t2.parent_lable_name1 ,null))))) as service_parent_lable_name2 ,if(t2.parent_lable_name6 is not null and t2.parent_lable_name5 is not null and t2.parent_lable_name4 is not null ,t2.parent_lable_name4 ,if(t2.parent_lable_name5 is not null and t2.parent_lable_name4 is not null and t2.parent_lable_name3 is not null ,t2.parent_lable_name3 ,if(t2.parent_lable_name4 is not null and t2.parent_lable_name3 is not null and t2.parent_lable_name2 is not null ,t2.parent_lable_name2 ,if(t2.parent_lable_name3 is not null and t2.parent_lable_name2 is not null and t2.parent_lable_name1 is not null ,t2.parent_lable_name1 ,null)))) as service_parent_lable_name3 ,if(t2.parent_lable_name6 is not null and t2.parent_lable_name5 is not null and t2.parent_lable_name4 is not null and t2.parent_lable_name3 is not null ,t2.parent_lable_name3 ,if(t2.parent_lable_name5 is not null and t2.parent_lable_name4 is not null and t2.parent_lable_name3 is not null and t2.parent_lable_name2 is not null ,t2.parent_lable_name2 ,if(t2.parent_lable_name4 is not null and t2.parent_lable_name3 is not null and t2.parent_lable_name2 is not null and t2.parent_lable_name1 is not null ,t2.parent_lable_name1 ,null))) as service_parent_lable_name4 ,if(t2.parent_lable_name6 is not null and t2.parent_lable_name5 is not null and t2.parent_lable_name4 is not null and t2.parent_lable_name3 is not null and t2.parent_lable_name2 is not null ,t2.parent_lable_name2 ,if(t2.parent_lable_name5 is not null and t2.parent_lable_name4 is not null and t2.parent_lable_name3 is not null and t2.parent_lable_name2 is not null and t2.parent_lable_name1 is not null ,t2.parent_lable_name1 ,null)) as service_parent_lable_name5 ,if(t2.parent_lable_name6 is not null and t2.parent_lable_name5 is not null and t2.parent_lable_name4 is not null and t2.parent_lable_name3 is not null and t2.parent_lable_name2 is not null and t2.parent_lable_name1 is not null ,t2.parent_lable_name1 ,null) as service_parent_lable_name6 from ( select id,service_lable from f_jz_after_service_visit_record lateral view explode(split(service_lables,',')) b as service_lable ) t1 left join f_jz_after_lables t2 on t1.service_lable = cast(t2.id as string) ) rec_lab on rec.id = rec_lab.id ;
原文地址:https://www.cnblogs.com/sakura3/p/12751777.html
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- Android gradle配置抽取合并的操作步骤
- Android BottomNavigationBar底部导航的使用方法
- Android超清晰6.0权限申请AndPermission
- Android仿微信录制语音功能
- Android仿微信语音对讲录音功能
- flutter 屏幕尺寸适配和字体大小适配的实现
- flutter传递值到任意widget(当需要widget嵌套使用需要传递值的时候)
- android 9.0 launcher3 去掉抽屉式显示所有 app(代码详解)
- 图论-多源最短路径(Floyd算法)
- Android9.0 SystemUI 网络信号栏定制修改的流程解析
- 解决Android 10/Android Q手机在后台无法正常定位问题
- C语言CGI编程入门(一)
- android RecycleView实现下拉刷新和上拉加载
- 解析Android 8.1平台SystemUI 导航栏加载流程
- Mysql系列第二十二讲 mysql索引管理详解