fix: corregido sql
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
1f1a69a2b4
commit
484b8d42e1
|
@ -30,8 +30,11 @@ module.exports = Self => {
|
|||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
const dated = new Date(date);
|
||||
const dayName = dated.toString().split(' ')[0];
|
||||
|
||||
query = `
|
||||
SELECT *
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT
|
||||
DISTINCT z.id,
|
||||
|
@ -42,16 +45,16 @@ module.exports = Self => {
|
|||
FROM vn.zone z
|
||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
||||
LEFT JOIN zoneEvent ze ON ze.zoneFk = z.id
|
||||
WHERE
|
||||
WHERE
|
||||
(
|
||||
dated = ?
|
||||
OR ? BETWEEN started AND ended
|
||||
OR INSTR(weekDays, SUBSTRING(DAYNAME(?), 1, 3) ) > 0
|
||||
dated = ?
|
||||
OR ? BETWEEN started AND ended
|
||||
OR weekDays LIKE ?
|
||||
)
|
||||
AND z.id IN (?)
|
||||
ORDER BY type='day' DESC, type='range' DESC, type='indefinitely' DESC) z
|
||||
GROUP BY z.id`;
|
||||
|
||||
return Self.rawSql(query, [date, date, date, zoneIds], myOptions);
|
||||
return Self.rawSql(query, [date, date, dayName, zoneIds], myOptions);
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue