From 0658cba98f71b8a91cc1fb2fc349a1332b0b4352 Mon Sep 17 00:00:00 2001 From: linju Date: Mon, 23 Oct 2023 16:56:53 +0800 Subject: [PATCH] =?UTF-8?q?department=20=E8=A1=A8=E6=94=B9=E7=94=A8=20open?= =?UTF-8?q?db-department?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/clientDB/clientDB-api/clientDB-api.vue | 2 +- uniCloud-aliyun/database/db_init.json | 2 +- .../database/department.schema.json | 25 --------- .../database/opendb-department.schema.json | 52 +++++++++++++++++++ 4 files changed, 54 insertions(+), 27 deletions(-) delete mode 100644 uniCloud-aliyun/database/department.schema.json create mode 100644 uniCloud-aliyun/database/opendb-department.schema.json diff --git a/pages/clientDB/clientDB-api/clientDB-api.vue b/pages/clientDB/clientDB-api/clientDB-api.vue index 47e6c37..ecbcd83 100644 --- a/pages/clientDB/clientDB-api/clientDB-api.vue +++ b/pages/clientDB/clientDB-api/clientDB-api.vue @@ -348,7 +348,7 @@ uni.showLoading({ mask: true }); - db.collection("department").get({ + db.collection("opendb-department").get({ getTree: { limitLevel: 10, // 最大查询层级(不包含当前层级),可以省略默认10级,最大15,最小1 // startWith: "parent_code==''" // 第一层级条件,此初始条件可以省略,不传startWith时默认从最顶级开始查询 diff --git a/uniCloud-aliyun/database/db_init.json b/uniCloud-aliyun/database/db_init.json index 70e41fe..45a629b 100644 --- a/uniCloud-aliyun/database/db_init.json +++ b/uniCloud-aliyun/database/db_init.json @@ -3,7 +3,7 @@ // 编写完毕后对本文件点右键,可按配置规则创建表和添加数据 { - "department": { + "opendb-department": { "data": [{ "_id": "5fe77207974b6900018c6c9c", "name": "总部", diff --git a/uniCloud-aliyun/database/department.schema.json b/uniCloud-aliyun/database/department.schema.json deleted file mode 100644 index 4dded1d..0000000 --- a/uniCloud-aliyun/database/department.schema.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "bsonType": "object", - "required": ["name"], - "permission":{ - "read":true - }, - "properties": { - "_id": { - "description": "ID,系统自动生成" - }, - "name": { - "bsonType": "string", - "description": "名称" - }, - "parent_id": { - "bsonType": "string", - "description": "父id", - "parentKey": "_id" // 指定父子关系为:如果数据库记录A的_id和数据库记录B的parent_id相等,则A是B的父级。 - }, - "status": { - "bsonType": "int", - "description": "部门状态,0-正常、1-禁用" - } - } -} diff --git a/uniCloud-aliyun/database/opendb-department.schema.json b/uniCloud-aliyun/database/opendb-department.schema.json new file mode 100644 index 0000000..4d9dffe --- /dev/null +++ b/uniCloud-aliyun/database/opendb-department.schema.json @@ -0,0 +1,52 @@ +{ + "bsonType": "object", + "required": ["name"], + "permission": { + "read": true, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "parent_id": { + "bsonType": "string", + "description": "父级部门ID", + "parentKey": "_id" + }, + "name": { + "bsonType": "string", + "description": "部门名称", + "title": "部门名称", + "trim": "both" + }, + "level": { + "bsonType": "int", + "description": "部门层级,为提升检索效率而作的冗余设计" + }, + "sort": { + "bsonType": "int", + "description": "部门在当前层级下的顺序,由小到大", + "title": "显示顺序" + }, + "manager_uid": { + "bsonType": "string", + "description": "部门主管的userid, 参考`uni-id-users` 表", + "foreignKey": "uni-id-users._id" + }, + "create_date": { + "bsonType": "timestamp", + "description": "部门创建时间", + "forceDefaultValue": { + "$env": "now" + } + }, + "status": { + "bsonType": "int", + "description": "部门状态,0-正常、1-禁用" + } + }, + "version": "0.1.0" +} \ No newline at end of file -- GitLab