Marlies Winterstein
9 months ago
1 changed files with 119 additions and 0 deletions
@ -0,0 +1,119 @@
@@ -0,0 +1,119 @@
|
||||
--freemarker template |
||||
<#if SQLdialect='Postgres'> |
||||
select setval('sichten_tid_seq',(select max(tid) from sichten)); |
||||
</#if> |
||||
<#assign systeminfoid="360" /> |
||||
<#assign sichten = [ |
||||
{"name_intern":"sxc_hochschulen_hsk_art", |
||||
"name":"Hochschulen HSK gruppiert", |
||||
"quelle":"<<SQL>> select druck ,apnr, parent, ebene from sxc_hochschulen_hsk_art order by 1", |
||||
"art":"SXC_Hochschulen-Sicht"} |
||||
] /> |
||||
|
||||
|
||||
--Ab hier braucht man nichts ändern: |
||||
|
||||
CREATE temp TABLE tmp_sichten ( |
||||
parent character(255), |
||||
systeminfoid integer DEFAULT 0 NOT NULL, |
||||
art character(40), |
||||
type integer , |
||||
name_intern character(200), |
||||
name character(200), |
||||
beschreibung character(255), |
||||
sortnr integer DEFAULT 0 NOT NULL, |
||||
quelle character(255), |
||||
alt_hier_id character(150), |
||||
treecfgtable character(255), |
||||
treecfgid character(150), |
||||
label smallint DEFAULT 0 NOT NULL, |
||||
user_rechte smallint DEFAULT 1 NOT NULL, |
||||
rechtequelle character(255), |
||||
sesamkey character(100), |
||||
standbutton smallint DEFAULT 0 NOT NULL, |
||||
attribut1 character(255), |
||||
attribut2 character(255), |
||||
attribut3 integer, |
||||
attribut4 integer, |
||||
xmlmaxentries integer, |
||||
gueltig_seit date , |
||||
gueltig_bis date, |
||||
aktiv smallint DEFAULT 1 |
||||
); |
||||
<#assign sortnr=0 /> |
||||
<#foreach sicht in sichten> |
||||
<#assign sortnr=sortnr+1 /> |
||||
-- Sicht ${sicht.name} |
||||
|
||||
INSERT INTO tmp_sichten( |
||||
systeminfoid , |
||||
art , |
||||
type , |
||||
name_intern , |
||||
name , |
||||
sortnr , |
||||
quelle , |
||||
label , |
||||
user_rechte , |
||||
standbutton , |
||||
gueltig_seit , |
||||
gueltig_bis , |
||||
aktiv |
||||
) select |
||||
${systeminfoid} , |
||||
'${sicht.art}' , |
||||
10 , |
||||
'${sicht.name_intern}' , |
||||
'${sicht.name}' , |
||||
${sortnr} , |
||||
'${sicht.quelle}', |
||||
0 , |
||||
0 , |
||||
0 , |
||||
date_val('01.01.1900') , |
||||
date_val('01.01.3000') , |
||||
1 from xdummy; |
||||
</#foreach> |
||||
|
||||
--Zur Sicherheit alle Quellen und Standbutton von Sichten |
||||
update sichten set quelle=(select T.quelle from tmp_sichten T |
||||
where T.name_intern=sichten.name_intern) |
||||
where name_intern in (select T2.name_intern from tmp_sichten T2) |
||||
; |
||||
update sichten set standbutton=(select T.standbutton from tmp_sichten T |
||||
where T.name_intern=sichten.name_intern) |
||||
where name_intern in (select T2.name_intern from tmp_sichten T2) |
||||
; |
||||
|
||||
delete from tmp_sichten where name_intern in (select name_intern from sichten); |
||||
|
||||
|
||||
INSERT INTO sichten( |
||||
systeminfoid , art , type , name_intern , name , |
||||
sortnr , quelle , label , |
||||
user_rechte , standbutton , |
||||
xmlmaxentries , |
||||
gueltig_seit , gueltig_bis , aktiv) |
||||
select systeminfoid , art , type , name_intern , name , |
||||
sortnr , quelle , label , |
||||
user_rechte , standbutton , |
||||
xmlmaxentries , |
||||
gueltig_seit , gueltig_bis , aktiv |
||||
from tmp_sichten S; |
||||
|
||||
|
||||
--Rechte für Sichten geben |
||||
select 'Rechte für Sichten geben' from xdummy; |
||||
delete from sachgeb_sichtarten where sichtart in |
||||
(select distinct art from tmp_sichten); |
||||
|
||||
insert into sachgeb_sichtarten |
||||
( |
||||
sachgebiete_id , |
||||
sichtart |
||||
) |
||||
select distinct ${systeminfoid},art from tmp_sichten; |
||||
|
||||
|
||||
drop table tmp_sichten; |
||||
|
Loading…
Reference in new issue