| | |
| | | order by ctr."gmt_create" desc |
| | | </select> |
| | | |
| | | <!--查询从未接通和从未呼叫的水库--> |
| | | <select id="getNotCallOrCallNotConnect" resultType="cn.gistack.sm.intelligentCall.entity.Scene"> |
| | | ( |
| | | select b."guid" as waterCode,b."name" as waterName,c."user_name" as username, |
| | | c."user_phone" as phone,c."user_phone" as userId from ( |
| | | select * from SJZT_MD."att_res_base" arb right join ( |
| | | select e.* from ( |
| | | select JSON_VALUE("call_task_callee_content",'$."$水库编码$"') as waterCode |
| | | from "SJZT_ODS"."call_task_callee" where date_format("gmt_create",'%Y-%m-%d') >='2023-05-01' group by JSON_VALUE("call_task_callee_content",'$."$水库编码$"') |
| | | ) e left join |
| | | |
| | | ( |
| | | select waterCode from ( |
| | | select a.*,b."callee_number",b."call_result",c.id from ( |
| | | select "call_id", |
| | | JSON_VALUE("call_task_callee_content",'$."$水库编码$"') as waterCode |
| | | from "SJZT_ODS"."call_task_callee" |
| | | where date_format("gmt_create",'%Y-%m-%d') >='2023-05-01' |
| | | ) a left join "SJZT_ODS"."call_task_result" b on a."call_id" = b."call_id" |
| | | left join "YWXT".sm_call_not_fill_record c on c.call_id = a."call_id" |
| | | where ("call_result" = '200000' or (b."call_result"!='200000' and c.id is not null)) |
| | | |
| | | ) d group by waterCode |
| | | ) f on e.waterCode = f.waterCode |
| | | where f.waterCode is null |
| | | )a on arb."guid" = a.waterCode) b |
| | | LEFT JOIN SJZT_MD."att_res_manage_person" c ON b."guid" = c."res_guid" and c."type" = 5 |
| | | where "user_phone" is not null |
| | | order by b."interior_ad_guid" |
| | | ) |
| | | union |
| | | ( |
| | | select |
| | | e."code" as waterCode,e."name" as waterName,e."user_name" as username, |
| | | e."user_phone" as phone,e."user_phone" as userId |
| | | from ( |
| | | select b."code",b."name",b."res_reg_code",b."eng_scal",c."user_name", |
| | | c."user_phone",aab.* |
| | | from ( |
| | | select * from SJZT_MD."att_res_base" arb left join |
| | | |
| | | ( |
| | | select JSON_VALUE("call_task_callee_content",'$."$水库编码$"') as waterCode from "SJZT_ODS"."call_task_callee" |
| | | where date_format("gmt_create",'%Y-%m-%d') >='2023-05-01' |
| | | group by JSON_VALUE("call_task_callee_content",'$."$水库编码$"') |
| | | ) a on arb."guid" = a.waterCode |
| | | where waterCode is null) b |
| | | LEFT JOIN SJZT_MD."att_res_manage_person" c ON b."guid" = c."res_guid" and c."type" = 5 |
| | | left join "SJZT_MD"."att_ad_base" aab on aab."guid" = b."interior_ad_guid" |
| | | order by b."interior_ad_guid" ) e |
| | | left join "SJZT_MD"."att_ad_base" aab on aab."ad_code" = e."p_ad_code" |
| | | where e."user_phone" is not null |
| | | ) |
| | | </select> |
| | | |
| | | </mapper> |