Entity 实体
结构声明
- TS Declaration
- Java Class
- JSON Schema
interface Entity {
"concept": "Entity", // 产品概念
"name": string, // 实体名称
"uuid": string, // 唯一标识
"tableName": string, // 数据库表名
"description": string, // 实体描述
"origin": "ide" | "sql" | "table" | "excel", // 实体来源
"properties": Array<EntityProperty>, // 实体属性列表
"indexes": Array<EntityIndex>, // 实体索引列表
}
class EntityTreeNode {
ConceptEnum concept; // 产品概念
String name; // 实体名称
String uuid; // 唯一标识
String tableName; // 数据库表名
String description; // 实体描述
OriginEnum origin; // 实体来源
List<EntityPropertyTreeNode> properties; // 实体属性列表
List<EntityIndexTreeNode> indexes; // 实体索引列表
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/Entity",
"definitions": {
"Entity": {
"type": "object",
"properties": {
"concept": {
"type": "string",
"const": "Entity"
},
"name": {
"type": "string"
},
"uuid": {
"type": "string"
},
"tableName": {
"type": "string"
},
"description": {
"type": "string"
},
"origin": {
"type": "string",
"enum": [
"ide",
"sql",
"table",
"excel"
]
},
"properties": {
"type": "array",
"items": {
"$ref": "#/definitions/EntityProperty"
}
},
"indexes": {
"type": "array",
"items": {
"$ref": "#/definitions/EntityIndex"
}
}
},
"required": [
"concept",
"name",
"uuid",
"tableName",
"description",
"origin",
"properties",
"indexes"
],
"additionalProperties": false
}
}
}
示例
简单示例
- JSON
- YAML
{
"concept": "Entity",
"name": "Student",
"tableName": "Student",
"description": "学生信息表",
"origin": "ide",
"properties": [],
"indexes": []
}
concept: Entity
name: Student
tableName: Student
description: 学生信息表
origin: ide
properties: []
indexes: []
带普通字段
- JSON
- YAML
- Embedded in TS
{
"concept": "Entity",
"name": "School",
"origin": "ide",
"properties": [
{
"concept": "EntityProperty",
"name": "id",
"label": "主键",
"description": "主键",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long"
},
"required": true,
"primaryKey": true,
"display": {
"inTable": false,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "name",
"label": "学校名称",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "String"
},
"display": {
"inDetail": true,
"inFilter": true,
"inForm": true,
"inTable": true
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "createdTime",
"label": "创建时间",
"description": "创建时间",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "DateTime"
},
"display": {
"inTable": true,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "updatedTime",
"label": "更新时间",
"description": "更新时间",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "DateTime"
},
"display": {
"inTable": true,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "createdBy",
"label": "创建者",
"description": "创建者",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "String"
},
"display": {
"inTable": false,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "updatedBy",
"label": "更新者",
"description": "更新者",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "String"
},
"display": {
"inTable": false,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}
],
"indexes": []
}
concept: Entity
name: School
origin: ide
properties:
- concept: EntityProperty
name: id
label: 主键
description: 主键
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Long
required: true
primaryKey: true
display:
inTable: false
inFilter: false
inForm: false
inDetail: false
rules: []
generationRule: platform
- concept: EntityProperty
name: name
label: 学校名称
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: String
display:
inDetail: true
inFilter: true
inForm: true
inTable: true
rules: []
generationRule: platform
- concept: EntityProperty
name: createdTime
label: 创建时间
description: 创建时间
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: DateTime
display:
inTable: true
inFilter: false
inForm: false
inDetail: false
rules: []
generationRule: platform
- concept: EntityProperty
name: updatedTime
label: 更新时间
description: 更新时间
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: DateTime
display:
inTable: true
inFilter: false
inForm: false
inDetail: false
rules: []
generationRule: platform
- concept: EntityProperty
name: createdBy
label: 创建者
description: 创建者
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: String
display:
inTable: false
inFilter: false
inForm: false
inDetail: false
rules: []
generationRule: platform
- concept: EntityProperty
name: updatedBy
label: 更新者
description: 更新者
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: String
display:
inTable: false
inFilter: false
inForm: false
inDetail: false
rules: []
generationRule: platform
indexes: []
@nasl.annotation.Entity()
export class School {
id: nasl.core.Long;
name: nasl.core.String;
createdTime: nasl.core.DateTime;
updatedTime: nasl.core.DateTime;
createdBy: nasl.core.String;
updatedBy: nasl.core.String;
}
带关联关系
- JSON
- YAML
- Embedded in TS
{
"concept": "Entity",
"name": "Student",
"origin": "ide",
"properties": [{
"concept": "EntityProperty",
"name": "id",
"label": "主键",
"description": "主键",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long"
},
"required": true,
"primaryKey": true,
"display": {
"inTable": false,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "schoolId",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long"
},
"relationNamespace": "app.dataSources.defaultDS.entities",
"relationEntity": "School",
"relationProperty": "id",
"display": {
"inDetail": true,
"inFilter": true,
"inForm": true,
"inTable": true
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "name",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "String"
},
"display": {
"inDetail": true,
"inFilter": true,
"inForm": true,
"inTable": true
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "age",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Integer"
},
"display": {
"inDetail": true,
"inFilter": true,
"inForm": true,
"inTable": true
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "createdTime",
"label": "创建时间",
"description": "创建时间",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "DateTime"
},
"display": {
"inTable": true,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "updatedTime",
"label": "更新时间",
"description": "更新时间",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "DateTime"
},
"display": {
"inTable": true,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "createdBy",
"label": "创建者",
"description": "创建者",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "String"
},
"display": {
"inTable": false,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "updatedBy",
"label": "更新者",
"description": "更新者",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "String"
},
"display": {
"inTable": false,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}],
"indexes": []
}
concept: Entity
name: Student
origin: ide
properties:
- concept: EntityProperty
name: id
label: 主键
description: 主键
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Long
required: true
primaryKey: true
display:
inTable: false
inFilter: false
inForm: false
inDetail: false
rules: []
generationRule: platform
- concept: EntityProperty
name: schoolId
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Long
relationNamespace: app.dataSources.defaultDS.entities
relationEntity: School
relationProperty: id
display:
inDetail: true
inFilter: true
inForm: true
inTable: true
rules: []
generationRule: platform
- concept: EntityProperty
name: name
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: String
display:
inDetail: true
inFilter: true
inForm: true
inTable: true
rules: []
generationRule: platform
- concept: EntityProperty
name: age
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Integer
display:
inDetail: true
inFilter: true
inForm: true
inTable: true
rules: []
generationRule: platform
- concept: EntityProperty
name: createdTime
label: 创建时间
description: 创建时间
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: DateTime
display:
inTable: true
inFilter: false
inForm: false
inDetail: false
rules: []
generationRule: platform
- concept: EntityProperty
name: updatedTime
label: 更新时间
description: 更新时间
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: DateTime
display:
inTable: true
inFilter: false
inForm: false
inDetail: false
rules: []
generationRule: platform
- concept: EntityProperty
name: createdBy
label: 创建者
description: 创建者
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: String
display:
inTable: false
inFilter: false
inForm: false
inDetail: false
rules: []
generationRule: platform
- concept: EntityProperty
name: updatedBy
label: 更新者
description: 更新者
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: String
display:
inTable: false
inFilter: false
inForm: false
inDetail: false
rules: []
generationRule: platform
indexes: []
@nasl.annotation.Entity()
export class Student {
id: nasl.core.Long;
@nasl.annotation.EntityRelation<app.dataSources.defaultDS.entities['id']>()
schoolId: nasl.core.Long;
name: nasl.core.String;
age: nasl.core.Integer;
createdTime: nasl.core.DateTime;
updatedTime: nasl.core.DateTime;
createdBy: nasl.core.String;
updatedBy: nasl.core.String;
}
带索引
- JSON
- Embedded in TS
{
"concept": "Entity",
"name": "Student",
"origin": "ide",
"properties": [{
"concept": "EntityProperty",
"name": "id",
"label": "主键",
"description": "主键",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long"
},
"required": true,
"primaryKey": true,
"display": {
"inTable": false,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "name",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "String"
},
"display": {
"inDetail": true,
"inFilter": true,
"inForm": true,
"inTable": true
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "age",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Integer"
},
"display": {
"inDetail": true,
"inFilter": true,
"inForm": true,
"inTable": true
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "createdTime",
"label": "创建时间",
"description": "创建时间",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "DateTime"
},
"display": {
"inTable": true,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "updatedTime",
"label": "更新时间",
"description": "更新时间",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "DateTime"
},
"display": {
"inTable": true,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "createdBy",
"label": "创建者",
"description": "创建者",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "String"
},
"display": {
"inTable": false,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}, {
"concept": "EntityProperty",
"name": "updatedBy",
"label": "更新者",
"description": "更新者",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "String"
},
"display": {
"inTable": false,
"inFilter": false,
"inForm": false,
"inDetail": false
},
"rules": [],
"generationRule": "platform"
}],
"indexes": [{
"concept": "EntityIndex",
"name": "idIndex",
"propertyNames": [
"id"
],
"unique": true
}, {
"concept": "EntityIndex",
"name": "timeNameIndex",
"propertyNames": [
"createdTime",
"name"
]
}]
}
@nasl.annotation.Entity()
@nasl.annotation.EntityIndex<[Student['id']]>('idIndex')
@nasl.annotation.EntityIndex<[Student['createdTime'], Student['name']]>('timeNameIndex')
export class Student {
id: nasl.core.Long;
name: nasl.core.String;
age: nasl.core.Integer;
createdTime: nasl.core.DateTime;
updatedTime: nasl.core.DateTime;
createdBy: nasl.core.String;
updatedBy: nasl.core.String;
}