diff --git a/src/libs/routes/classroom.js b/src/libs/routes/classroom.js index b751ddd764565aa58befbe55036212330136bc6b..1d1ad4ad8c14c5f14f06854751d06388e14f9efb 100644 --- a/src/libs/routes/classroom.js +++ b/src/libs/routes/classroom.js @@ -75,16 +75,37 @@ rqf.addField({ name: 'dims', field: true, where: false -}).addValue({ +}).addValueToField({ name: 'school', table: 'escola', - tableField: 'id', + tableField: ['nome_escola', 'id'], + resultField: ['school_name', 'school_id'], where: { relation: '=', type: 'integer', field: 'id' + }, + join: { + primary: ['id', 'ano_censo'], + foreign: ['escola_id', 'ano_censo'], + foreignTable: 'matricula' } -}).addValueToField({ +}, 'dims').addValueToField({ + name: 'school', + table: 'escola', + tableField: 'nome_escola', + resultField: 'school_name', + where: { + relation: '=', + type: 'integer', + field: 'id' + }, + join: { + primary: ['id', 'ano_censo'], + foreign: ['escola_id', 'ano_censo'], + foreignTable: 'matricula' + } +}, 'filter').addValueToField({ name: 'city', table: 'municipio', tableField: ['nome', 'id'],