diff --git a/src/libs/routes_v2/simcaqEnrollmentDiagnosis.js b/src/libs/routes_v2/simcaqEnrollmentDiagnosis.js index 7c13d9b48c3d6396d5e4ae1962431966102c6b53..1fb30b61644a4f627a0269b8ed597a40e4cffb94 100644 --- a/src/libs/routes_v2/simcaqEnrollmentDiagnosis.js +++ b/src/libs/routes_v2/simcaqEnrollmentDiagnosis.js @@ -46,6 +46,10 @@ rqf.addField({ name: 'filter', field: false, where: true +}).addField({ + name: 'dims', + field: true, + where: false }).addValue({ name: 'year', table: 'simcaq_diagnostico_de_matricula', @@ -57,32 +61,47 @@ rqf.addField({ } }).addValue({ name: 'city', - table: 'simcaq_diagnostico_de_matricula', - tableField: 'municipio_id', + table: 'municipio', + tableField: 'id', where: { relation: '=', type: 'integer', - field: 'municipio_id' + field: 'id' + }, + join: { + primary: 'id', + foreign: 'municipio_id', + foreignTable: 'simcaq_diagnostico_de_matricula' } -}).addValue({ +}, 'dims').addValue({ name: 'state', - table: 'simcaq_diagnostico_de_matricula', - tableField: 'estado_id', + table: 'estado', + tableField: 'id', where: { relation: '=', type: 'integer', - field: 'estado_id' + field: 'id' + }, + join: { + primary: 'id', + foreign: 'estado_id', + foreignTable: 'simcaq_diagnostico_de_matricula' } -}).addValue({ +}, 'dims').addValue({ name: 'school', - table: 'simcaq_diagnostico_de_matricula', - tableField: 'escola_id', + table: 'escola_agregada', + tableField: 'id', where: { relation: '=', type: 'integer', - field: 'escola_id' + field: 'id' + }, + join: { + primary: 'id', + foreign: 'escola_id', + foreignTable: 'simcaq_diagnostico_de_matricula' } -}).addValue({ +}, 'dims').addValue({ name: 'education_level_short_id', table: 'simcaq_diagnostico_de_matricula', tableField: 'etapa', diff --git a/src/libs/routes_v2/simcaqSecondReport.js b/src/libs/routes_v2/simcaqSecondReport.js index 1aa89412ebd689c34e24a07e70d4decbce4e25c5..ccdd2f9b6b2acfdab9b19db6521d1b2c9230abaf 100644 --- a/src/libs/routes_v2/simcaqSecondReport.js +++ b/src/libs/routes_v2/simcaqSecondReport.js @@ -46,6 +46,10 @@ rqf.addField({ name: 'filter', field: false, where: true +}).addField({ + name: 'dims', + field: true, + where: false }).addValue({ name: 'year', table: 'simcaq_relatorio_2', @@ -56,40 +60,55 @@ rqf.addField({ field: 'ano_censo' } }).addValue({ - name: 'school', - table: 'simcaq_relatorio_2', - tableField: 'escola_id', + name: 'city', + table: 'municipio', + tableField: 'id', where: { relation: '=', type: 'integer', - field: 'escola_id' + field: 'id' + }, + join: { + primary: 'id', + foreign: 'municipio_id', + foreignTable: 'simcaq_relatorio_2' } -}).addValue({ - name: 'city', - table:'simcaq_relatorio_2', - tableField: 'municipio_id', +}, 'dims').addValue({ + name: 'state', + table: 'estado', + tableField: 'id', where: { relation: '=', type: 'integer', - field: 'municipio_id' + field: 'id' + }, + join: { + primary: 'id', + foreign: 'estado_id', + foreignTable: 'simcaq_relatorio_2' } -}).addValue({ - name: 'adm_dependency', - table: 'simcaq_relatorio_2', - tableField: 'dependencia_adm_id', +}, 'dims').addValue({ + name: 'school', + table: 'escola_agregada', + tableField: 'id', where: { relation: '=', type: 'integer', - field: 'dependencia_adm_id' + field: 'id' + }, + join: { + primary: 'id', + foreign: 'escola_id', + foreignTable: 'simcaq_relatorio_2' } -}).addValue({ - name: 'state', +}, 'dims').addValue({ + name: 'adm_dependency', table: 'simcaq_relatorio_2', - tableField: 'estado_id', + tableField: 'dependencia_adm_id', where: { relation: '=', type: 'integer', - field: 'estado_id' + field: 'dependencia_adm_id' } });