wangzhibo
4 天以前 c19f1f7e21c93d1f13b4f44a8a615f65af577559
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { Inject } from '@midwayjs/core';
import { CoolController, BaseController } from '@cool-midway/core';
import { PushDeviceOnoffEntity } from '../../entity/deviceonoff';
import { PushDeviceOnoffService } from '../../service/deviceonoff';
 
/**
 * 设备对象管理
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: PushDeviceOnoffEntity,
  service: PushDeviceOnoffService,
  pageQueryOp: {
    keyWordLikeFields: ['a.deviceId', 'a.subSerial', 'a.deviceName'],
    fieldEq: [
      { column: 'a.status', requestParam: 'status' },
      { column: 'a.msgType', requestParam: 'msgType' },
      { column: 'a.devType', requestParam: 'devType' }
    ],
    where: async (ctx) => {
      const { startTime, endTime } = ctx.request.body;
      const condition = [];
      if (startTime && endTime) {
        condition.push([
          'a.occurTime BETWEEN :startTime AND :endTime',
          { startTime, endTime }
        ]);
      }
      return condition;
    }
  }
})
export class AdminPushDeviceOnoffController extends BaseController {
  @Inject()
  pushDeviceOnoffService: PushDeviceOnoffService;
}