Просмотр исходного кода

Zarazanie ID_PROJECT w Rozdzielcza* na bazie najmniejszego the_geom, tam gdzie nie ma ustalonego ID_PROJECT

a.binder 8 лет назад
Родитель
Сommit
91363a1016
1 измененных файлов с 86 добавлено и 0 удалено
  1. 86 0
      SE/superedit-DB_PROCEDURES_CREATE.php

+ 86 - 0
SE/superedit-DB_PROCEDURES_CREATE.php

@@ -1278,6 +1278,92 @@ update USERS2_MARKETING m, BUILDINGS b set m.the_geom=ST_Centroid(b.the_geom) wh
 END
 ";
 
+// # Zarazanie Rozdzielcza* ID_PROJECT na bazie najmniejszej sprawy, tam gdzie nie ma ustalonego ID_PROJECT
+$sql['ROZDZIELCZA_the_geom_ID_PROJECT_event_drop']="DROP EVENT if exists ROZDZIELCZA_the_geom_ID_PROJECT";
+
+
+$sql['ROZDZIELCZA_the_geom_ID_PROJECT_event']="CREATE EVENT `ROZDZIELCZA_the_geom_ID_PROJECT` ON SCHEDULE EVERY 1 DAY STARTS '2015-05-12 00:05:30' ON COMPLETION NOT PRESERVE ENABLE DO
+BEGIN
+create temporary table IN7_MK_BAZA_DYSTRYBUCJI_temp select ID,the_geom from IN7_MK_BAZA_DYSTRYBUCJI where the_geom is not null;
+
+update Rozdzielcza_PionyKablowe as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+							
+update Rozdzielcza_Mikrokanalizacja_do_klienta as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+
+update Rozdzielcza_rurociag_wsg84 as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+							
+							
+update Rozdzielcza_wezly as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+						
+update Rozdzielcza_koszty_dodatkowe_wsg84 as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+											
+update Rozdzielcza_Wykop_przedmiar_na_mikrorurki as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+							
+update Rozdzielcza_Kabel_swiatl_we_wtornej as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+update Rozdzielcza_Przeciski_110mm as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+update Rozdzielcza_rura_oslonowa_magistralna as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+update Rozdzielcza_Pakiet5MikrorurekMagistrala_WSG84 as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+update Rozdzielcza_wewn_kabel_ethernet as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+update Rozdzielcza_struktura_wewnetrzna_wsg84 as b 
+							inner join (
+							select p.ID , p.the_geom from IN7_MK_BAZA_DYSTRYBUCJI_temp as p    group by p.ID order by ST_Area(p.the_geom) 
+							) as p on   ST_Intersects(p.the_geom,b.the_geom)
+							set b.ID_PROJECT=p.ID where  b.ID_PROJECT<1  ;
+
+
+END
+";
+
 
 //! EOF ### powiazanie georeferencji z projektem oblotu: