modifiche menu'

This commit is contained in:
2024-03-20 17:31:49 +01:00
parent f800ac1e92
commit 3da77518ec
2 changed files with 69 additions and 1 deletions

View File

@@ -0,0 +1,68 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20240320141352 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateView("svw_menu_no_pb", "CREATE view [dbo].[svw_menu_no_pb] as \n" +
"WITH GerarchiaMenu AS (SELECT sm.cod_opz,\n" +
" sm.descrizione,\n" +
" sm.cod_parent,\n" +
" smo.gest_name,\n" +
" CASE WHEN smo.object_type = 'D' THEN 'S' ELSE 'F' END AS type,\n" +
" sm.tipo_azienda,\n" +
" sm.flag_attivo,\n" +
" sm.pos,\n" +
" sm_g.pos AS pos_gruppo,\n" +
" sm_g.descrizione AS gruppo\n" +
" FROM stb_menu sm\n" +
" INNER JOIN stb_menu_opz smo ON sm.cod_opz = smo.cod_opz \n" +
" INNER JOIN stb_menu sm_g ON sm.cod_parent = sm_g.cod_opz AND\n" +
" sm.tipo_azienda = sm_g.tipo_azienda\n" +
" WHERE sm.cod_parent in ( 'MM007', 'WM002')\n" +
" AND sm.tipo_azienda = (select tipo_azienda from azienda)\n" +
" UNION ALL\n" +
" SELECT sm_c.cod_opz,\n" +
" sm_c.descrizione,\n" +
" sm_c.cod_parent,\n" +
" smo.gest_name,\n" +
" CASE WHEN smo.object_type = 'D' THEN 'S' ELSE 'F' END AS type,\n" +
" sm_c.tipo_azienda,\n" +
" sm_c.flag_attivo,\n" +
" sm_c.pos,\n" +
" sm_g.pos AS pos_gruppo,\n" +
" sm_g.descrizione AS gruppo\n" +
" FROM stb_menu sm_c\n" +
" INNER JOIN GerarchiaMenu gm ON sm_c.cod_parent = gm.cod_opz\n" +
" INNER JOIN stb_menu_opz smo on sm_c.cod_opz = smo.cod_opz\n" +
" INNER JOIN stb_menu sm_g ON sm_c.cod_parent = sm_g.cod_opz AND\n" +
" sm_c.tipo_azienda = sm_g.tipo_azienda\n" +
" WHERE sm_c.tipo_azienda = gm.tipo_azienda)\n" +
"SELECT DISTINCT gm.cod_opz,\n" +
" descrizione,\n" +
" cod_parent,\n" +
" gm.gest_name,\n" +
" gm.type,\n" +
" tipo_azienda,\n" +
" gm.pos,\n" +
" gm.pos_gruppo,\n" +
" gm.gruppo\n" +
"FROM GerarchiaMenu gm\n" +
"WHERE gm.gest_name IS NOT NULL\n" +
" AND gm.flag_attivo = 'S'");
}
@Override
public void down() throws Exception {
}
}

File diff suppressed because one or more lines are too long