总裁对外大屏地图指标取值优化

This commit is contained in:
yangkunan 2024-08-12 17:19:41 +08:00
parent 9a74c2d949
commit e82bfcf9af

View File

@ -695,7 +695,7 @@ CREATE TABLE IF NOT EXISTS dw.dws_president_map_d (
; ;
TRUNCATE TABLE dw.dws_president_map_d TRUNCATE TABLE dw.dws_president_map_d;
DELETE FROM dw.dws_president_map_d WHERE CURRENT_DT = '2024-08-02'; DELETE FROM dw.dws_president_map_d WHERE CURRENT_DT = '2024-08-02';
INSERT INTO dw.dws_president_map_d INSERT INTO dw.dws_president_map_d
@ -705,17 +705,17 @@ current_date() AS CURRENT_DT -- 当前日期
,a.City AS CITY -- 城市 ,a.City AS CITY -- 城市
,a.County AS COUNTY -- 县 ,a.County AS COUNTY -- 县
,round(sum(a.ContractArea) / 10000,2) AS TREATY_AREA -- 合约面积(万m²) ,round(sum(a.ContractArea) / 10000,2) AS TREATY_AREA -- 合约面积(万m²)
,sum(a.ManageContractArea) / 10000 AS MANAGE_AREA -- 在管面积(万m²) ,round(sum(a.TakeOverArea) / 10000,2) AS MANAGE_AREA -- 在管面积(万m²)
,sum(c.room_num) AS ROOM_NUM -- 总户数(户) ,sum(c.room_num) AS ROOM_NUM -- 总户数(户)
,count(*) AS COMM_NUM -- 在管项目数 ,count(*) AS COMM_NUM -- 在管项目数
FROM dim_project_base_info_d a FROM dw.dim_project_base_info_d a
inner join (select distinct organ_code, organ_name, comm_id , comm_name from dim_organ_mapping where comm_id is not null and comm_name not like '%撤场%' and comm_name not like '%案场%' and comm_name not like '%禁用%' inner join (select distinct organ_code, organ_name, comm_id , comm_name from dim_organ_mapping where comm_id is not null and comm_name not like '%撤场%' and comm_name not like '%案场%' and comm_name not like '%禁用%'
and length(comm_id) != 0) b and length(comm_id) != 0) b
on a.CommId = b.comm_id on a.CommId = b.comm_id
left join ( left join (
select select
CommID, count(*) room_num CommID, count(*) room_num
from dim_room_d from dw.dim_room_d
group by CommID group by CommID
) c on a.CommId = c.CommID ) c on a.CommId = c.CommID
where 1=1 where 1=1