| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="api.mapper.report.ReportMapper">
- <resultMap type="api.entity.view.report.Report" id="SysReportResult">
- <result property="DATE" column="DATE" />
- <result property="number" column="number" />
- </resultMap>
- <resultMap type="api.entity.view.report.HourReport" id="SysReportHourResult">
- <result property="DATE" column="DATE" />
- <result property="number" column="number" />
- </resultMap>
- <resultMap type="api.entity.view.report.OnlineServiceReport" id="SysOnlineServiceReport">
- <result property="userCode" column="userCode" />
- <result property="userName" column="userName" />
- <result property="sessionVolume" column="sessionVolume" />
- <result property="message" column="message" />
- <result property="workOrderNum" column="workOrderNum" />
- </resultMap>
- <resultMap type="api.entity.view.report.WorkOrderTypeReport" id="SysWorkOrderTypeReport">
- <result property="type_name" column="type_name" />
- <result property="type_count" column="type_count" />
- <result property="processed" column="processed" />
- <result property="completed" column="completed" />
- </resultMap>
- <resultMap type="api.entity.view.report.RecordReport" id="SysRecordReport">
- <result property="userCode" column="userCode" />
- <result property="userName" column="userName" />
- <result property="ldCount" column="ldCount" />
- <result property="noAnswer" column="noAnswer" />
- <result property="satisfied" column="satisfied" />
- <result property="satisfactory" column="satisfactory" />
- <result property="allAnswerTime" column="allAnswerTime" />
- <result property="noSatisfied" column="noSatisfied" />
- </resultMap>
- <resultMap type="api.entity.view.report.CompleteView" id="CompleteView">
- <result property="Name" column="Name" />
- <result property="number" column="number" />
- </resultMap>
- <resultMap type="api.entity.view.report.TrafficView" id="TrafficViewResult">
- <result property="Name" column="Name" />
- <result property="incoming" column="incoming" />
- <result property="answer" column="answer" />
- <result property="noAnswer" column="noAnswer" />
- </resultMap>
- <resultMap type="api.entity.view.report.SatisfactionView" id="SatisfactionViewResult">
- <result property="basically" column="basically" />
- <result property="satisfied" column="satisfied" />
- <result property="dissatisfied" column="dissatisfied" />
- </resultMap>
- <resultMap type="api.entity.view.report.TrafficMeasurement" id="TrafficMeasurementResult">
- <result property="incoming" column="incoming" />
- <result property="answer" column="answer" />
- <result property="avgWait" column="avgWait" />
- <result property="avgAnswer" column="avgAnswer" />
- </resultMap>
- <resultMap type="api.entity.view.report.RecordDateView" id="RecordDateViewResult">
- <result property="incoming" column="incoming" />
- <result property="exhalation" column="exhalation" />
- </resultMap>
- <resultMap type="api.entity.view.report.RegionOrder" id="RegionOrderResult">
- <result property="region" column="region" />
- <result property="name" column="name" />
- <result property="number" column="number" />
- <result property="callNumber" column="callNumber" />
- <result property="visitNumber" column="visitNumber" />
- <result property="mydRate" column="mydRate" />
- </resultMap>
- <resultMap type="api.entity.view.report.TelephoneBriefing" id="TelephoneBriefingResult">
- <result property="totalCalls" column="total_calls" />
- <result property="inboundTotal" column="inbound_total" />
- <result property="inboundConnected" column="inbound_connected" />
- <result property="inboundNotConnected" column="inbound_not_connected" />
- <result property="outboundTotal" column="outbound_total" />
- <result property="outboundConnected" column="outbound_connected" />
- <result property="outboundNotConnected" column="outbound_not_connected" />
- <result property="callDuration" column="call_duration" />
- <result property="basically" column="basically" />
- <result property="satisfied" column="satisfied" />
- <result property="dissatisfied" column="dissatisfied" />
- </resultMap>
- <select id="selectCountDayRecord" parameterType="Date" resultMap="SysReportResult">
- SELECT DATE(begin_time) AS DATE,COUNT(*) number FROM `call_record`
- WHERE `begin_time`>=#{beginTime} and `begin_time` <![CDATA[<=]]> #{endTime}
- GROUP BY DATE
- ORDER BY DATE;
- </select>
- <select id="selectCountHourRecord" parameterType="Date" resultMap="SysReportHourResult">
- SELECT DATE, COUNT(*) AS number
- FROM
- (
- SELECT
- DATE_FORMAT(
- CONCAT( DATE( begin_time ), ' ', HOUR ( begin_time ), ':', FLOOR( MINUTE ( begin_time ) / 30 ) * 30 ),
- '%Y-%m-%d %H:%i'
- ) AS DATE
- FROM call_record
- WHERE `begin_time`>=#{beginTime} and `begin_time` <![CDATA[<=]]> #{endTime}
- ) a
- GROUP BY DATE
- ORDER BY DATE;
- </select>
- <select id="selectCountDayWorkOrder" parameterType="Date" resultMap="SysReportResult">
- SELECT DATE(`createtime`) AS DATE,COUNT(*) number FROM `wo_workorderbase`
- WHERE `createtime`>=#{beginTime} AND `isdelete`=0 AND `createtime`<![CDATA[<=]]> #{endTime}
- GROUP BY DATE
- ORDER BY DATE;
- </select>
- <select id="selectCountHourWorkOrder" parameterType="Date" resultMap="SysReportHourResult">
- SELECT DATE, COUNT(*) AS number
- FROM
- (
- SELECT
- DATE_FORMAT(
- CONCAT( DATE( createtime ), ' ', HOUR ( createtime ), ':', FLOOR( MINUTE ( createtime ) / 30 ) * 30 ),
- '%Y-%m-%d %H:%i'
- ) AS DATE
- FROM wo_workorderbase
- WHERE `createtime`>=#{beginTime} AND `isdelete`=0 AND `createtime`<![CDATA[<=]]> #{endTime}
- ) a
- GROUP BY DATE
- ORDER BY DATE;
- </select>
- <select id="selectCountDayMessage" parameterType="Date" resultMap="SysReportResult">
- SELECT DATE(`create_time`) AS DATE,COUNT(*) number FROM `online_message`
- WHERE `create_time`>=#{beginTime} AND `create_time`<![CDATA[<=]]> #{endTime}
- GROUP BY DATE,`kh_user`
- ORDER BY DATE;
- </select>
- <select id="selectCountHourMessage" parameterType="Date" resultMap="SysReportHourResult">
- SELECT DATE, COUNT(*) AS number
- FROM
- (
- SELECT
- DATE_FORMAT(
- CONCAT( DATE( create_time ), ' ', HOUR ( create_time ), ':', FLOOR( MINUTE ( create_time ) / 30 ) * 30 ),
- '%Y-%m-%d %H:%i'
- ) AS DATE,`kh_user`
- FROM online_message
- WHERE `create_time`>=#{beginTime} AND `create_time`<![CDATA[<=]]> #{endTime}
- ) a
- GROUP BY DATE,`kh_user`
- ORDER BY DATE;
- </select>
- <select id="selectOnlineServiceReport" parameterType="api.entity.view.report.ScreenReport" resultMap="SysOnlineServiceReport">
- SELECT `kf_user` userCode, (SELECT `nick_name` FROM `sys_user` WHERE `user_name`=a.`kf_user` LIMIT 1) userName ,
- (SELECT COUNT(DISTINCT COALESCE(`kh_user`,'NULL')) FROM `online_message` WHERE `kf_user` =a.`kf_user`
- <if test="startTime != null and startTime !=''">
- AND UNIX_TIMESTAMP(`create_time`)>=UNIX_TIMESTAMP(#{startTime})
- </if>
- <if test="endTime != null and endTime !=''">
- AND UNIX_TIMESTAMP(`create_time`)<![CDATA[<=]]> UNIX_TIMESTAMP(#{endTime})
- </if>
- )
- sessionVolume,
- (SELECT COUNT(1) FROM `online_message` WHERE `kf_user` =a.`kf_user`
- <if test="startTime != null and startTime !=''">
- AND UNIX_TIMESTAMP(`create_time`)>=UNIX_TIMESTAMP(#{startTime} )
- </if>
- <if test="endTime != null and endTime !=''">
- AND UNIX_TIMESTAMP(`create_time`)<![CDATA[<=]]> UNIX_TIMESTAMP(#{endTime})
- </if>
- ) message,
- (SELECT COUNT(*) FROM `wo_workorderbase` WHERE `createuser` =a.`kf_user`
- <if test="startTime != null and startTime !=''">
- AND UNIX_TIMESTAMP(`createtime`)>=UNIX_TIMESTAMP(#{startTime} )
- </if>
- <if test="endTime != null and endTime !='' ">
- AND UNIX_TIMESTAMP(`createtime`) <![CDATA[<=]]> UNIX_TIMESTAMP(#{endTime})
- </if>
- )workOrderNum FROM `online_link` a
- where 1=1
- <if test="startTime != null and startTime !=''">
- AND UNIX_TIMESTAMP(`last_time`)>=UNIX_TIMESTAMP(#{startTime} )
- </if>
- <if test="endTime != null and endTime !=''">
- AND UNIX_TIMESTAMP(`last_time`) <![CDATA[<=]]> UNIX_TIMESTAMP(#{endTime})
- </if>
- <if test="usercode != null and usercode != ''">
- AND `kf_user`= #{usercode}
- </if>
- GROUP BY `kf_user`
- </select>
- <select id="selectWorkOrderTypeReport" parameterType="api.entity.view.report.ScreenReport" resultMap="SysWorkOrderTypeReport">
- SELECT (SELECT `type_name` FROM `workorder_type` WHERE `id` =a.workordercate) type_name,ancestor
- ,COUNT(1) type_count ,
- SUM(CASE WHEN workorderstate>3000 THEN 1 ELSE 0 END ) processed,
- SUM(CASE WHEN workorderstate=6000 THEN 1 ELSE 0 END ) completed
- FROM `wo_workorderbase` a
- WHERE `isdelete`=0
- <if test="startTime != null and startTime !=''">
- AND UNIX_TIMESTAMP(`createtime`)>=UNIX_TIMESTAMP(#{startTime} )
- </if>
- <if test="endTime != null and endTime !=''">
- AND UNIX_TIMESTAMP(`createtime`) <![CDATA[<=]]> UNIX_TIMESTAMP(#{endTime})
- </if>
- <if test="workordertype >0 ">
- AND `workordercate`= #{workordertype}
- </if>
- <if test="ancestor >0 ">
- AND `ancestor` LIKE CONCAT('%,', #{ancestor}, ',%')
- </if>
- GROUP BY workordercate,ancestor
- </select>
- <select id="selectRecordReport" parameterType="api.entity.view.report.ScreenReport" resultMap="SysRecordReport">
- SELECT `callee_agent` userCode, (SELECT `nick_name` FROM `sys_user` WHERE `user_name` COLLATE utf8mb4_general_ci=a.`callee_agent`
- LIMIT 1 ) userName ,
- COUNT(1) ldCount,
- SUM(CASE `is_answer` WHEN 1 THEN 1 ELSE 0 END ) answer,
- SUM(CASE `is_answer` WHEN 0 THEN 1 ELSE 0 END ) noAnswer,
- SUM(CASE `is_answer` WHEN 1 THEN TIMESTAMPDIFF(SECOND, answer_time, hangup_time) ELSE 0 END ) allAnswerTime,
- -- SUM(CASE WHEN `myd`>0 and `myd` <![CDATA[<]]> 3 THEN 1 ELSE 0 END ) satisfied,
- SUM(CASE WHEN `myd`=1 THEN 1 ELSE 0 END ) satisfied,
- SUM(CASE WHEN `myd`=2 THEN 1 ELSE 0 END ) satisfactory,
- SUM(CASE WHEN `myd`=3 THEN 1 ELSE 0 END ) noSatisfied
- FROM `rep_record` a
- WHERE 1=1 AND `callee_agent`!='' AND `callee_agent` IS NOT NULL
- AND `call_type`=1
- <if test="startTime != null and startTime !=''">
- AND UNIX_TIMESTAMP(`create_time`)>=UNIX_TIMESTAMP(#{startTime})
- </if>
- <if test="endTime != null and endTime !=''">
- AND UNIX_TIMESTAMP(`create_time`) <![CDATA[<=]]> UNIX_TIMESTAMP(#{endTime})
- </if>
- <if test="usercode != null and usercode != ''">
- AND `callee_agent`= #{usercode}
- </if>
- <if test="@api.entity.view.config.GlobalConfig@isNote == 1">
- AND (note=1 or (call_type=2 and note is null ))
- </if>
- GROUP BY `callee_agent`
- </select>
- <select id="selectBusinessType" parameterType="long" resultMap="CompleteView">
- select Name , SUM(number) number from
- (select CONCAT(ancestors, ',', id) ancestors,type_name Name from workorder_type where category=0 and parent_id=0 and is_delete=0) a
- left join (select COUNT(1) number, CONCAT((select ancestors from workorder_type where id=workordercate ),',',workordercate) ancestors from
- wo_workorderbase
- where is_delete=0
- <if test="time != null and time !='' ">
- and YEAR(create_time) = YEAR(CURRENT_DATE)
- AND ${time}(create_time) = ${time}(CURRENT_DATE)
- </if>
- group by ancestors) b on CONCAT(b.ancestors,',') LIKE CONCAT('%', a.ancestors,',' '%')
- group by Name
- </select>
- <select id="selectBusinessAreaType" parameterType="long" resultMap="CompleteView">
- WITH RECURSIVE sub_areas AS (
- SELECT id FROM sys_area WHERE id = #{area}
- UNION ALL
- SELECT a.id FROM sys_area a
- INNER JOIN sub_areas sa ON a.parent_id = sa.id
- )
- select Name , SUM(number) number from
- (select CONCAT(ancestors, ',', id) ancestors,type_name Name from workorder_type where category=0 and parent_id=0 and is_delete=0) a
- left join (select COUNT(1) number, CONCAT((select ancestors from workorder_type where id=workordercate ),',',workordercate) ancestors from
- wo_workorderbase o JOIN sub_areas sa ON o.area = sa.id
- where isdelete=0
- <if test="time != null and time !='' ">
- and YEAR(createtime) = YEAR(CURRENT_DATE)
- AND ${time}(createtime) = ${time}(CURRENT_DATE)
- </if>
- group by ancestors) b on CONCAT(b.ancestors,',') LIKE CONCAT('%', a.ancestors,',' '%')
- group by Name
- </select>
- <select id="selectDealingWithTrends" parameterType="Date" resultMap="SysReportHourResult">
- SELECT
- DATE_FORMAT( create_time, '%Y-%m-%d' ) as DATE,
- count(1) number
- FROM wo_workorderbase
- group by DATE
- ORDER BY DATE;
- </select>
- <select id="selectTraffic" parameterType="Date" resultMap="TrafficViewResult">
- select
- HOUR ( create_time ) DATE ,
- count(call_type=1 or null ) incoming,
- count(call_type=1 and is_answer=1 or null ) answer,
- count(call_type=1 and is_answer=0 or null ) noAnswer
- from rep_record
- where DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
- <if test="@api.entity.view.config.GlobalConfig@isNote == 1">
- AND (note=1 or (call_type=2 and note is null ))
- </if>
- GROUP BY DATE
- ORDER BY DATE;
- </select>
- <select id="selectSatisfaction" parameterType="Date" resultMap="SatisfactionViewResult">
- select
- count(myd=2 or null ) basically,
- count(myd=1 or null ) satisfied,
- count(myd=3 or null ) dissatisfied
- from rep_record
- where 1=1
- <if test="@api.entity.view.config.GlobalConfig@isNote == 1">
- AND (note=1 or (call_type=2 and note is null ))
- </if>
- </select>
- <select id="selectTrafficMeasurement" parameterType="Date" resultMap="TrafficMeasurementResult">
- select
- count(call_type=1 or null ) incoming,
- count(call_type=1 and is_answer=1 or null ) answer,
- AVG(TIMESTAMPDIFF(SECOND, wait_time, answer_time) and is_answer=1 AND call_type=1 ) avgWait,
- AVG(TIMESTAMPDIFF(SECOND, answer_time, hangup_time) and is_answer=1 AND call_type=1 ) avgAnswer
- from rep_record
- WHERE `create_time`>=#{beginTime} AND `create_time`<![CDATA[<=]]> #{endTime}
- <if test="@api.entity.view.config.GlobalConfig@isNote == 1">
- AND (note=1 or (call_type=2 and note is null ))
- </if>
- </select>
- <select id="selectConnection" parameterType="api.entity.view.report.ScreenConnection" resultMap="SysReportHourResult">
- select
- count(1) number,
- DATE_FORMAT( `create_time`, #{grouping} ) as DATE
- from rep_record
- WHERE `create_time`>=#{startTime} AND `create_time`<![CDATA[<=]]> #{endTime}
- and call_type=1
- <if test="@api.entity.view.config.GlobalConfig@isNote == 1">
- AND (note=1 or (call_type=2 and note is null ))
- </if>
- <if test="isAnswer >-1 ">
- AND `is_answer`= #{isAnswer}
- </if>
- group by DATE
- order by DATE
- </select>
- <select id="selectRecord" parameterType="String" resultMap="RecordDateViewResult">
- select COUNT(call_type=1 or NULL ) incoming,
- COUNT(call_type=2 or NULL ) exhalation,
- COUNT(1) total
- from rep_record where
- DATE_FORMAT( `create_time`, '%Y-%m' )= DATE_FORMAT( #{time}, '%Y-%m' )
- <if test="@api.entity.view.config.GlobalConfig@isNote == 1">
- AND (note=1 or (call_type=2 and note is null ))
- </if>
- </select>
- <select id="selectVisitCount" parameterType="String" resultType="long">
- select COUNT(DISTINCT workordercode) number
- from wo_visitlog
- where
- DATE_FORMAT( `createtime`, '%Y-%m' )= DATE_FORMAT( #{time}, '%Y-%m' )
- </select>
- <select id="selectCallTrends" parameterType="api.entity.view.report.ScreenConnection" resultMap="TrafficViewResult">
- select
- DATE_FORMAT( `create_time`, #{grouping}) DATE ,
- count(call_type=1 or null ) incoming,
- count(call_type=1 and is_answer=1 or null ) answer,
- count(call_type=1 and is_answer=0 or null ) noAnswer
- from rep_record
- WHERE `create_time`>=#{startTime} AND `create_time`<![CDATA[<=]]> #{endTime}
- and call_type=1
- <if test="@api.entity.view.config.GlobalConfig@isNote == 1">
- AND (note=1 or (call_type=2 and note is null ))
- </if>
- group by DATE
- order by DATE
- </select>
- <select id="selectAICount" parameterType="String" resultMap="CompleteView">
- select operate_type Name, COUNT(1) number from ai_operation
- GROUP BY operate_type
- </select>
- <select id="selectRegionOrderCount" parameterType="String" resultMap="RegionOrderResult">
- WITH RECURSIVE AreaCTE AS (
- SELECT
- id AS root_id,
- id AS child_id,
- name AS root_name,
- parent_id
- FROM sys_area
- WHERE type=#{type} and parent_id=#{area}
- UNION ALL
- SELECT
- a.root_id,
- s.id AS child_id,
- a.root_name,
- s.parent_id
- FROM sys_area s
- INNER JOIN AreaCTE a ON s.parent_id = a.child_id
- )
- SELECT
- a.root_id AS region,
- a.root_name AS name,
- COUNT(wo.workordercode) AS number,
- COUNT(DISTINCT wo.call_id) AS callNumber,
- COUNT(DISTINCT lv.workordercode) AS visitNumber,
- CONCAT(
- COALESCE(
- ROUND(
- AVG(CASE WHEN lv.myd > 0 AND lv.myd <![CDATA[<]]> 3 THEN 1 ELSE 0 END) * 100,
- 2
- ),
- 0
- ),
- '%'
- ) AS mydRate
- FROM AreaCTE a
- LEFT JOIN wo_workorderbase wo
- ON a.child_id = wo.area
- <if test="time != null and time !='' ">
- and YEAR(wo.createtime) = YEAR(CURRENT_DATE)
- AND ${time}(wo.createtime) = ${time}(CURRENT_DATE)
- </if>
- LEFT JOIN (
- SELECT
- v1.workordercode,
- v1.myd
- FROM wo_visitlog v1
- INNER JOIN (
- SELECT
- workordercode,
- MAX(visit_id) AS visit_id
- FROM wo_visitlog
- GROUP BY workordercode
- ) v2
- ON v1.workordercode = v2.workordercode
- AND v1.visit_id = v2.visit_id
- ) lv
- ON wo.workordercode = lv.workordercode
- GROUP BY a.root_id, a.root_name;
- </select>
- <select id="selectTelephoneData" parameterType="String" resultMap="RecordDateViewResult">
- select count(1) total,
- count(note=${note} and call_type = 1 or null ) incoming, count(call_type = 2
- or null ) exhalation from rep_record
- where 1=1
- <if test="time != null and time !='' ">
- and YEAR(create_time) = YEAR(CURRENT_DATE)
- AND ${time}(create_time) = ${time}(CURRENT_DATE)
- </if>
- </select>
- <select id="selectTelephoneBriefing" parameterType="String" resultMap="TelephoneBriefingResult">
- select
- count(1) total_calls ,
- SUM(CASE WHEN call_type = 1 THEN 1 ELSE 0 END) AS inbound_total,
- SUM(CASE WHEN call_type = 1 AND is_answer = 1 THEN 1 ELSE 0 END) AS inbound_connected,
- SUM(CASE WHEN call_type = 1 AND is_answer = 0 THEN 1 ELSE 0 END) AS inbound_not_connected,
- SUM(CASE WHEN call_type = 2 THEN 1 ELSE 0 END) AS outbound_total,
- SUM(CASE WHEN call_type = 2 AND is_answer = 1 THEN 1 ELSE 0 END) AS outbound_connected,
- SUM(CASE WHEN call_type = 2 AND is_answer = 0 THEN 1 ELSE 0 END) AS outbound_not_connected,
- SUM(CASE WHEN call_type = 1 AND is_answer = 1
- THEN TIMESTAMPDIFF(SECOND, answer_time, hangup_time) ELSE 0 END) call_duration,
- count(myd=2 or null ) basically,
- count(myd=1 or null ) satisfied,
- count(myd=3 or null ) dissatisfied
- from rep_record
- where 1=1
- <if test="@api.entity.view.config.GlobalConfig@isNote == 1" >
- AND (note=1 or (call_type=2 and note is null ))
- </if>
- <if test="startTime != null and startTime !=''">
- AND UNIX_TIMESTAMP(`create_time`)>=UNIX_TIMESTAMP(#{startTime})
- </if>
- <if test="endTime != null and endTime !=''">
- AND UNIX_TIMESTAMP(`create_time`) <![CDATA[<=]]> UNIX_TIMESTAMP(#{endTime})
- </if>
- </select>
- <select id="selectAreaKeywordCount" parameterType="Long" resultMap="CompleteView">
- WITH RECURSIVE sub_areas AS (
- SELECT id FROM sys_area WHERE id = #{area}
- UNION ALL
- SELECT a.id FROM sys_area a
- INNER JOIN sub_areas sa ON a.parent_id = sa.id
- )
- SELECT
- keyword_text AS `Name`,
- SUM(keyword_count) AS `number`
- FROM
- wo_workorderbase o
- JOIN
- rep_translate k ON o.call_id = k.callid
- JOIN
- JSON_TABLE(
- k.translate_json,
- '$[*]' COLUMNS (
- keyword_text VARCHAR(255) PATH '$.text',
- keyword_count INT PATH '$.count'
- )
- ) AS jt
- JOIN sub_areas sa ON o.area = sa.id
- WHERE
- 1=1
- <if test="time != null and time !='' ">
- and YEAR(createtime) = YEAR(CURRENT_DATE)
- AND ${time}(createtime) = ${time}(CURRENT_DATE)
- </if>
- GROUP BY
- keyword_text
- ORDER BY
- SUM(keyword_count) DESC
- LIMIT 10;
- </select>
- </mapper>
|