|
|
@ -4,12 +4,12 @@ async function overspeedGet (ctx) { |
|
|
|
try { |
|
|
|
const models = ctx.fs.dc.models; |
|
|
|
const { limit, page, nameOfInspectionPoint, licensePlate, numberOfAxles, overrunRateUpper, overrunRateFloor, testTime } = ctx.query |
|
|
|
|
|
|
|
const sequelize = ctx.fs.dc.ORM; |
|
|
|
let findOption = { |
|
|
|
where: { |
|
|
|
|
|
|
|
}, |
|
|
|
order: [['id', 'DESC']] |
|
|
|
order: [['id', 'DESC']], |
|
|
|
} |
|
|
|
if (limit) { |
|
|
|
findOption.limit = limit |
|
|
@ -17,16 +17,19 @@ async function overspeedGet (ctx) { |
|
|
|
if (page && limit) { |
|
|
|
findOption.offset = page * limit |
|
|
|
} |
|
|
|
if (nameOfInspectionPoint) { |
|
|
|
findOption.where.nameOfInspectionPoint = { |
|
|
|
'$like': `%${nameOfInspectionPoint}%` |
|
|
|
|
|
|
|
if (nameOfInspectionPoint || licensePlate) { |
|
|
|
findOption.where['$or'] = {} |
|
|
|
if (nameOfInspectionPoint) { |
|
|
|
findOption.where['$or']. |
|
|
|
nameOfInspectionPoint = { $like: `%${nameOfInspectionPoint}%` } |
|
|
|
} |
|
|
|
} |
|
|
|
if (licensePlate) { |
|
|
|
findOption.where.licensePlate = { |
|
|
|
'$like': `%${licensePlate}%` |
|
|
|
if (licensePlate) { |
|
|
|
findOption.where['$or']. |
|
|
|
licensePlate = { $like: `%${licensePlate}%` } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (numberOfAxles) { |
|
|
|
findOption.where.numberOfAxles = numberOfAxles |
|
|
|
} |
|
|
@ -38,7 +41,7 @@ async function overspeedGet (ctx) { |
|
|
|
if (overrunRateFloor) { |
|
|
|
findOption.where.overrunRate = { |
|
|
|
$gte: overrunRateFloor |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (testTime) { |
|
|
|
findOption.where.testTime = testTime |
|
|
|