Merge pull request 'refs #6667 sql' (!1940) from 6667-searchFilter into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #1940
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Carlos Satorres 2024-01-22 10:36:08 +00:00
commit 725c43c7e4
1 changed files with 4 additions and 3 deletions

View File

@ -43,13 +43,14 @@ module.exports = Self => {
const stmt = new ParameterizedSQL(`
SELECT *
FROM(
SELECT DISTINCT w.id, w.code, u.name, u.nickname, u.active, b.departmentFk
SELECT w.id, w.code, u.name, u.nickname, u.active, wd.departmentFk
FROM worker w
JOIN account.user u ON u.id = w.id
LEFT JOIN business b ON b.workerFk = w.id
LEFT JOIN workerDepartment wd ON wd.workerFk = w.id
) w`);
stmt.merge(conn.makeSuffix(filter));
return conn.executeStmt(stmt);
};