Browse Source

修改巡检记录查询接口

master
xincheng 2 years ago
parent
commit
fb96c9cf22
  1. 24
      api/app/lib/controllers/patrolRecord/patrolRecord.js

24
api/app/lib/controllers/patrolRecord/patrolRecord.js

@ -11,13 +11,25 @@ async function findPatrolRecord (ctx, next) {
/* 如果有startTime && endTime,查询所有符合条件的数据 */
if (startTime !== 'null' && endTime !== 'null') {
if (pointId) {
rslt = await models.PatrolRecord.findAll({
where: { alarm, inspectionTime: { $between: [startTime, endTime] }, pointId: { $in: pointId.split(',') } },
});
if (alarm == 'null') {
rslt = await models.PatrolRecord.findAll({
where: { inspectionTime: { $between: [startTime, endTime] }, pointId: { $in: pointId.split(',') } },
});
} else {
rslt = await models.PatrolRecord.findAll({
where: { alarm, inspectionTime: { $between: [startTime, endTime] }, pointId: { $in: pointId.split(',') } },
});
}
} else {
rslt = await models.PatrolRecord.findAll({
where: { alarm, inspectionTime: { $between: [startTime, endTime] } },
});
if (alarm == 'null') {
rslt = await models.PatrolRecord.findAll({
where: { inspectionTime: { $between: [startTime, endTime] } },
});
} else {
rslt = await models.PatrolRecord.findAll({
where: { alarm, inspectionTime: { $between: [startTime, endTime] } },
});
}
}
} else {
/* 如果没有startTime && endTime,查询每个点位最新一条符合条件的数据 */

Loading…
Cancel
Save