Aggiunto campo flag_multi_value in setup per setup con array di valori

This commit is contained in:
2024-03-13 17:25:18 +01:00
parent d8df7edaa3
commit 155adef231
3 changed files with 58 additions and 2 deletions

View File

@@ -61,6 +61,7 @@ public abstract class BaseMigration implements MigrationModelInterface {
protected void executeStatement(String... sqls) throws SQLException, IOException {
executeStatement(sqls);
}
protected void executeStatement(Connection connection, String... sqls) throws SQLException {
Statement statement = connection.createStatement();
@@ -144,13 +145,17 @@ public abstract class BaseMigration implements MigrationModelInterface {
executeStatement(dropSql);
}
protected void createSetup(String gestName, String section, String keySection, String value, String description, String codQuery) throws Exception {
createSetup(gestName, section, keySection, value, description, codQuery, false);
}
protected void createSetup(String gestName, String section, String keySection, String value, String description, String codQuery, boolean flagMultiValue) throws Exception {
StbGestSetup stbGestSetup = new StbGestSetup()
.setGestName(gestName)
.setSection(section)
.setKeySection(keySection)
.setValue(value)
.setFlagMultiValue(flagMultiValue)
.setDescription(description)
.setQueryDefault(codQuery);
@@ -224,7 +229,7 @@ public abstract class BaseMigration implements MigrationModelInterface {
String currentDbName = advancedDataSource.getDataSource().getDbName();
return Arrays.stream(customersDbs)
.anyMatch(y -> y.getValue().equalsIgnoreCase(currentDbName));
.anyMatch(y -> y.getValue().equalsIgnoreCase(currentDbName));
}

View File

@@ -0,0 +1,38 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
import java.sql.Statement;
public class Migration_20240313163623 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
if (existsColumn("stb_gest_setup", "flag_multi_value")) {
return;
}
Statement statement = advancedDataSource.getConnection().createStatement();
statement.execute("alter TABLE stb_gest_setup ADD flag_multi_value BIT DEFAULT 0");
statement.close();
createSetup("PVM", "PIAN_ACC_ROSSG", "TIPI_FORN_ACQ", null,
"Identifica i tipi di fornitore su cui è possibile creare un ordine di acquisto per la materia prima.",
"COD_ATIP", true);
createSetup(
"PVM", "PIAN_ACC_ROSSG", "COD_MGRP_MP", null,
"Identifica i gruppi merceologici di materia prima per cui è possibile creare un ordine di acquisto",
"COD_MGRP", true);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -5,6 +5,7 @@ import it.integry.common.var.CommonConstants;
import it.integry.ems_model.annotation.*;
import it.integry.ems_model.base.EntityBase;
import org.kie.api.definition.type.PropertyReactive;
import java.util.Date;
import java.util.List;
@@ -54,6 +55,9 @@ public class StbGestSetup extends EntityBase {
@SqlField(value = "flag_setup_depo", maxLength = 1, nullable = false)
private String flagSetupDepo;
@SqlField(value = "flag_multi_value", nullable = false)
private boolean flagMultiValue = false;
@SqlField(value = "flag_setup_user_web", maxLength = 1, nullable = false)
private String flagSetupUserWeb;
@@ -258,4 +262,13 @@ public class StbGestSetup extends EntityBase {
gestSetupDet.deleteAllEntities(connection, this);
}
public boolean isFlagMultiValue() {
return flagMultiValue;
}
public StbGestSetup setFlagMultiValue(boolean flagMultiValue) {
this.flagMultiValue = flagMultiValue;
return this;
}
}