说明:以下 SQL 默认基于元数据库 MySQL,查询前请将 SQL 中的 '你的dom_id' 替换为目标客户的域 ID。
二、基础信息查询 1、基础信息总表 select sc_id, name as schedule_name, sc_type, msg_type, trigger_type, resource_id, enabled, u_id, validstarttime, validendtime, last_send_time, last_send_status from schedule where dom_id = '你的dom_id' and is_del = 0 order by ctime desc; 2、各订阅类型数量校验 select sc_type, count(*) as cnt from schedule where dom_id = '你的dom_id' and is_del = 0 group by sc_type order by sc_type; 三、各类订阅对象明细查询 1、卡片订阅对象明细 select s.sc_id, s.name as schedule_name, s.u_id, s.msg_type, s.trigger_type, s.enabled, s.validstarttime, s.validendtime, s.last_send_time, s.last_send_status, c.cd_id as obj_id, c.name as obj_name from schedule s join card c on s.resource_id = c.cd_id and s.dom_id = c.dom_id where s.dom_id = '你的dom_id' and s.is_del = 0 and s.sc_type = 0; 2、页面订阅对象明细 select s.sc_id, s.name as schedule_name, s.u_id, s.msg_type, s.trigger_type, s.enabled, s.validstarttime, s.validendtime, s.last_send_time, s.last_send_status, p.pg_id as obj_id, p.name as obj_name from schedule s join page p on s.resource_id = p.pg_id and s.dom_id = p.dom_id where s.dom_id = '你的dom_id' and s.is_del = 0 and s.sc_type = 1; 3、合并订阅对象明细 select s.sc_id, s.name as schedule_name, 'CARD' as obj_type, m.cd_id as obj_id, c.name as obj_name from schedule s join schedule_multicards_mapping m on s.resource_id = m.resource_id and s.dom_id = m.dom_id join card c on m.cd_id = c.cd_id and m.dom_id = c.dom_id where s.dom_id = '你的dom_id' and s.is_del = 0 and s.sc_type = 2 and m.cd_id is not null union all select s.sc_id, s.name as schedule_name, 'PAGE' as obj_type, m.pg_id as obj_id, p.name as obj_name from schedule s join schedule_multicards_mapping m on s.resource_id = m.resource_id and s.dom_id = m.dom_id join page p on m.pg_id = p.pg_id and m.dom_id = p.dom_id where s.dom_id = '你的dom_id' and s.is_del = 0 and s.sc_type = 2 and m.pg_id is not null union all select s.sc_id, s.name as schedule_name, 'COMBINED_REPORT' as obj_type, m.cr_id as obj_id, cr.name as obj_name from schedule s join schedule_multicards_mapping m on s.resource_id = m.resource_id and s.dom_id = m.dom_id join combined_report cr on m.cr_id = cr.rep_id and m.dom_id = cr.dom_id where s.dom_id = '你的dom_id' and s.is_del = 0 and s.sc_type = 2 and m.cr_id is not null; 4、模板消息订阅对象明细 select s.sc_id, s.name as schedule_name, 'CARD' as obj_type, m.cd_id as obj_id, c.name as obj_name from schedule s join schedule_multicards_mapping m on s.resource_id = m.resource_id and s.dom_id = m.dom_id join card c on m.cd_id = c.cd_id and m.dom_id = c.dom_id where s.dom_id = '你的dom_id' and s.is_del = 0 and s.sc_type = 4 and m.cd_id is not null union all select s.sc_id, s.name as schedule_name, 'PAGE' as obj_type, m.pg_id as obj_id, p.name as obj_name from schedule s join schedule_multicards_mapping m on s.resource_id = m.resource_id and s.dom_id = m.dom_id join page p on m.pg_id = p.pg_id and m.dom_id = p.dom_id where s.dom_id = '你的dom_id' and s.is_del = 0 and s.sc_type = 4 and m.pg_id is not null; 5、数据集订阅对象明细 select s.sc_id, s.name as schedule_name, s.u_id, s.msg_type, s.trigger_type, s.enabled, s.validstarttime, s.validendtime, s.last_send_time, s.last_send_status, d.ds_id as obj_id, d.name as obj_name from schedule s join data_source d on s.resource_id = d.ds_id and s.dom_id = d.dom_id where s.dom_id = '你的dom_id' and s.is_del = 0 and s.sc_type = 3; 6、智能洞察订阅对象明细 elect s.sc_id, s.name as schedule_name, 'INTELLIGENT_INSIGHT_CARD' as obj_type, m.cd_id as obj_id, c.name as obj_name from schedule s join schedule_multicards_mapping m on s.resource_id = m.resource_id and s.dom_id = m.dom_id join card c on m.cd_id = c.cd_id and m.dom_id = c.dom_id where s.dom_id = '你的dom_id' and s.is_del = 0 and s.sc_type = 5 and m.cd_id is not null union all select s.sc_id, s.name as schedule_name, 'PAGE' as obj_type, m.pg_id as obj_id, p.name as obj_name from schedule s join schedule_multicards_mapping m on s.resource_id = m.resource_id and s.dom_id = m.dom_id join page p on m.pg_id = p.pg_id and m.dom_id = p.dom_id where s.dom_id = '你的dom_id' and s.is_del = 0 and s.sc_type = 5 and m.pg_id is not null; 四、基础字段含义说明
|