From 039a11a31880829658d9a0a11b8dda52f4e27b7f Mon Sep 17 00:00:00 2001
From: master <master@163.com>
Date: 星期五, 04 三月 2022 16:32:17 +0800
Subject: [PATCH] 新增设备信息接口
---
src/app/modules/device/controller/app/device.ts | 15 +++++++
src/app/modules/device/entity/device.ts | 69 ++++++++++++++++++++++++++++++++++
src/app/modules/device/config.ts | 16 ++++++++
src/app/modules/huaneng/controller/app/huaneng.ts | 2
src/app/modules/device/controller/admin/device.ts | 13 ++++++
5 files changed, 114 insertions(+), 1 deletions(-)
diff --git a/src/app/modules/device/config.ts b/src/app/modules/device/config.ts
new file mode 100644
index 0000000..9259f9d
--- /dev/null
+++ b/src/app/modules/device/config.ts
@@ -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;
+};
\ No newline at end of file
diff --git a/src/app/modules/device/controller/admin/device.ts b/src/app/modules/device/controller/admin/device.ts
new file mode 100644
index 0000000..ec4c23e
--- /dev/null
+++ b/src/app/modules/device/controller/admin/device.ts
@@ -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 { }
diff --git a/src/app/modules/device/controller/app/device.ts b/src/app/modules/device/controller/app/device.ts
new file mode 100644
index 0000000..b0d5294
--- /dev/null
+++ b/src/app/modules/device/controller/app/device.ts
@@ -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 { }
diff --git a/src/app/modules/device/entity/device.ts b/src/app/modules/device/entity/device.ts
new file mode 100644
index 0000000..3d6e40b
--- /dev/null
+++ b/src/app/modules/device/entity/device.ts
@@ -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;
+}
diff --git a/src/app/modules/huaneng/controller/app/huaneng.ts b/src/app/modules/huaneng/controller/app/huaneng.ts
index 9e31e94..a13007c 100644
--- a/src/app/modules/huaneng/controller/app/huaneng.ts
+++ b/src/app/modules/huaneng/controller/app/huaneng.ts
@@ -3,7 +3,7 @@
import { DemoHuanengEntity } from '../../entity/huaneng';
/**
- * 鍟嗗搧
+ * test
*/
@Provide()
@CoolController(
--
Gitblit v1.9.1