You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
279 lines
7.2 KiB
279 lines
7.2 KiB
/* eslint-disable*/
|
|
'use strict';
|
|
|
|
module.exports = dc => {
|
|
const DataTypes = dc.ORM;
|
|
const sequelize = dc.orm;
|
|
const Camera = sequelize.define("camera", {
|
|
id: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: null,
|
|
comment: null,
|
|
primaryKey: true,
|
|
field: "id",
|
|
autoIncrement: true,
|
|
unique: "camera_id_uindex"
|
|
},
|
|
type: {
|
|
type: DataTypes.STRING,
|
|
allowNull: false,
|
|
defaultValue: null,
|
|
comment: "设备类型:yingshi - 萤石;nvr - NVR摄像头;ipc - IPC 网络摄像头;cascade - 级联摄像头",
|
|
primaryKey: false,
|
|
field: "type",
|
|
autoIncrement: false
|
|
},
|
|
name: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "设备名称/安装位置",
|
|
primaryKey: false,
|
|
field: "name",
|
|
autoIncrement: false
|
|
},
|
|
channelName: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "通道名称",
|
|
primaryKey: false,
|
|
field: "channel_name",
|
|
autoIncrement: false
|
|
},
|
|
externalDomain: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "外域名称",
|
|
primaryKey: false,
|
|
field: "external_domain",
|
|
autoIncrement: false
|
|
},
|
|
rtmp: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: null,
|
|
primaryKey: false,
|
|
field: "rtmp",
|
|
autoIncrement: false
|
|
},
|
|
serialNo: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "设备编号",
|
|
primaryKey: false,
|
|
field: "serial_no",
|
|
autoIncrement: false
|
|
},
|
|
cloudControl: {
|
|
type: DataTypes.BOOLEAN,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "云台控制",
|
|
primaryKey: false,
|
|
field: "cloud_control",
|
|
autoIncrement: false
|
|
},
|
|
highDefinition: {
|
|
type: DataTypes.BOOLEAN,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "高清支持",
|
|
primaryKey: false,
|
|
field: "high_definition",
|
|
autoIncrement: false
|
|
},
|
|
voice: {
|
|
type: DataTypes.BOOLEAN,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "语音对讲支持",
|
|
primaryKey: false,
|
|
field: "voice",
|
|
autoIncrement: false
|
|
},
|
|
memoryCard: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "内存卡容量",
|
|
primaryKey: false,
|
|
field: "memory_card",
|
|
autoIncrement: false
|
|
},
|
|
venderId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "设备厂商id",
|
|
primaryKey: false,
|
|
field: "vender_id",
|
|
autoIncrement: false,
|
|
references: {
|
|
key: "id",
|
|
model: "vender"
|
|
}
|
|
},
|
|
cascadeType: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "级联方式:up - 上级联;down - 下级联",
|
|
primaryKey: false,
|
|
field: "cascade_type",
|
|
autoIncrement: false
|
|
},
|
|
sip: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: null,
|
|
primaryKey: false,
|
|
field: "sip",
|
|
autoIncrement: false
|
|
},
|
|
longitude: {
|
|
type: DataTypes.DOUBLE,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "经度",
|
|
primaryKey: false,
|
|
field: "longitude",
|
|
autoIncrement: false
|
|
},
|
|
latitude: {
|
|
type: DataTypes.DOUBLE,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "维度",
|
|
primaryKey: false,
|
|
field: "latitude",
|
|
autoIncrement: false
|
|
},
|
|
forbidden: {
|
|
type: DataTypes.BOOLEAN,
|
|
allowNull: false,
|
|
defaultValue: false,
|
|
comment: "是否禁用",
|
|
primaryKey: false,
|
|
field: "forbidden",
|
|
autoIncrement: false
|
|
},
|
|
createTime: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: null,
|
|
comment: null,
|
|
primaryKey: false,
|
|
field: "create_time",
|
|
autoIncrement: false
|
|
},
|
|
recycleTime: {
|
|
type: DataTypes.DATE,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "放入回收站时间",
|
|
primaryKey: false,
|
|
field: "recycle_time",
|
|
autoIncrement: false
|
|
},
|
|
delete: {
|
|
type: DataTypes.BOOLEAN,
|
|
allowNull: false,
|
|
defaultValue: false,
|
|
comment: "是否彻底删除",
|
|
primaryKey: false,
|
|
field: "delete",
|
|
autoIncrement: false
|
|
},
|
|
createUserId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: null,
|
|
comment: null,
|
|
primaryKey: false,
|
|
field: "create_user_id",
|
|
autoIncrement: false
|
|
},
|
|
nvrId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: null,
|
|
primaryKey: false,
|
|
field: "nvr_id",
|
|
autoIncrement: false,
|
|
references: {
|
|
key: "id",
|
|
model: "nvr"
|
|
}
|
|
},
|
|
model: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: "型号",
|
|
primaryKey: false,
|
|
field: "model",
|
|
autoIncrement: false
|
|
},
|
|
kindId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: null,
|
|
primaryKey: false,
|
|
field: "kind_id",
|
|
autoIncrement: false,
|
|
references: {
|
|
key: "id",
|
|
model: "cameraKind"
|
|
}
|
|
},
|
|
abilityId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: null,
|
|
primaryKey: false,
|
|
field: "ability_id",
|
|
autoIncrement: false,
|
|
references: {
|
|
key: "id",
|
|
model: "cameraAbility"
|
|
}
|
|
},
|
|
yingshiSecretId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: true,
|
|
defaultValue: null,
|
|
comment: null,
|
|
primaryKey: false,
|
|
field: "yingshi_secret_id",
|
|
autoIncrement: false,
|
|
references: {
|
|
key: "id",
|
|
model: "secretYingshi"
|
|
}
|
|
}
|
|
}, {
|
|
tableName: "camera",
|
|
comment: "",
|
|
indexes: []
|
|
});
|
|
dc.models.Camera = Camera;
|
|
|
|
const CameraKind = dc.models.CameraKind;
|
|
Camera.belongsTo(CameraKind, { foreignKey: 'kindId', targetKey: 'id' });
|
|
CameraKind.hasMany(Camera, { foreignKey: 'kindId', sourceKey: 'id' });
|
|
|
|
const CameraAbility = dc.models.CameraAbility;
|
|
Camera.belongsTo(CameraAbility, { foreignKey: 'abilityId', targetKey: 'id' });
|
|
CameraAbility.hasMany(Camera, { foreignKey: 'abilityId', sourceKey: 'id' });
|
|
|
|
return Camera;
|
|
};
|