|
@@ -180,14 +180,13 @@ select max(year_month) from house.building_month
|
|
Integer getBuildingMonthMaxDate();
|
|
Integer getBuildingMonthMaxDate();
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 获取区县最大面积建筑周围1000米的建筑,相同经纬度保留建筑面积最大的
|
|
|
|
|
|
+ * 获取区县最大面积建筑
|
|
*/
|
|
*/
|
|
@Select("""
|
|
@Select("""
|
|
with
|
|
with
|
|
t101 as (
|
|
t101 as (
|
|
select
|
|
select
|
|
- lng_bd09,
|
|
|
|
- lat_bd09
|
|
|
|
|
|
+ *
|
|
from
|
|
from
|
|
house.building_month
|
|
house.building_month
|
|
where
|
|
where
|
|
@@ -201,33 +200,6 @@ order by
|
|
limit 1
|
|
limit 1
|
|
),
|
|
),
|
|
t102 as (
|
|
t102 as (
|
|
-select
|
|
|
|
- house.building_month.*
|
|
|
|
-from
|
|
|
|
- house.building_month
|
|
|
|
-cross join t101
|
|
|
|
-where
|
|
|
|
- year_month = #{dto.endDate}
|
|
|
|
- and ST_DWithin(
|
|
|
|
- ST_Point(t101.lng_bd09,
|
|
|
|
- t101.lat_bd09)::geography,
|
|
|
|
- ST_Point(house.building_month.lng_bd09,
|
|
|
|
- house.building_month.lat_bd09)::geography,
|
|
|
|
- 1000
|
|
|
|
-)
|
|
|
|
-),
|
|
|
|
-t103 as (
|
|
|
|
-select
|
|
|
|
- distinct on
|
|
|
|
- (lng_bd09, lat_bd09) *
|
|
|
|
-from
|
|
|
|
- t102
|
|
|
|
-order by
|
|
|
|
- lng_bd09,
|
|
|
|
- lat_bd09,
|
|
|
|
- building_area desc
|
|
|
|
-),
|
|
|
|
-t104 as (
|
|
|
|
select
|
|
select
|
|
building_id,
|
|
building_id,
|
|
sum(amount) as maintenance_cost
|
|
sum(amount) as maintenance_cost
|
|
@@ -235,17 +207,17 @@ from
|
|
house.building_repair_main_month
|
|
house.building_repair_main_month
|
|
where
|
|
where
|
|
repair_type != '财务预提冲销'
|
|
repair_type != '财务预提冲销'
|
|
- and exists (select 1 from t103 where t103.building_id = house.building_repair_main_month.building_id)
|
|
|
|
|
|
+ and exists (select 1 from t101 where t101.building_id = house.building_repair_main_month.building_id)
|
|
and year_month >= #{dto.startDate}
|
|
and year_month >= #{dto.startDate}
|
|
and year_month <= #{dto.endDate}
|
|
and year_month <= #{dto.endDate}
|
|
group by
|
|
group by
|
|
building_id
|
|
building_id
|
|
),
|
|
),
|
|
-t105 as (
|
|
|
|
|
|
+t103 as (
|
|
select
|
|
select
|
|
-t103.*,
|
|
|
|
-t104.maintenance_cost
|
|
|
|
-from t103 left join t104 on t103.building_id = t104.building_id
|
|
|
|
|
|
+t101.*,
|
|
|
|
+t102.maintenance_cost
|
|
|
|
+from t101 left join t102 on t101.building_id = t102.building_id
|
|
)
|
|
)
|
|
select
|
|
select
|
|
building_id,
|
|
building_id,
|
|
@@ -258,10 +230,11 @@ select
|
|
building_area_idle,
|
|
building_area_idle,
|
|
building_area_rent,
|
|
building_area_rent,
|
|
round(maintenance_cost, 2) as maintenance_cost,
|
|
round(maintenance_cost, 2) as maintenance_cost,
|
|
|
|
+ building_img,
|
|
lng_bd09 as lng,
|
|
lng_bd09 as lng,
|
|
lat_bd09 as lat
|
|
lat_bd09 as lat
|
|
from
|
|
from
|
|
- t105
|
|
|
|
|
|
+ t103
|
|
order by
|
|
order by
|
|
building_area desc
|
|
building_area desc
|
|
limit 150
|
|
limit 150
|
|
@@ -327,6 +300,7 @@ select
|
|
building_area_idle,
|
|
building_area_idle,
|
|
building_area_rent,
|
|
building_area_rent,
|
|
round(maintenance_cost, 2) as maintenance_cost,
|
|
round(maintenance_cost, 2) as maintenance_cost,
|
|
|
|
+ building_img,
|
|
lng_bd09 as lng,
|
|
lng_bd09 as lng,
|
|
lat_bd09 as lat
|
|
lat_bd09 as lat
|
|
from
|
|
from
|
|
@@ -499,6 +473,7 @@ select
|
|
building_area_idle,
|
|
building_area_idle,
|
|
building_area_rent,
|
|
building_area_rent,
|
|
round(maintenance_cost, 2) as maintenance_cost,
|
|
round(maintenance_cost, 2) as maintenance_cost,
|
|
|
|
+ building_img,
|
|
lng_bd09 as lng,
|
|
lng_bd09 as lng,
|
|
lat_bd09 as lat
|
|
lat_bd09 as lat
|
|
from
|
|
from
|