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;
|
}
|