|
|
|
|
@ -305,7 +305,7 @@ public class PlanosActuacaoImporterProvider extends GenericDataProvider
|
|
|
|
|
Select innerSelect = new Select2(
|
|
|
|
|
new String[] { HsRelatorioPostoData.TABLENAME, HsRelatorioPostoMedidaData.TABLENAME,
|
|
|
|
|
HsRelatorioMedidaData.TABLENAME, HsRelatorioRiscoData.TABLENAME, HsRelatorioPostoRiscoData.TABLENAME,
|
|
|
|
|
HsRelatorioData.TABLENAME, HsRelatorioAreaData.TABLENAME, HsRelatorioRiscoValorQualitativoData.TABLENAME },
|
|
|
|
|
HsRelatorioData.TABLENAME, HsRelatorioAreaData.TABLENAME },
|
|
|
|
|
new Integer[]{ Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER, Select2.JOIN_INNER,
|
|
|
|
|
Select2.JOIN_INNER, Select2.JOIN_INNER },
|
|
|
|
|
new Expression[]{
|
|
|
|
|
@ -319,7 +319,7 @@ public class PlanosActuacaoImporterProvider extends GenericDataProvider
|
|
|
|
|
},
|
|
|
|
|
new String[]{ "DISTINCT " + HsRelatorioPostoMedidaData.MEDIDA_ID_FULL,
|
|
|
|
|
HsRelatorioPostoRiscoData.RISCO_ID_FULL,
|
|
|
|
|
HsRelatorioMedidaData.DESCRIPTION_FULL,
|
|
|
|
|
HsRelatorioMedidaData.DESCRIPTION_FULL + " AS descricao",
|
|
|
|
|
"CASE WHEN " +
|
|
|
|
|
new Field( HsRelatorioPostoRiscoData.VALOR_QUALITATIVO_ID_FULL ).isEqual( null )
|
|
|
|
|
.and( new Field( HsRelatorioPostoRiscoData.PROBABILIDADE_FULL ).isEqual( null ) )
|
|
|
|
|
@ -379,7 +379,7 @@ public class PlanosActuacaoImporterProvider extends GenericDataProvider
|
|
|
|
|
new Field( HsRelatorioAreaData.ID_FULL ).isEqual( new Field( HsRelatorioPostoData.AREA_ID_FULL ) )
|
|
|
|
|
},
|
|
|
|
|
new String[]{ HsRelatorioPostoMedidaData.POSTO_ID_FULL,
|
|
|
|
|
HsRelatorioPostoData.DESCRIPTION_FULL,
|
|
|
|
|
HsRelatorioPostoData.DESCRIPTION_FULL + " AS descricao",
|
|
|
|
|
"CASE WHEN " +
|
|
|
|
|
new Field( HsRelatorioPostoRiscoData.VALOR_QUALITATIVO_ID_FULL ).isEqual( null )
|
|
|
|
|
.and( new Field( HsRelatorioPostoRiscoData.PROBABILIDADE_FULL ).isEqual( null ) )
|
|
|
|
|
@ -389,11 +389,11 @@ public class PlanosActuacaoImporterProvider extends GenericDataProvider
|
|
|
|
|
" THEN " + HsRelatorioPostoRiscoData.PROBABILIDADE_FULL + "*" + HsRelatorioPostoRiscoData.SEVERIDADE_FULL +
|
|
|
|
|
" ELSE " + HsRelatorioPostoRiscoData.VALOR_QUALITATIVO_ID_FULL +
|
|
|
|
|
" END AS valor ",
|
|
|
|
|
"coalesce( " + HsRelatorioPostoData.IS_PRINCIPAL_FULL + ", false )" },
|
|
|
|
|
"coalesce( " + HsRelatorioPostoData.IS_PRINCIPAL_FULL + ", false ) AS is_principal" },
|
|
|
|
|
new Field( HsRelatorioPostoMedidaData.MEDIDA_ID ).isEqual( m.getId() )
|
|
|
|
|
.and( new Field( HsRelatorioPostoRiscoData.RISCO_ID_FULL ).isEqual( r.getId() ) )
|
|
|
|
|
.and( new Field( HsRelatorioPostoData.AREA_ID_FULL ).isEqual( a.getId() ) ),
|
|
|
|
|
new String[]{ HsRelatorioRiscoData.ID_FULL }, null, null, null
|
|
|
|
|
new String[]{ HsRelatorioPostoMedidaData.POSTO_ID_FULL }, null, null, null
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
Select select = new Select( MessageFormat.format( "SELECT subquery.posto_id, valor, descricao, is_principal FROM ( {0} ) subquery ", innerSelect.toString() ) );
|
|
|
|
|
@ -470,7 +470,7 @@ public class PlanosActuacaoImporterProvider extends GenericDataProvider
|
|
|
|
|
},
|
|
|
|
|
new String[]{ "DISTINCT " + HsRelatorioPostoMedidaData.MEDIDA_ID_FULL,
|
|
|
|
|
HsRelatorioPostoRiscoData.RISCO_ID_FULL,
|
|
|
|
|
HsRelatorioMedidaData.DESCRIPTION_FULL,
|
|
|
|
|
HsRelatorioMedidaData.DESCRIPTION_FULL + " AS descricao",
|
|
|
|
|
"CASE WHEN " +
|
|
|
|
|
new Field( HsRelatorioPostoRiscoData.VALOR_QUALITATIVO_ID_FULL ).isEqual( null )
|
|
|
|
|
.and( new Field( HsRelatorioPostoRiscoData.PROBABILIDADE_FULL ).isEqual( null ) )
|
|
|
|
|
|