master
2022-03-04 039a11a31880829658d9a0a11b8dda52f4e27b7f
新增设备信息接口
1个文件已修改
4个文件已添加
115 ■■■■■ 已修改文件
src/app/modules/device/config.ts 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/app/modules/device/controller/admin/device.ts 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/app/modules/device/controller/app/device.ts 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/app/modules/device/entity/device.ts 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/app/modules/huaneng/controller/app/huaneng.ts 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/app/modules/device/config.ts
New file
@@ -0,0 +1,16 @@
import { Application } from 'egg';
import { ModuleConfig } from '@cool-midway/core';
/**
 * 模块配置
 */
export default (app: Application) => {
  return {
    // 模块名称
    name: 'device',
    // 模块描述
    description: '采集设备',
    // 中间件,只对本模块有效
    middlewares: [],
  } as ModuleConfig;
};
src/app/modules/device/controller/admin/device.ts
New file
@@ -0,0 +1,13 @@
import { Provide } from '@midwayjs/decorator';
import { CoolController, BaseController } from '@cool-midway/core';
import { DemoDeviceEntity } from '../../entity/device';
/**
 * 描述
 */
@Provide()
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: DemoDeviceEntity,
})
export class DemoAdminDeviceController extends BaseController { }
src/app/modules/device/controller/app/device.ts
New file
@@ -0,0 +1,15 @@
import { Provide } from '@midwayjs/decorator';
import { CoolController, BaseController } from '@cool-midway/core';
import { DemoDeviceEntity } from '../../entity/device';
/**
 * test
 */
@Provide()
@CoolController(
  {
    api: ['add', 'delete', 'update', 'info', 'list', 'page'],
    entity: DemoDeviceEntity
  }
)
export class DemoAppDeviceController extends BaseController { }
src/app/modules/device/entity/device.ts
New file
@@ -0,0 +1,69 @@
import { EntityModel } from '@midwayjs/orm';
import { BaseEntity } from '@cool-midway/core';
import { Column, PrimaryGeneratedColumn } from 'typeorm';
/**
 * 商品
 */
@EntityModel('device')
export class DemoDeviceEntity extends BaseEntity {
  @PrimaryGeneratedColumn({ comment: 'id' })
  id: number;
  @Column({ comment: '逻辑ID' })
  logic_id: string;
  @Column({ comment: '物理ID' })
  device_id: string;
  @Column({ comment: '设备名称', default: "可见光-毫米波-采集设备" })
  name: string;
  @Column({ comment: '安装位置', default: "华能电厂二号煤棚-第一马道-北" })
  location: string;
  @Column({ comment: '经度', type: 'double', default: 121.222222222 })
  longitude: number;
  @Column({ comment: '纬度', type: 'double', default: 31.222222222 })
  latitude: number;
  @Column({ comment: '高度', type: 'double', default: 40 })
  altitude: number;
  @Column({ comment: '设备尺寸', default: "110*110" })
  dimension: string;
  @Column({ comment: '设备精度', default: "3" })
  precision: string;
  @Column({ comment: '航向角', default: "90" })
  heading_angle: string;
  @Column({ comment: '俯仰角', default: "90" })
  petch_angle: string;
  @Column({ comment: '横滚角', default: "90" })
  roll_angle: string;
  @Column({ comment: 'IP地址', default: "127.0.0.1" })
  ipaddress: string;
  @Column({ comment: '端口', default: "8001" })
  device_port: string;
  @Column({ comment: '账号', default: "admin" })
  device_account: string;
  @Column({ comment: '密码', default: "123456" })
  device_psw: string;
  @Column({ comment: '运维负责人' })
  operator: string;
  @Column({ comment: '备注', default: "无" })
  remark: string;
  @Column({ comment: '状态', default: 1 })
  status: number;
}
src/app/modules/huaneng/controller/app/huaneng.ts
@@ -3,7 +3,7 @@
import { DemoHuanengEntity } from '../../entity/huaneng';
/**
 * 商品
 * test
 */
@Provide()
@CoolController(