SELECT id,agent_id,agent_name,department_id,department_name,status_type,TIMEDIFF(NOW(),status_start_time) as 持续时长,status,status_threshold_value,status_start_time,max_size,current_size,session_count,effective_session_count,total_response_time,total_response_time_s,average_response_time,average_response_time_s,total_session_time,total_session_time_s,average_session_time,average_session_time_s,agent_service_time,agent_service_time_s,attend_comment_count,satisfactory_count,satisfactory_rate,
CASE WHEN status != "离线" THEN CONCAT(
FLOOR((UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(status_start_time) + total_response_time) / 3600), ':',
FLOOR(((UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(status_start_time) + total_response_time) % 3600) / 60), ':',
((UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(status_start_time) + total_response_time) % 60)
) ELSE online_time_total_s END AS online_time
FROM
mn_agent_monitor;
纯sql将时间戳的差和另一个时间戳的差相加再转成时分秒的形式
该SQL查询从mn_agent_monitor表中获取了监控数据,包括代理人ID、部门ID、状态类型和开始时间等信息。计算了当前离线或在线的持续时长,并着重分析了总响应时间和在线时间。同时,还统计了满意度评分、会话量以及平均会话和响应时间等关键性能指标。
摘要由CSDN通过智能技术生成