diff --git a/eda/eda_api/lib/services/query-builder/qb-systems/mySql-builder.service.ts b/eda/eda_api/lib/services/query-builder/qb-systems/mySql-builder.service.ts index 0b4e9a971..d0d4f4316 100644 --- a/eda/eda_api/lib/services/query-builder/qb-systems/mySql-builder.service.ts +++ b/eda/eda_api/lib/services/query-builder/qb-systems/mySql-builder.service.ts @@ -357,8 +357,6 @@ export class MySqlBuilderService extends QueryBuilderService { */ public getFilterColname(column: any){ let colname:String ; - console.log('la columna es ') - console.log(column); if( column.computed_column == 'no' || ! column.hasOwnProperty('computed_column') ){ colname = `\`${column.table_id}\`.\`${column.column_name}\`` ; }else{ diff --git a/eda/eda_api/lib/services/query-builder/query-builder.service.ts b/eda/eda_api/lib/services/query-builder/query-builder.service.ts index 429f83f05..8f52ad8cf 100644 --- a/eda/eda_api/lib/services/query-builder/query-builder.service.ts +++ b/eda/eda_api/lib/services/query-builder/query-builder.service.ts @@ -876,11 +876,23 @@ export abstract class QueryBuilderService { equalfilters.map.forEach((value, key) => { let filterSTR = '\nand (' - value.forEach(f => { - filterSTR += this.filterToString(f) + '\n or '; + + //poso els nulls al principi + let n = value.filter( f=> f.filter_type == 'not_null'); + let values = [...n, ...value.filter( f=> f.filter_type != 'not_null')]; + + values.forEach(f => { + if(f.filter_type == 'not_null'){ + //Fins que no es pugi determinar el tipus de conjunció. Els filtres sobre una mateixa columna es un or perque vull dos grups. EXCEPTE QUAN ES UN NULL + filterSTR += this.filterToString(f ) + '\n and '; + }else{ + filterSTR += this.filterToString(f ) + '\n or '; + } + + }); - filterSTR = filterSTR.slice(0, -3); + filterSTR = filterSTR.slice(0, -4); filterSTR += ') '; filtersString += filterSTR; });