| | |
| | | import { CoolController, BaseController } from '@cool-midway/core'; |
| | | import { PushVehicleGpsEntity } from '../../entity/vehiclegps'; |
| | | import { PushVehicleGpsService } from '../../service/vehiclegps'; |
| | | import { BaseSysDepartmentEntity } from '../../../base/entity/sys/department' |
| | | import { WithDeptFilterWhere } from '../../../base/middleware/with-dept-filter-where' |
| | | |
| | | /** |
| | | * 车载监控GPS位置数据 |
| | |
| | | pageQueryOp: { |
| | | keyWordLikeFields: ['a.sn', 'a.vehicleNo'], |
| | | fieldEq: ['a.status'], |
| | | select: ['a.*', 'b.name AS departmentName'], |
| | | join: [ |
| | | { |
| | | entity: BaseSysDepartmentEntity, |
| | | alias: 'b', |
| | | condition: 'a.departmentId = b.id', |
| | | type: 'leftJoin', |
| | | }, |
| | | ], |
| | | where: async (ctx) => { |
| | | const { createDate, gpsTime } = ctx.request.body; |
| | | const condition = []; |
| | | const conditions: any[][] = []; |
| | | if (createDate && createDate.length === 2) { |
| | | condition.push(['a.createDate BETWEEN :createStartDate AND :createEndDate', { createStartDate: createDate[0], createEndDate: createDate[1] }]); |
| | | conditions.push(['a.createDate BETWEEN :createStartDate AND :createEndDate', { createStartDate: createDate[0], createEndDate: createDate[1] }]); |
| | | } |
| | | if (gpsTime && gpsTime.length === 2) { |
| | | condition.push(['a.gpsTime BETWEEN :gpsStartDate AND :gpsEndDate', { gpsStartDate: gpsTime[0], gpsEndDate: gpsTime[1] }]); |
| | | conditions.push(['a.gpsTime BETWEEN :gpsStartDate AND :gpsEndDate', { gpsStartDate: gpsTime[0], gpsEndDate: gpsTime[1] }]); |
| | | } |
| | | return condition; |
| | | |
| | | conditions.push(...(await WithDeptFilterWhere(ctx, { alias: 'a', field: 'departmentId' }))); |
| | | |
| | | return conditions; |
| | | } |
| | | } |
| | | }) |