From f9102f87617de3ba0fc67ad0127d0f8319f9c932 Mon Sep 17 00:00:00 2001 From: expressgy Date: Sun, 23 Jun 2024 03:53:55 +0800 Subject: [PATCH] Changes --- docs/pacAuth_database_0.2.ndm2 | 1680 +++++++++-------- package.json | 2 +- pnpm-lock.yaml | 13 +- src/application/app.module.ts | 4 +- .../core-dict/core-dict.service.ts | 50 +- .../core-dict/dto/create-core-dict.dto.ts | 17 +- .../core-dict/dto/get-core-dict.dto.ts | 5 +- src/application/core-env/core-env.module.ts | 4 +- src/application/core-env/core-env.service.ts | 63 +- .../core-env/dto/get-core-env.dto.ts | 5 +- .../core-menu/core-menu.controller.ts | 54 + src/application/core-menu/core-menu.module.ts | 9 + .../core-menu/core-menu.service.ts | 312 +++ .../core-menu/dto/create-core-menu.dto.ts | 185 ++ .../core-menu/dto/get-core-menu.dto.ts | 136 ++ .../core-menu/dto/update-core-menu.dto.ts | 25 + .../core-menu/entities/core-menu.entity.ts | 1 + .../core-service/core-service.service.ts | 15 +- src/common/decorator/int/int.descrator.ts | 25 + src/config/configuration.ts | 2 +- src/entities/schema.ts | 7 +- src/main.ts | 2 - src/service/logger/logger.service.ts | 2 + src/service/snowflake/snowflake.service.ts | 3 +- src/utils/boolean.enum.ts | 2 +- src/utils/customDrizzleRowWithRecursive.ts | 1 - 26 files changed, 1690 insertions(+), 934 deletions(-) create mode 100644 src/application/core-menu/core-menu.controller.ts create mode 100644 src/application/core-menu/core-menu.module.ts create mode 100644 src/application/core-menu/core-menu.service.ts create mode 100644 src/application/core-menu/dto/create-core-menu.dto.ts create mode 100644 src/application/core-menu/dto/get-core-menu.dto.ts create mode 100644 src/application/core-menu/dto/update-core-menu.dto.ts create mode 100644 src/application/core-menu/entities/core-menu.entity.ts create mode 100644 src/common/decorator/int/int.descrator.ts diff --git a/docs/pacAuth_database_0.2.ndm2 b/docs/pacAuth_database_0.2.ndm2 index d9d4523..26d61c8 100644 --- a/docs/pacAuth_database_0.2.ndm2 +++ b/docs/pacAuth_database_0.2.ndm2 @@ -1359,8 +1359,8 @@ }, { "objectType": "Table_MYSQL", - "name": "pac_auth_role", - "comment": "角色", + "name": "pac_auth_dept", + "comment": "系统组织架构", "engine": "", "characterSet": "", "collation": "", @@ -1423,7 +1423,7 @@ "defaultType": "Others", "defaultValue": "", "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, + "isAutoInc": true, "comment": "数据完整性确认", "columnFormat": "", "storage": "", @@ -1435,7 +1435,7 @@ }, { "objectType": "TableField_MYSQL", - "name": "role_id", + "name": "dept_id", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -1450,14 +1450,14 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "角色id", + "comment": "组织/部门id", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "role_id" + "oldName": "dept_id" }, { "objectType": "TableField_MYSQL", @@ -1487,9 +1487,9 @@ }, { "objectType": "TableField_MYSQL", - "name": "role_name", - "type": "varchar", - "length": 255, + "name": "grade", + "type": "int", + "length": -2147483648, "decimals": -2147483648, "isUnsigned": false, "isZeroFill": false, @@ -1502,18 +1502,18 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "角色名", + "comment": "部门等级,下级部门自动+1", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "role_name" + "oldName": "grade" }, { "objectType": "TableField_MYSQL", - "name": "role_key", + "name": "dept_name", "type": "varchar", "length": 255, "decimals": -2147483648, @@ -1523,23 +1523,23 @@ "isBinary": false, "charset": "", "collation": "", - "isNullable": false, + "isNullable": true, "defaultType": "Others", "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "角色标识", + "comment": "部门名称", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "role_key" + "oldName": "dept_name" }, { "objectType": "TableField_MYSQL", - "name": "role_desc", + "name": "dept_desc", "type": "varchar", "length": 255, "decimals": -2147483648, @@ -1554,18 +1554,18 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "角色描述", + "comment": "部门描述", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "role_desc" + "oldName": "dept_desc" }, { "objectType": "TableField_MYSQL", - "name": "role_type", + "name": "dept_type", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -1580,18 +1580,18 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "来源于字典,默认0", + "comment": "部门类型", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "role_type" + "oldName": "dept_type" }, { "objectType": "TableField_MYSQL", - "name": "role_data_scope", + "name": "dept_leader", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -1601,23 +1601,23 @@ "isBinary": false, "charset": "", "collation": "", - "isNullable": false, + "isNullable": true, "defaultType": "Others", - "defaultValue": "1", + "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "数据范围:默认全部1(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)", + "comment": "部门负责人,默认可以没有", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "role_data_scope" + "oldName": "dept_leader" }, { "objectType": "TableField_MYSQL", - "name": "own_of_pac", + "name": "default_role", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -1627,19 +1627,19 @@ "isBinary": false, "charset": "", "collation": "", - "isNullable": false, + "isNullable": true, "defaultType": "Others", - "defaultValue": "0", + "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "数据属于最高权限其他人无法查看,默认0,1时用户数据", + "comment": "默认角色,默认可以没有", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "own_of_pac" + "oldName": "default_role" }, { "objectType": "TableField_MYSQL", @@ -1658,7 +1658,7 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "排序:默认0", + "comment": "排序,默认0", "columnFormat": "", "storage": "", "isVirtual": false, @@ -1684,7 +1684,7 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "状态:默认0可用,1禁用", + "comment": "状态:默认0启用,1禁用", "columnFormat": "", "storage": "", "isVirtual": false, @@ -1884,7 +1884,7 @@ "fields": [ { "objectType": "IndexField_MYSQL", - "name": "role_id", + "name": "dept_id", "keyLength": -2147483648, "order": "", "oldName": "" @@ -1901,8 +1901,8 @@ }, { "objectType": "Table_MYSQL", - "name": "pac_auth_dept", - "comment": "系统组织架构", + "name": "pac_auth_role_data_scope", + "comment": "角色的自定义数据权限范围(部门)", "engine": "", "characterSet": "", "collation": "", @@ -1977,7 +1977,7 @@ }, { "objectType": "TableField_MYSQL", - "name": "dept_id", + "name": "role_id", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -1992,18 +1992,18 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "组织/部门id", + "comment": "", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "dept_id" + "oldName": "role_id" }, { "objectType": "TableField_MYSQL", - "name": "pid", + "name": "dept_id", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -2015,21 +2015,21 @@ "collation": "", "isNullable": false, "defaultType": "Others", - "defaultValue": "0", + "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "父id", + "comment": "", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "pid" + "oldName": "dept_id" }, { "objectType": "TableField_MYSQL", - "name": "grade", + "name": "scope_id", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -2044,73 +2044,21 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "部门等级,下级部门自动+1", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "grade" - }, - { - "objectType": "TableField_MYSQL", - "name": "dept_name", - "type": "varchar", - "length": 255, - "decimals": -2147483648, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": true, - "defaultType": "Others", - "defaultValue": "", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "部门名称", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "dept_name" - }, - { - "objectType": "TableField_MYSQL", - "name": "dept_desc", - "type": "varchar", - "length": 255, - "decimals": -2147483648, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": true, - "defaultType": "Others", - "defaultValue": "", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "部门描述", + "comment": "", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "dept_desc" + "oldName": "scope_id" }, { "objectType": "TableField_MYSQL", - "name": "dept_type", + "name": "createby", "type": "int", - "length": -2147483648, - "decimals": -2147483648, + "length": 0, + "decimals": 0, "isUnsigned": false, "isZeroFill": false, "setEnumValues": "", @@ -2119,125 +2067,99 @@ "collation": "", "isNullable": false, "defaultType": "Others", - "defaultValue": "0", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "部门类型", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "dept_type" - }, - { - "objectType": "TableField_MYSQL", - "name": "dept_leader", - "type": "int", - "length": -2147483648, - "decimals": -2147483648, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": true, - "defaultType": "Others", "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "部门负责人,默认可以没有", + "comment": "创建人", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "dept_leader" + "oldName": "createby" }, { "objectType": "TableField_MYSQL", - "name": "default_role", - "type": "int", - "length": -2147483648, - "decimals": -2147483648, + "name": "createtime", + "type": "datetime", + "length": 0, + "decimals": 0, "isUnsigned": false, "isZeroFill": false, "setEnumValues": "", "isBinary": false, "charset": "", "collation": "", - "isNullable": true, + "isNullable": false, "defaultType": "Others", "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "默认角色,默认可以没有", + "comment": "创建时间", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "default_role" + "oldName": "createtime" }, { "objectType": "TableField_MYSQL", - "name": "order_num", + "name": "updateby", "type": "int", - "length": -2147483648, - "decimals": -2147483648, + "length": 0, + "decimals": 0, "isUnsigned": false, "isZeroFill": false, "setEnumValues": "", "isBinary": false, "charset": "", "collation": "", - "isNullable": false, - "defaultType": "Others", - "defaultValue": "0", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "NULL", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "排序,默认0", + "comment": "更新人", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "order_num" + "oldName": "updateby" }, { "objectType": "TableField_MYSQL", - "name": "status", - "type": "int", - "length": -2147483648, - "decimals": -2147483648, + "name": "updatetime", + "type": "datetime", + "length": 0, + "decimals": 0, "isUnsigned": false, "isZeroFill": false, "setEnumValues": "", "isBinary": false, "charset": "", "collation": "", - "isNullable": false, - "defaultType": "Others", - "defaultValue": "0", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "NULL", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "状态:默认0启用,1禁用", + "comment": "更新时间", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "status" + "oldName": "updatetime" }, { "objectType": "TableField_MYSQL", - "name": "createby", + "name": "deleteby", "type": "int", "length": 0, "decimals": 0, @@ -2247,23 +2169,23 @@ "isBinary": false, "charset": "", "collation": "", - "isNullable": false, - "defaultType": "Others", - "defaultValue": "", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "NULL", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "创建人", + "comment": "删除人", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "createby" + "oldName": "deleteby" }, { "objectType": "TableField_MYSQL", - "name": "createtime", + "name": "deletetime", "type": "datetime", "length": 0, "decimals": 0, @@ -2273,126 +2195,22 @@ "isBinary": false, "charset": "", "collation": "", - "isNullable": false, - "defaultType": "Others", - "defaultValue": "", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "NULL", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "创建时间", + "comment": "删除时间", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "createtime" - }, - { - "objectType": "TableField_MYSQL", - "name": "updateby", - "type": "int", - "length": 0, - "decimals": 0, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": true, - "defaultType": "Null", - "defaultValue": "NULL", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "更新人", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "updateby" - }, - { - "objectType": "TableField_MYSQL", - "name": "updatetime", - "type": "datetime", - "length": 0, - "decimals": 0, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": true, - "defaultType": "Null", - "defaultValue": "NULL", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "更新时间", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "updatetime" - }, - { - "objectType": "TableField_MYSQL", - "name": "deleteby", - "type": "int", - "length": 0, - "decimals": 0, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": true, - "defaultType": "Null", - "defaultValue": "NULL", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "删除人", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "deleteby" - }, - { - "objectType": "TableField_MYSQL", - "name": "deletetime", - "type": "datetime", - "length": 0, - "decimals": 0, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": true, - "defaultType": "Null", - "defaultValue": "NULL", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "删除时间", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "deletetime" - } - ], - "indexes": [ + "oldName": "deletetime" + } + ], + "indexes": [ { "objectType": "Index_MYSQL", "name": "pac_index", @@ -2426,7 +2244,7 @@ "fields": [ { "objectType": "IndexField_MYSQL", - "name": "dept_id", + "name": "scope_id", "keyLength": -2147483648, "order": "", "oldName": "" @@ -2443,8 +2261,8 @@ }, { "objectType": "Table_MYSQL", - "name": "pac_auth_role_data_scope", - "comment": "角色的自定义数据权限范围(部门)", + "name": "pac_auth_post", + "comment": "岗位", "engine": "", "characterSet": "", "collation": "", @@ -2508,7 +2326,7 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": true, - "comment": "数据完整性确认", + "comment": "数据完整性验证", "columnFormat": "", "storage": "", "isVirtual": false, @@ -2519,7 +2337,7 @@ }, { "objectType": "TableField_MYSQL", - "name": "role_id", + "name": "post_id", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -2534,18 +2352,96 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "", + "comment": "岗位id", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "role_id" + "oldName": "post_id" }, { "objectType": "TableField_MYSQL", - "name": "dept_id", + "name": "post_key", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "岗位标识", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "post_key" + }, + { + "objectType": "TableField_MYSQL", + "name": "post_name", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "岗位名称", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "post_name" + }, + { + "objectType": "TableField_MYSQL", + "name": "post_desc", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "岗位描述", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "post_desc" + }, + { + "objectType": "TableField_MYSQL", + "name": "order_num", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -2557,21 +2453,21 @@ "collation": "", "isNullable": false, "defaultType": "Others", - "defaultValue": "", + "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "", + "comment": "排序:默认0", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "dept_id" + "oldName": "order_num" }, { "objectType": "TableField_MYSQL", - "name": "scope_id", + "name": "status", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -2583,17 +2479,17 @@ "collation": "", "isNullable": false, "defaultType": "Others", - "defaultValue": "", + "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "", + "comment": "状态:默认0可以用,1禁用", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "scope_id" + "oldName": "status" }, { "objectType": "TableField_MYSQL", @@ -2786,8 +2682,8 @@ "fields": [ { "objectType": "IndexField_MYSQL", - "name": "scope_id", - "keyLength": -2147483648, + "name": "post_id", + "keyLength": 0, "order": "", "oldName": "" } @@ -2803,8 +2699,8 @@ }, { "objectType": "Table_MYSQL", - "name": "pac_auth_post", - "comment": "岗位", + "name": "pac_auth_link_user_dept", + "comment": "用户部门关联", "engine": "", "characterSet": "", "collation": "", @@ -2868,7 +2764,7 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": true, - "comment": "数据完整性验证", + "comment": "数据完整性确认", "columnFormat": "", "storage": "", "isVirtual": false, @@ -2879,7 +2775,7 @@ }, { "objectType": "TableField_MYSQL", - "name": "post_id", + "name": "user_id", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -2894,20 +2790,20 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "岗位id", + "comment": "", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "post_id" + "oldName": "user_id" }, { "objectType": "TableField_MYSQL", - "name": "post_key", - "type": "varchar", - "length": 255, + "name": "dept_id", + "type": "int", + "length": -2147483648, "decimals": -2147483648, "isUnsigned": false, "isZeroFill": false, @@ -2920,144 +2816,40 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "岗位标识", + "comment": "", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "post_key" + "oldName": "dept_id" }, { "objectType": "TableField_MYSQL", - "name": "post_name", - "type": "varchar", - "length": 255, - "decimals": -2147483648, + "name": "createby", + "type": "int", + "length": 0, + "decimals": 0, "isUnsigned": false, "isZeroFill": false, "setEnumValues": "", "isBinary": false, "charset": "", "collation": "", - "isNullable": true, + "isNullable": false, "defaultType": "Others", "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "岗位名称", + "comment": "创建人", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "post_name" - }, - { - "objectType": "TableField_MYSQL", - "name": "post_desc", - "type": "varchar", - "length": 255, - "decimals": -2147483648, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": true, - "defaultType": "Others", - "defaultValue": "", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "岗位描述", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "post_desc" - }, - { - "objectType": "TableField_MYSQL", - "name": "order_num", - "type": "int", - "length": -2147483648, - "decimals": -2147483648, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": false, - "defaultType": "Others", - "defaultValue": "0", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "排序:默认0", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "order_num" - }, - { - "objectType": "TableField_MYSQL", - "name": "status", - "type": "int", - "length": -2147483648, - "decimals": -2147483648, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": false, - "defaultType": "Others", - "defaultValue": "0", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "状态:默认0可以用,1禁用", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "status" - }, - { - "objectType": "TableField_MYSQL", - "name": "createby", - "type": "int", - "length": 0, - "decimals": 0, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": false, - "defaultType": "Others", - "defaultValue": "", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "创建人", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "createby" + "oldName": "createby" }, { "objectType": "TableField_MYSQL", @@ -3224,8 +3016,8 @@ "fields": [ { "objectType": "IndexField_MYSQL", - "name": "post_id", - "keyLength": 0, + "name": "index", + "keyLength": -2147483648, "order": "", "oldName": "" } @@ -3241,8 +3033,8 @@ }, { "objectType": "Table_MYSQL", - "name": "pac_auth_link_user_dept", - "comment": "用户部门关联", + "name": "pac_auth_user", + "comment": "用户表", "engine": "", "characterSet": "", "collation": "", @@ -3313,11 +3105,297 @@ "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "index" + "oldName": "index" + }, + { + "objectType": "TableField_MYSQL", + "name": "user_id", + "type": "bigint", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "用户id,可采用雪花id", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "user_id" + }, + { + "objectType": "TableField_MYSQL", + "name": "username", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "用户名", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "username" + }, + { + "objectType": "TableField_MYSQL", + "name": "password", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "密码", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "password" + }, + { + "objectType": "TableField_MYSQL", + "name": "nickname", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "昵称", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "nickname" + }, + { + "objectType": "TableField_MYSQL", + "name": "user_type", + "type": "int", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "0", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "用户类型,来源英语字典,默认0", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "user_type" + }, + { + "objectType": "TableField_MYSQL", + "name": "user_email", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "邮箱", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "user_email" + }, + { + "objectType": "TableField_MYSQL", + "name": "pid", + "type": "bigint", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "0", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "父账户,默认0", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "pid" + }, + { + "objectType": "TableField_MYSQL", + "name": "wx_appid", + "type": "int", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "微信id", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "wx_appid" + }, + { + "objectType": "TableField_MYSQL", + "name": "avatar", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "图标", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "avatar" + }, + { + "objectType": "TableField_MYSQL", + "name": "user_phone", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "电话", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "user_phone" + }, + { + "objectType": "TableField_MYSQL", + "name": "user_desc", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "用户描述", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "user_desc" }, { "objectType": "TableField_MYSQL", - "name": "user_id", + "name": "status", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -3329,21 +3407,21 @@ "collation": "", "isNullable": false, "defaultType": "Others", - "defaultValue": "", + "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "", + "comment": "状态:0默认正常,1禁用,2临时锁定", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "user_id" + "oldName": "status" }, { "objectType": "TableField_MYSQL", - "name": "dept_id", + "name": "have_children", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -3355,22 +3433,22 @@ "collation": "", "isNullable": false, "defaultType": "Others", - "defaultValue": "", + "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "", + "comment": "存在子账户:默认0,不存在", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "dept_id" + "oldName": "have_children" }, { "objectType": "TableField_MYSQL", "name": "createby", - "type": "int", + "type": "bigint", "length": 0, "decimals": 0, "isUnsigned": false, @@ -3406,7 +3484,7 @@ "charset": "", "collation": "", "isNullable": false, - "defaultType": "Others", + "defaultType": "None", "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, @@ -3422,7 +3500,7 @@ { "objectType": "TableField_MYSQL", "name": "updateby", - "type": "int", + "type": "bigint", "length": 0, "decimals": 0, "isUnsigned": false, @@ -3474,7 +3552,7 @@ { "objectType": "TableField_MYSQL", "name": "deleteby", - "type": "int", + "type": "bigint", "length": 0, "decimals": 0, "isUnsigned": false, @@ -3550,6 +3628,32 @@ "oldName": "" } ] + }, + { + "objectType": "Index_MYSQL", + "name": "username", + "type": "UNIQUE", + "method": "", + "comment": "", + "oldName": "", + "online": false, + "keyBlockSize": 0, + "parser": "", + "algorithm": "", + "lock": "", + "collation": "", + "cardinality": "", + "packed": "", + "IsVisibleIndex": true, + "fields": [ + { + "objectType": "IndexField_MYSQL", + "name": "username", + "keyLength": 0, + "order": "", + "oldName": "" + } + ] } ], "primaryKey": { @@ -3558,7 +3662,7 @@ "fields": [ { "objectType": "IndexField_MYSQL", - "name": "index", + "name": "user_id", "keyLength": -2147483648, "order": "", "oldName": "" @@ -3575,8 +3679,8 @@ }, { "objectType": "Table_MYSQL", - "name": "pac_auth_user", - "comment": "用户表", + "name": "pac_core_env", + "comment": "系统内运行时的环境变量", "engine": "", "characterSet": "", "collation": "", @@ -3651,7 +3755,7 @@ }, { "objectType": "TableField_MYSQL", - "name": "user_id", + "name": "env_id", "type": "bigint", "length": -2147483648, "decimals": -2147483648, @@ -3666,20 +3770,20 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "用户id,可采用雪花id", + "comment": "变量id", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "user_id" + "oldName": "env_id" }, { "objectType": "TableField_MYSQL", - "name": "username", - "type": "varchar", - "length": 255, + "name": "pid", + "type": "bigint", + "length": -2147483648, "decimals": -2147483648, "isUnsigned": false, "isZeroFill": false, @@ -3689,21 +3793,21 @@ "collation": "", "isNullable": false, "defaultType": "Others", - "defaultValue": "", + "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "用户名", + "comment": "env分组依据,默认0为没有分组", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "username" + "oldName": "pid" }, { "objectType": "TableField_MYSQL", - "name": "password", + "name": "env_name", "type": "varchar", "length": 255, "decimals": -2147483648, @@ -3718,18 +3822,18 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "密码", + "comment": "变量名称", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "password" + "oldName": "env_name" }, { "objectType": "TableField_MYSQL", - "name": "nickname", + "name": "env_key", "type": "varchar", "length": 255, "decimals": -2147483648, @@ -3744,44 +3848,18 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "昵称", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "nickname" - }, - { - "objectType": "TableField_MYSQL", - "name": "user_type", - "type": "int", - "length": -2147483648, - "decimals": -2147483648, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": false, - "defaultType": "Others", - "defaultValue": "0", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "用户类型,来源英语字典,默认0", + "comment": "变量标识", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "user_type" + "oldName": "env_key" }, { "objectType": "TableField_MYSQL", - "name": "user_email", + "name": "env_val", "type": "varchar", "length": 255, "decimals": -2147483648, @@ -3791,24 +3869,24 @@ "isBinary": false, "charset": "", "collation": "", - "isNullable": true, + "isNullable": false, "defaultType": "Others", "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "邮箱", + "comment": "变量值", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "user_email" + "oldName": "env_val" }, { "objectType": "TableField_MYSQL", - "name": "pid", - "type": "bigint", + "name": "val_is_dict", + "type": "int", "length": -2147483648, "decimals": -2147483648, "isUnsigned": false, @@ -3822,20 +3900,20 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "父账户,默认0", + "comment": "数值来源于字典:默认0不来源于字典,1来源于字典", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "pid" + "oldName": "val_is_dict" }, { "objectType": "TableField_MYSQL", - "name": "wx_appid", - "type": "int", - "length": -2147483648, + "name": "env_desc", + "type": "varchar", + "length": 255, "decimals": -2147483648, "isUnsigned": false, "isZeroFill": false, @@ -3848,20 +3926,20 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "微信id", + "comment": "变量描述", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "wx_appid" + "oldName": "env_desc" }, { "objectType": "TableField_MYSQL", - "name": "avatar", - "type": "varchar", - "length": 255, + "name": "have_children", + "type": "int", + "length": -2147483648, "decimals": -2147483648, "isUnsigned": false, "isZeroFill": false, @@ -3869,25 +3947,25 @@ "isBinary": false, "charset": "", "collation": "", - "isNullable": true, + "isNullable": false, "defaultType": "Others", - "defaultValue": "", + "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "图标", + "comment": "含有子节点:默认0不含有,1含有", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "avatar" + "oldName": "have_children" }, { "objectType": "TableField_MYSQL", - "name": "user_phone", - "type": "varchar", - "length": 255, + "name": "own_of_pac", + "type": "int", + "length": -2147483648, "decimals": -2147483648, "isUnsigned": false, "isZeroFill": false, @@ -3895,25 +3973,25 @@ "isBinary": false, "charset": "", "collation": "", - "isNullable": true, + "isNullable": false, "defaultType": "Others", - "defaultValue": "", + "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "电话", + "comment": "是否属于pac:默认0属于最高所有权,其他用户不可见", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "user_phone" + "oldName": "own_of_pac" }, { "objectType": "TableField_MYSQL", - "name": "user_desc", - "type": "varchar", - "length": 255, + "name": "order_num", + "type": "int", + "length": -2147483648, "decimals": -2147483648, "isUnsigned": false, "isZeroFill": false, @@ -3921,19 +3999,19 @@ "isBinary": false, "charset": "", "collation": "", - "isNullable": true, + "isNullable": false, "defaultType": "Others", - "defaultValue": "", + "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "用户描述", + "comment": "排序:默认0", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "user_desc" + "oldName": "order_num" }, { "objectType": "TableField_MYSQL", @@ -3952,7 +4030,7 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "状态:0默认正常,1禁用,2临时锁定", + "comment": "变量状态:0正常、1不可用", "columnFormat": "", "storage": "", "isVirtual": false, @@ -3963,9 +4041,9 @@ }, { "objectType": "TableField_MYSQL", - "name": "have_children", - "type": "int", - "length": -2147483648, + "name": "service_of", + "type": "varchar", + "length": 255, "decimals": -2147483648, "isUnsigned": false, "isZeroFill": false, @@ -3978,14 +4056,14 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "存在子账户:默认0,不存在", + "comment": "所属服务:0归属于当前服务:pacAuth", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "have_children" + "oldName": "service_of" }, { "objectType": "TableField_MYSQL", @@ -4026,7 +4104,7 @@ "charset": "", "collation": "", "isNullable": false, - "defaultType": "None", + "defaultType": "Others", "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, @@ -4170,32 +4248,6 @@ "oldName": "" } ] - }, - { - "objectType": "Index_MYSQL", - "name": "username", - "type": "UNIQUE", - "method": "", - "comment": "", - "oldName": "", - "online": false, - "keyBlockSize": 0, - "parser": "", - "algorithm": "", - "lock": "", - "collation": "", - "cardinality": "", - "packed": "", - "IsVisibleIndex": true, - "fields": [ - { - "objectType": "IndexField_MYSQL", - "name": "username", - "keyLength": 0, - "order": "", - "oldName": "" - } - ] } ], "primaryKey": { @@ -4204,7 +4256,7 @@ "fields": [ { "objectType": "IndexField_MYSQL", - "name": "user_id", + "name": "env_id", "keyLength": -2147483648, "order": "", "oldName": "" @@ -4221,8 +4273,8 @@ }, { "objectType": "Table_MYSQL", - "name": "pac_core_env", - "comment": "系统内运行时的环境变量", + "name": "pac_core_dict", + "comment": "核心字典", "engine": "", "characterSet": "", "collation": "", @@ -4293,37 +4345,11 @@ "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "index" - }, - { - "objectType": "TableField_MYSQL", - "name": "env_id", - "type": "bigint", - "length": -2147483648, - "decimals": -2147483648, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": false, - "defaultType": "Others", - "defaultValue": "", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "变量id", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "env_id" + "oldName": "index" }, { "objectType": "TableField_MYSQL", - "name": "pid", + "name": "dict_id", "type": "bigint", "length": -2147483648, "decimals": -2147483648, @@ -4335,47 +4361,47 @@ "collation": "", "isNullable": false, "defaultType": "Others", - "defaultValue": "0", + "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "env分组依据,默认0为没有分组", + "comment": "字典项id,", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "pid" + "oldName": "dict_id" }, { "objectType": "TableField_MYSQL", - "name": "env_name", - "type": "varchar", - "length": 255, + "name": "pid", + "type": "bigint", + "length": -2147483648, "decimals": -2147483648, - "isUnsigned": false, + "isUnsigned": true, "isZeroFill": false, "setEnumValues": "", "isBinary": false, "charset": "", "collation": "", - "isNullable": false, + "isNullable": true, "defaultType": "Others", "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "变量名称", + "comment": "字典项的父id", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "env_name" + "oldName": "pid" }, { "objectType": "TableField_MYSQL", - "name": "env_key", + "name": "dict_key", "type": "varchar", "length": 255, "decimals": -2147483648, @@ -4390,18 +4416,18 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "变量标识", + "comment": "字典项的唯一标识,id的显式表达", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "env_key" + "oldName": "dict_key" }, { "objectType": "TableField_MYSQL", - "name": "env_val", + "name": "dict_desc", "type": "varchar", "length": 255, "decimals": -2147483648, @@ -4411,25 +4437,25 @@ "isBinary": false, "charset": "", "collation": "", - "isNullable": false, + "isNullable": true, "defaultType": "Others", "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "变量值", + "comment": "字典项描述", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "env_val" + "oldName": "dict_desc" }, { "objectType": "TableField_MYSQL", - "name": "val_is_dict", - "type": "int", - "length": -2147483648, + "name": "dict_name", + "type": "varchar", + "length": 255, "decimals": -2147483648, "isUnsigned": false, "isZeroFill": false, @@ -4439,21 +4465,21 @@ "collation": "", "isNullable": false, "defaultType": "Others", - "defaultValue": "0", + "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "数值来源于字典:默认0不来源于字典,1来源于字典", + "comment": "字典项名称", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "val_is_dict" + "oldName": "dict_name" }, { "objectType": "TableField_MYSQL", - "name": "env_desc", + "name": "dict_icon", "type": "varchar", "length": 255, "decimals": -2147483648, @@ -4463,27 +4489,27 @@ "isBinary": false, "charset": "", "collation": "", - "isNullable": true, - "defaultType": "Others", - "defaultValue": "", + "isNullable": false, + "defaultType": "Empty", + "defaultValue": "Empty String", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "变量描述", + "comment": "字典项的图标", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "env_desc" + "oldName": "dict_icon" }, { "objectType": "TableField_MYSQL", - "name": "have_children", + "name": "dict_type", "type": "int", "length": -2147483648, "decimals": -2147483648, - "isUnsigned": false, + "isUnsigned": true, "isZeroFill": false, "setEnumValues": "", "isBinary": false, @@ -4494,14 +4520,14 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "含有子节点:默认0不含有,1含有", + "comment": "字典类型:0字符串、1图片、2图标,后面可拓展", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "have_children" + "oldName": "dict_type" }, { "objectType": "TableField_MYSQL", @@ -4509,7 +4535,7 @@ "type": "int", "length": -2147483648, "decimals": -2147483648, - "isUnsigned": false, + "isUnsigned": true, "isZeroFill": false, "setEnumValues": "", "isBinary": false, @@ -4535,7 +4561,7 @@ "type": "int", "length": -2147483648, "decimals": -2147483648, - "isUnsigned": false, + "isUnsigned": true, "isZeroFill": false, "setEnumValues": "", "isBinary": false, @@ -4546,7 +4572,7 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "排序:默认0", + "comment": "排序,默认0", "columnFormat": "", "storage": "", "isVirtual": false, @@ -4561,7 +4587,7 @@ "type": "int", "length": -2147483648, "decimals": -2147483648, - "isUnsigned": false, + "isUnsigned": true, "isZeroFill": false, "setEnumValues": "", "isBinary": false, @@ -4572,7 +4598,7 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "变量状态:0正常、1不可用", + "comment": "字典状态:0正常、1禁用可读", "columnFormat": "", "storage": "", "isVirtual": false, @@ -4594,8 +4620,8 @@ "charset": "", "collation": "", "isNullable": false, - "defaultType": "Others", - "defaultValue": "0", + "defaultType": "Empty", + "defaultValue": "Empty String", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, "comment": "所属服务:0归属于当前服务:pacAuth", @@ -4607,6 +4633,32 @@ "virtualType": "", "oldName": "service_of" }, + { + "objectType": "TableField_MYSQL", + "name": "have_children", + "type": "int", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "0", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "是否含有子节点:默认0不含有,1含有", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "have_children" + }, { "objectType": "TableField_MYSQL", "name": "createby", @@ -4798,7 +4850,7 @@ "fields": [ { "objectType": "IndexField_MYSQL", - "name": "env_id", + "name": "dict_id", "keyLength": -2147483648, "order": "", "oldName": "" @@ -4815,8 +4867,8 @@ }, { "objectType": "Table_MYSQL", - "name": "pac_core_dict", - "comment": "核心字典", + "name": "pac_core_menu", + "comment": "系统菜单", "engine": "", "characterSet": "", "collation": "", @@ -4891,7 +4943,7 @@ }, { "objectType": "TableField_MYSQL", - "name": "dict_id", + "name": "menu_id", "type": "bigint", "length": -2147483648, "decimals": -2147483648, @@ -4906,14 +4958,14 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "字典项id,", + "comment": "菜单ID", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "dict_id" + "oldName": "menu_id" }, { "objectType": "TableField_MYSQL", @@ -4921,18 +4973,18 @@ "type": "bigint", "length": -2147483648, "decimals": -2147483648, - "isUnsigned": true, + "isUnsigned": false, "isZeroFill": false, "setEnumValues": "", "isBinary": false, "charset": "", "collation": "", - "isNullable": true, + "isNullable": false, "defaultType": "Others", - "defaultValue": "", + "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "字典项的父id", + "comment": "父ID", "columnFormat": "", "storage": "", "isVirtual": false, @@ -4943,7 +4995,111 @@ }, { "objectType": "TableField_MYSQL", - "name": "dict_key", + "name": "have_children", + "type": "int", + "length": -2147483648, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "0", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "是否含有子节点:默认0不含有", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "have_children" + }, + { + "objectType": "TableField_MYSQL", + "name": "api_path", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "NULL", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "后端权限地址", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "api_path" + }, + { + "objectType": "TableField_MYSQL", + "name": "web_path", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "NULL", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "前端路由地址", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "web_path" + }, + { + "objectType": "TableField_MYSQL", + "name": "web_component_path", + "type": "varchar", + "length": 255, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "NULL", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "web_component_path" + }, + { + "objectType": "TableField_MYSQL", + "name": "menu_name", "type": "varchar", "length": 255, "decimals": -2147483648, @@ -4958,18 +5114,18 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "字典项的唯一标识,id的显式表达", + "comment": "菜单名称", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "dict_key" + "oldName": "menu_name" }, { "objectType": "TableField_MYSQL", - "name": "dict_desc", + "name": "menu_desc", "type": "varchar", "length": 255, "decimals": -2147483648, @@ -4984,20 +5140,20 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "字典项描述", + "comment": "菜单描述", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "dict_desc" + "oldName": "menu_desc" }, { "objectType": "TableField_MYSQL", - "name": "dict_name", - "type": "varchar", - "length": 255, + "name": "menu_type", + "type": "bigint", + "length": -2147483648, "decimals": -2147483648, "isUnsigned": false, "isZeroFill": false, @@ -5007,21 +5163,21 @@ "collation": "", "isNullable": false, "defaultType": "Others", - "defaultValue": "", + "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "字典项名称", + "comment": "菜单类型:来源于字典,默认0为默认类型", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "dict_name" + "oldName": "menu_type" }, { "objectType": "TableField_MYSQL", - "name": "dict_icon", + "name": "menu_icon", "type": "varchar", "length": 255, "decimals": -2147483648, @@ -5031,27 +5187,27 @@ "isBinary": false, "charset": "", "collation": "", - "isNullable": false, - "defaultType": "Empty", - "defaultValue": "Empty String", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "字典项的图标", + "comment": "菜单图标", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "dict_icon" + "oldName": "menu_icon" }, { "objectType": "TableField_MYSQL", - "name": "dict_type", + "name": "is_frame", "type": "int", "length": -2147483648, "decimals": -2147483648, - "isUnsigned": true, + "isUnsigned": false, "isZeroFill": false, "setEnumValues": "", "isBinary": false, @@ -5062,22 +5218,22 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "字典类型:0字符串、1图片、2图标,后面可拓展", + "comment": "是否是外链:默认0不是外链,1时外链", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "dict_type" + "oldName": "is_frame" }, { "objectType": "TableField_MYSQL", - "name": "own_of_pac", + "name": "is_visible", "type": "int", "length": -2147483648, "decimals": -2147483648, - "isUnsigned": true, + "isUnsigned": false, "isZeroFill": false, "setEnumValues": "", "isBinary": false, @@ -5088,22 +5244,22 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "是否属于pac:默认0属于最高所有权,其他用户不可见", + "comment": "是否为显示的菜单:默认0显示、1为不显示", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "own_of_pac" + "oldName": "is_visible" }, { "objectType": "TableField_MYSQL", - "name": "order_num", + "name": "is_activate", "type": "int", "length": -2147483648, "decimals": -2147483648, - "isUnsigned": true, + "isUnsigned": false, "isZeroFill": false, "setEnumValues": "", "isBinary": false, @@ -5114,22 +5270,22 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "排序,默认0", + "comment": "是否激活:默认0为激活可用状态,1为不可用", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "order_num" + "oldName": "is_activate" }, { "objectType": "TableField_MYSQL", - "name": "status", + "name": "order_num", "type": "int", "length": -2147483648, "decimals": -2147483648, - "isUnsigned": true, + "isUnsigned": false, "isZeroFill": false, "setEnumValues": "", "isBinary": false, @@ -5140,20 +5296,20 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "字典状态:0正常、1禁用可读", + "comment": "排序:默认0", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "status" + "oldName": "order_num" }, { "objectType": "TableField_MYSQL", - "name": "service_of", - "type": "varchar", - "length": 255, + "name": "status", + "type": "int", + "length": -2147483648, "decimals": -2147483648, "isUnsigned": false, "isZeroFill": false, @@ -5162,24 +5318,24 @@ "charset": "", "collation": "", "isNullable": false, - "defaultType": "Empty", - "defaultValue": "Empty String", + "defaultType": "Others", + "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "所属服务:0归属于当前服务:pacAuth", + "comment": "菜单状态:0正常、1禁用", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "service_of" + "oldName": "status" }, { "objectType": "TableField_MYSQL", - "name": "have_children", - "type": "int", - "length": -2147483648, + "name": "service_of", + "type": "varchar", + "length": 255, "decimals": -2147483648, "isUnsigned": false, "isZeroFill": false, @@ -5192,14 +5348,14 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "是否含有子节点:默认0不含有,1含有", + "comment": "所属服务:0归属于当前服务:pacAuth", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "have_children" + "oldName": "service_of" }, { "objectType": "TableField_MYSQL", @@ -5392,7 +5548,7 @@ "fields": [ { "objectType": "IndexField_MYSQL", - "name": "dict_id", + "name": "menu_id", "keyLength": -2147483648, "order": "", "oldName": "" @@ -5409,8 +5565,8 @@ }, { "objectType": "Table_MYSQL", - "name": "pac_core_menu", - "comment": "系统菜单", + "name": "pac_auth_role", + "comment": "角色", "engine": "", "characterSet": "", "collation": "", @@ -5473,7 +5629,7 @@ "defaultType": "Others", "defaultValue": "", "isOnUpdateCurrentTimestamp": false, - "isAutoInc": true, + "isAutoInc": false, "comment": "数据完整性确认", "columnFormat": "", "storage": "", @@ -5485,7 +5641,7 @@ }, { "objectType": "TableField_MYSQL", - "name": "menu_id", + "name": "role_id", "type": "bigint", "length": -2147483648, "decimals": -2147483648, @@ -5500,14 +5656,14 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "菜单ID", + "comment": "角色id", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "menu_id" + "oldName": "role_id" }, { "objectType": "TableField_MYSQL", @@ -5523,73 +5679,21 @@ "collation": "", "isNullable": false, "defaultType": "Others", - "defaultValue": "", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "父ID", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "pid" - }, - { - "objectType": "TableField_MYSQL", - "name": "have_children", - "type": "int", - "length": -2147483648, - "decimals": -2147483648, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": false, - "defaultType": "Others", "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "是否含有子节点:默认0不含有", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "have_children" - }, - { - "objectType": "TableField_MYSQL", - "name": "api_path", - "type": "varchar", - "length": 255, - "decimals": -2147483648, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": false, - "defaultType": "Others", - "defaultValue": "", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "后端权限地址", + "comment": "父id", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "api_path" + "oldName": "pid" }, { "objectType": "TableField_MYSQL", - "name": "web_path", + "name": "role_name", "type": "varchar", "length": 255, "decimals": -2147483648, @@ -5604,18 +5708,18 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "前端路由地址", + "comment": "角色名", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "web_path" + "oldName": "role_name" }, { "objectType": "TableField_MYSQL", - "name": "menu_name", + "name": "role_key", "type": "varchar", "length": 255, "decimals": -2147483648, @@ -5630,70 +5734,18 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "菜单名称", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "menu_name" - }, - { - "objectType": "TableField_MYSQL", - "name": "menu_desc", - "type": "varchar", - "length": 255, - "decimals": -2147483648, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": true, - "defaultType": "Others", - "defaultValue": "", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "菜单描述", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "menu_desc" - }, - { - "objectType": "TableField_MYSQL", - "name": "menu_type", - "type": "int", - "length": -2147483648, - "decimals": -2147483648, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": false, - "defaultType": "Others", - "defaultValue": "0", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "菜单类型:来源于字典,默认0为默认类型", + "comment": "角色标识", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "menu_type" + "oldName": "role_key" }, { "objectType": "TableField_MYSQL", - "name": "menu_icon", + "name": "role_desc", "type": "varchar", "length": 255, "decimals": -2147483648, @@ -5708,19 +5760,19 @@ "defaultValue": "", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "菜单图标", + "comment": "角色描述", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "menu_icon" + "oldName": "role_desc" }, { "objectType": "TableField_MYSQL", - "name": "is_frame", - "type": "int", + "name": "role_type", + "type": "bigint", "length": -2147483648, "decimals": -2147483648, "isUnsigned": false, @@ -5734,18 +5786,18 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "是否是外链:默认0不是外链,1时外链", + "comment": "来源于字典,默认0", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "is_frame" + "oldName": "role_type" }, { "objectType": "TableField_MYSQL", - "name": "is_visible", + "name": "role_data_scope", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -5757,21 +5809,21 @@ "collation": "", "isNullable": false, "defaultType": "Others", - "defaultValue": "0", + "defaultValue": "1", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "是否为显示的菜单:默认0显示、1为不显示", + "comment": "数据范围:默认全部1(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "is_visible" + "oldName": "role_data_scope" }, { "objectType": "TableField_MYSQL", - "name": "is_activate", + "name": "root", "type": "int", "length": -2147483648, "decimals": -2147483648, @@ -5786,14 +5838,14 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "是否激活:默认0为激活可用状态,1为不可用", + "comment": "1是属于Root的,无法删除和修改", "columnFormat": "", "storage": "", "isVirtual": false, "isGeneratedAlways": false, "virtualExpr": "", "virtualType": "", - "oldName": "is_activate" + "oldName": "root" }, { "objectType": "TableField_MYSQL", @@ -5838,7 +5890,7 @@ "defaultValue": "0", "isOnUpdateCurrentTimestamp": false, "isAutoInc": false, - "comment": "菜单状态:0正常、1禁用", + "comment": "状态:默认0可用,1禁用", "columnFormat": "", "storage": "", "isVirtual": false, @@ -5847,32 +5899,6 @@ "virtualType": "", "oldName": "status" }, - { - "objectType": "TableField_MYSQL", - "name": "service_of", - "type": "varchar", - "length": 255, - "decimals": -2147483648, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": false, - "defaultType": "Others", - "defaultValue": "0", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "所属服务:0归属于当前服务:pacAuth", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "service_of" - }, { "objectType": "TableField_MYSQL", "name": "createby", @@ -6064,7 +6090,7 @@ "fields": [ { "objectType": "IndexField_MYSQL", - "name": "menu_id", + "name": "role_id", "keyLength": -2147483648, "order": "", "oldName": "" diff --git a/package.json b/package.json index 1a3e094..95bdea2 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "class-transformer": "^0.5.1", "class-validator": "^0.14.1", "colors": "^1.4.0", - "drizzle-orm": "^0.31.0", + "drizzle-orm": "^0.31.2", "fastify": "^4.27.0", "mysql2": "^3.10.0", "nodemailer": "^6.9.13", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ae949c5..18e06ef 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42,8 +42,8 @@ importers: specifier: ^1.4.0 version: 1.4.0 drizzle-orm: - specifier: ^0.31.0 - version: 0.31.1(mysql2@3.10.0) + specifier: ^0.31.2 + version: 0.31.2(mysql2@3.10.0) fastify: specifier: ^4.27.0 version: 4.27.0 @@ -1712,8 +1712,8 @@ packages: resolution: {integrity: sha512-dxluXlhT1N9bpj2eZR3N/z3u4H0PbbrBYgyouIobFF25tOt2Buy1abx26Jii96qcYV0JgxjhnuV+FBcgR0Xa0w==} hasBin: true - drizzle-orm@0.31.1: - resolution: {integrity: sha512-hTbYne2XX3y6sV7WSxcPH6/vNSiQSUG9VZsFI27jBMCN0OT3Ok7ao3pIT5OMAqWkzJCRFgGjAaUeTAZWPgOKag==} + drizzle-orm@0.31.2: + resolution: {integrity: sha512-QnenevbnnAzmbNzQwbhklvIYrDE8YER8K7kSrAWQSV1YvFCdSQPzj+jzqRdTSsV2cDqSpQ0NXGyL1G9I43LDLg==} peerDependencies: '@aws-sdk/client-rds-data': '>=3' '@cloudflare/workers-types': '>=3' @@ -1723,6 +1723,7 @@ packages: '@op-engineering/op-sqlite': '>=2' '@opentelemetry/api': ^1.4.1 '@planetscale/database': '>=1' + '@tidbcloud/serverless': '*' '@types/better-sqlite3': '*' '@types/pg': '*' '@types/react': '>=18' @@ -1757,6 +1758,8 @@ packages: optional: true '@planetscale/database': optional: true + '@tidbcloud/serverless': + optional: true '@types/better-sqlite3': optional: true '@types/pg': @@ -5404,7 +5407,7 @@ snapshots: transitivePeerDependencies: - supports-color - drizzle-orm@0.31.1(mysql2@3.10.0): + drizzle-orm@0.31.2(mysql2@3.10.0): optionalDependencies: mysql2: 3.10.0 diff --git a/src/application/app.module.ts b/src/application/app.module.ts index 6422058..b318ee6 100644 --- a/src/application/app.module.ts +++ b/src/application/app.module.ts @@ -13,6 +13,7 @@ import { HttpExceptFilter } from '@common/http-except/http-except.filter'; import { CoreDictModule } from './core-dict/core-dict.module'; import { GlobalModule } from '@app/global.module'; import { CoreEnvModule } from './core-env/core-env.module'; +import { CoreMenuModule } from './core-menu/core-menu.module'; @Module({ imports: [ @@ -20,11 +21,12 @@ import { CoreEnvModule } from './core-env/core-env.module'; isGlobal: true, load: [configuration], }), + GlobalModule, TestModule, CoreServiceModule, CoreDictModule, - GlobalModule, CoreEnvModule, + CoreMenuModule, ], controllers: [AppController], providers: [ diff --git a/src/application/core-dict/core-dict.service.ts b/src/application/core-dict/core-dict.service.ts index 82757e0..b813831 100644 --- a/src/application/core-dict/core-dict.service.ts +++ b/src/application/core-dict/core-dict.service.ts @@ -36,6 +36,7 @@ export class CoreDictService { createName: pacAuthUser.nickname, createtime: pacCoreDict.createtime, updateby: pacCoreDict.updateby, + updateName: pacAuthUser.nickname, updatetime: pacCoreDict.updatetime, }; @@ -248,55 +249,48 @@ export class CoreDictService { // DB 查字典项的查询函数QueryBuilder,作用于列表和分页查询 private getDict(data, selectData = undefined) { - this.logger.info(JSON.stringify(data, null, 2)); - // ! 定义基础查询函数 // 启用动态查询模式 $dynamic - let query = this.mysqlService.db + const query = this.mysqlService.db .select(selectData) .from(pacCoreDict) - .where(isNull(pacCoreDict.deleteby)) .orderBy( isTrueEnum(data.isAsc) ? asc(pacCoreDict.orderNum) : desc(pacCoreDict.orderNum), isTrueEnum(data.isAsc) ? asc(pacCoreDict.dictId) : desc(pacCoreDict.dictId), ) .$dynamic(); + // 查询条件集合 + const wl = []; + + // ? 未删除 + wl.push(isNull(pacCoreDict.deleteby)); + // ? 模糊查询 - if (isExistKey(data, 'dictInfo')) { - query = query.where( - or( - like(pacCoreDict.dictKey, likeQuery(data.dictInfo)), - like(pacCoreDict.dictName, likeQuery(data.dictInfo)), - like(pacCoreDict.dictDesc, likeQuery(data.dictInfo)), - ), - ); - } + wl.push( + or( + like(pacCoreDict.dictKey, likeQuery(data.dictInfo)), + like(pacCoreDict.dictName, likeQuery(data.dictInfo)), + like(pacCoreDict.dictDesc, likeQuery(data.dictInfo)), + ).if(isExistKey(data, 'dictInfo')), + ); // ? 是否查pac的数据 - if (isExistKey(data, 'ownOfPac') && isTrueEnum(data['ownOfPac'])) { - query = query.where(eq(pacCoreDict.ownOfPac, isTrueEnum(data['ownOfPac']) ? 0 : 1)); - } + wl.push(eq(pacCoreDict.ownOfPac, isTrueEnum(data['ownOfPac']) ? 0 : 1).if(isExistKey(data, 'ownOfPac') && isTrueEnum(data['ownOfPac']))); // ? 按照层级查 - if (isExistKey(data, 'hierarchy')) { - query = query.where(eq(pacCoreDict.pid, data.hierarchy)); - } + wl.push(eq(pacCoreDict.pid, data.hierarchy).if(isExistKey(data, 'hierarchy'))); // ? 是否存在目标service - if (isExistKey(data, 'serviceOf')) { - query = query.where(eq(pacCoreDict.serviceOf, data.serviceOf)); - } + wl.push(eq(pacCoreDict.serviceOf, data.serviceOf).if(isExistKey(data, 'serviceOf'))); // ? 是否查字典类型 - if (isExistKey(data, 'dictType')) { - query = query.where(eq(pacCoreDict.dictType, data.dictType)); - } + wl.push(eq(pacCoreDict.dictType, data.dictType).if(isExistKey(data, 'dictType'))); // ? 是否查字典状态 - if (isExistKey(data, 'status')) { - query = query.where(eq(pacCoreDict.status, data.status)); - } + wl.push(eq(pacCoreDict.status, data.status).if(isExistKey(data, 'status'))); + + query.where(and(...wl)); return query; } diff --git a/src/application/core-dict/dto/create-core-dict.dto.ts b/src/application/core-dict/dto/create-core-dict.dto.ts index 245c526..99f4b75 100644 --- a/src/application/core-dict/dto/create-core-dict.dto.ts +++ b/src/application/core-dict/dto/create-core-dict.dto.ts @@ -1,25 +1,14 @@ import { ApiProperty } from '@nestjs/swagger'; -import { - IsBoolean, - IsEnum, - IsInt, - IsOptional, - IsString, - Length, - Max, - Min -} from "class-validator"; +import { IsBoolean, IsEnum, IsInt, IsOptional, IsString, Length, Max, Min } from 'class-validator'; import Trim from '@common/decorator/trim/trim.decorator'; -import { - BooleanEnum -} from "@utils/boolean.enum"; +import { BooleanEnum } from '@utils/boolean.enum'; export class CreateCoreDictDto { @ApiProperty({ description: '字典父ID', type: String, example: '0', - required: true, + required: false, minLength: 1, maxLength: 32, }) diff --git a/src/application/core-dict/dto/get-core-dict.dto.ts b/src/application/core-dict/dto/get-core-dict.dto.ts index 602f157..1f20536 100644 --- a/src/application/core-dict/dto/get-core-dict.dto.ts +++ b/src/application/core-dict/dto/get-core-dict.dto.ts @@ -16,6 +16,8 @@ import { ApiProperty } from '@nestjs/swagger'; import Trim from '@common/decorator/trim/trim.decorator'; import { IsEnum, IsInt, IsOptional, IsString, Length, Max, Min } from 'class-validator'; import { BooleanEnum } from '@utils/boolean.enum'; +import {Type} from "class-transformer"; +import Int from "@common/decorator/int/int.descrator"; export class GetPacCoreDictAllDto extends GetDto { @ApiProperty({ @@ -78,6 +80,7 @@ export class GetPacCoreDictAllDto extends GetDto { maximum: 100, }) @Trim() + @Int() @IsInt({ message: '字典状态必须是整数!', }) @@ -88,7 +91,7 @@ export class GetPacCoreDictAllDto extends GetDto { message: '字典状态不能超过100', }) @IsOptional() - readonly status?: number; + readonly status?: string; @ApiProperty({ description: '字典层级id', diff --git a/src/application/core-env/core-env.module.ts b/src/application/core-env/core-env.module.ts index 4ecf526..692ba6c 100644 --- a/src/application/core-env/core-env.module.ts +++ b/src/application/core-env/core-env.module.ts @@ -3,7 +3,7 @@ import { CoreEnvService } from './core-env.service'; import { CoreEnvController } from './core-env.controller'; @Module({ - controllers: [CoreEnvController], - providers: [CoreEnvService], + controllers: [CoreEnvController], + providers: [CoreEnvService], }) export class CoreEnvModule {} diff --git a/src/application/core-env/core-env.service.ts b/src/application/core-env/core-env.service.ts index 81fca95..55ab0ad 100644 --- a/src/application/core-env/core-env.service.ts +++ b/src/application/core-env/core-env.service.ts @@ -14,8 +14,6 @@ import { likeQuery } from '@utils/likeQuery'; import { QueryBuilder } from 'drizzle-orm/mysql-core'; import { customDrizzleRowWithRecursive } from '@utils/customDrizzleRowWithRecursive'; import { PacInfoType } from '@utils/myType'; -import { PacCoreDictIdDto } from '@app/core-dict/dto/get-core-dict.dto'; -import { UpdateCoreDictDto } from '@app/core-dict/dto/update-core-dict.dto'; @Injectable() export class CoreEnvService { @@ -205,7 +203,7 @@ export class CoreEnvService { return '删除目标环境变量成功'; } else { // ! 不存在目标环境变量,直接返回 - return '删除目标环境变量成功'; + throw new HttpException('未找到目标环境变量!', HttpStatus.BAD_REQUEST); } } @@ -258,64 +256,51 @@ export class CoreEnvService { // ! 定义基础查询函数 // 启用动态查询模式 $dynamic - let query = this.mysqlService.db + const query = this.mysqlService.db .select(selectData) .from(pacCoreEnv) - .where(isNull(pacCoreEnv.deleteby)) .leftJoin(pacCoreDict, and(eq(pacCoreDict.dictId, pacCoreEnv.envVal), eq(pacCoreEnv.valIsDict, 1))) .orderBy( isTrueEnum(data.isAsc) ? asc(pacCoreEnv.orderNum) : desc(pacCoreEnv.orderNum), isTrueEnum(data.isAsc) ? asc(pacCoreEnv.envId) : desc(pacCoreEnv.envId), ) - .where( - or( - like(pacCoreEnv.envKey, likeQuery(data.envInfo)), - like(pacCoreEnv.envName, likeQuery(data.envInfo)), - like(pacCoreEnv.envDesc, likeQuery(data.envInfo)), - like(pacCoreEnv.envVal, likeQuery(data.envInfo)), - like(pacCoreDict.dictKey, likeQuery(data.envInfo)), - like(pacCoreDict.dictName, likeQuery(data.envInfo)), - ).if(isExistKey(data, 'envInfo')), - ) .$dynamic(); + const wl = []; + + // ? 未删除 + + wl.push(isNull(pacCoreEnv.deleteby)); + // ? 模糊查询 - // if (isExistKey(data, 'envInfo')) { - // query = query.where( - // or( - // like(pacCoreEnv.envKey, likeQuery(data.envInfo)), - // like(pacCoreEnv.envName, likeQuery(data.envInfo)), - // like(pacCoreEnv.envDesc, likeQuery(data.envInfo)), - // like(pacCoreEnv.envVal, likeQuery(data.envInfo)), - // like(pacCoreDict.dictKey, likeQuery(data.envInfo)), - // like(pacCoreDict.dictName, likeQuery(data.envInfo)), - // ), - // ); - // } + wl.push( + or( + like(pacCoreEnv.envKey, likeQuery(data.envInfo)), + like(pacCoreEnv.envName, likeQuery(data.envInfo)), + like(pacCoreEnv.envDesc, likeQuery(data.envInfo)), + like(pacCoreEnv.envVal, likeQuery(data.envInfo)), + like(pacCoreDict.dictKey, likeQuery(data.envInfo)), + like(pacCoreDict.dictName, likeQuery(data.envInfo)), + ).if(isExistKey(data, 'envInfo')), + ); // ? 来源于字典 // if (isTrueEnum(data.valIsDict)) { // } // ? 是否查pac的数据 - if (isExistKey(data, 'ownOfPac') && isTrueEnum(data['ownOfPac'])) { - query = query.where(eq(pacCoreEnv.ownOfPac, isTrueEnum(data['ownOfPac']) ? 0 : 1)); - } + wl.push(eq(pacCoreEnv.ownOfPac, isTrueEnum(data['ownOfPac']) ? 0 : 1).if(isExistKey(data, 'ownOfPac') && isTrueEnum(data['ownOfPac']))); // ? 按照层级查 - if (isExistKey(data, 'hierarchy')) { - query = query.where(eq(pacCoreEnv.pid, data.hierarchy)); - } + wl.push(eq(pacCoreEnv.pid, data.hierarchy).if(isExistKey(data, 'hierarchy'))); // ? 是否存在目标service - if (isExistKey(data, 'serviceOf')) { - query = query.where(eq(pacCoreEnv.serviceOf, data.serviceOf)); - } + wl.push(eq(pacCoreEnv.serviceOf, data.serviceOf).if(isExistKey(data, 'serviceOf'))); // ? 是否查环境变量状态 - if (isExistKey(data, 'status')) { - query = query.where(eq(pacCoreEnv.status, data.status)); - } + wl.push(eq(pacCoreEnv.status, data.status).if(isExistKey(data, 'status'))); + + query.where(and(...wl)); return query; } diff --git a/src/application/core-env/dto/get-core-env.dto.ts b/src/application/core-env/dto/get-core-env.dto.ts index da13f54..dad832d 100644 --- a/src/application/core-env/dto/get-core-env.dto.ts +++ b/src/application/core-env/dto/get-core-env.dto.ts @@ -17,6 +17,8 @@ import Trim from '@common/decorator/trim/trim.decorator'; import { IsEnum, IsInt, IsOptional, IsString, Length, Max, Min } from 'class-validator'; import { BooleanEnum } from '@utils/boolean.enum'; import ChangeCase, { CaseType } from '@common/decorator/change-case/change-case.decorator'; +import {Type} from "class-transformer"; +import Int from "@common/decorator/int/int.descrator"; export class GetCoreEnvDTO extends GetDto { @ApiProperty({ @@ -68,6 +70,7 @@ export class GetCoreEnvDTO extends GetDto { maximum: 100, }) @Trim() + @Int() @IsInt({ message: '环境变量状态必须是整数!', }) @@ -78,7 +81,7 @@ export class GetCoreEnvDTO extends GetDto { message: '环境变量状态不能超过100', }) @IsOptional() - readonly status?: number; + readonly status?: string; @ApiProperty({ description: '环境变量层级id', diff --git a/src/application/core-menu/core-menu.controller.ts b/src/application/core-menu/core-menu.controller.ts new file mode 100644 index 0000000..b924350 --- /dev/null +++ b/src/application/core-menu/core-menu.controller.ts @@ -0,0 +1,54 @@ +import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common'; +import { CoreMenuService } from './core-menu.service'; +import { CreateCoreMenuDto } from './dto/create-core-menu.dto'; +import { UpdateCoreMenuDto } from './dto/update-core-menu.dto'; +import { ApiOperation, ApiProduces, ApiTags } from '@nestjs/swagger'; +import { PacInfo } from '@common/decorator/pac-info/pac-info.decorator'; +import { PacInfoType } from '@utils/myType'; +import { GetPacCoreMenuAllDto } from '@app/core-menu/dto/get-core-menu.dto'; + +@ApiTags('菜单服务') +@Controller('coremenu') +export class CoreMenuController { + constructor(private readonly coreMenuService: CoreMenuService) {} + + @ApiOperation({ + summary: '添加菜单', + description: '增加一个菜单/接口/菜单夹,可以是具体的项,也可以是一个层级', + }) + @ApiProduces('application/json') + @Post() + create(@Body() createCoreMenuDto: CreateCoreMenuDto, @PacInfo() pacInfo: PacInfoType) { + return this.coreMenuService.create(createCoreMenuDto, pacInfo); + } + + @ApiOperation({ + summary: '查菜单', + description: '查询菜单分页或者列表', + }) + @ApiProduces('application/json') + @Get() + findAll(@Query() getPacCoreMenuAllDto: GetPacCoreMenuAllDto, @PacInfo() pacInfo: PacInfoType) { + return this.coreMenuService.findAll(getPacCoreMenuAllDto, pacInfo); + } + + @ApiOperation({ + summary: '修改菜单内容', + description: '。', + }) + @ApiProduces('application/json') + @Patch(':menuId') + update(@Param('menuId') id: string, @Body() updateCoreMenuDto: UpdateCoreMenuDto, @PacInfo() pacInfo: PacInfoType) { + return this.coreMenuService.update(id, updateCoreMenuDto, pacInfo); + } + + @ApiOperation({ + summary: '删除指定菜单项', + description: '删除指定菜单项,子项存在不允许删除', + }) + @ApiProduces('application/json') + @Delete(':menuId') + remove(@Param('menuId') id: string, @PacInfo() pacInfo: PacInfoType) { + return this.coreMenuService.remove(id, pacInfo); + } +} diff --git a/src/application/core-menu/core-menu.module.ts b/src/application/core-menu/core-menu.module.ts new file mode 100644 index 0000000..defd8a5 --- /dev/null +++ b/src/application/core-menu/core-menu.module.ts @@ -0,0 +1,9 @@ +import { Module } from '@nestjs/common'; +import { CoreMenuService } from './core-menu.service'; +import { CoreMenuController } from './core-menu.controller'; + +@Module({ + controllers: [CoreMenuController], + providers: [CoreMenuService], +}) +export class CoreMenuModule {} diff --git a/src/application/core-menu/core-menu.service.ts b/src/application/core-menu/core-menu.service.ts new file mode 100644 index 0000000..2233ac4 --- /dev/null +++ b/src/application/core-menu/core-menu.service.ts @@ -0,0 +1,312 @@ +import { HttpException, HttpStatus, Injectable } from '@nestjs/common'; +import { CreateCoreMenuDto } from './dto/create-core-menu.dto'; +import { UpdateCoreMenuDto } from './dto/update-core-menu.dto'; +import { LoggerService } from '@service/logger/logger.service'; +import { MysqlService } from '@common/service/mysql/mysql.service'; +import { RedisService } from '@common/service/redis/redis.service'; +import { Snowflake } from '@service/snowflake/snowflake.service'; +import { ConfigService } from '@nestjs/config'; +import { PacInfoType } from '@utils/myType'; +import { pacAuthUser, pacCoreDict, pacCoreMenu, pacCoreService } from '@entities/schema'; +import { eq, sql, isNull, asc, desc, or, like, and } from 'drizzle-orm'; +import { isExistKey, isTrueEnum } from '@utils/boolean.enum'; +import { GetPacCoreMenuAllDto } from '@app/core-menu/dto/get-core-menu.dto'; +import { likeQuery } from '@utils/likeQuery'; + +@Injectable() +export class CoreMenuService { + // 详细的菜单信息 + private readonly menuMoreDataType = { + menuId: pacCoreMenu.menuId, + pid: pacCoreMenu.pid, + haveChildren: pacCoreMenu.haveChildren, + apiPath: pacCoreMenu.apiPath, + webPath: pacCoreMenu.webPath, + webComponentPath: pacCoreMenu.webComponentPath, + menuName: pacCoreMenu.menuName, + menuDesc: pacCoreMenu.menuDesc, + menuType: pacCoreMenu.menuType, + menuTypeKey: pacCoreDict.dictKey, + menuTypeName: pacCoreDict.dictName, + menuIcon: pacCoreMenu.menuIcon, + isFrame: pacCoreMenu.isFrame, + isVisible: pacCoreMenu.isVisible, + isActivate: pacCoreMenu.isActivate, + orderNum: pacCoreMenu.orderNum, + status: pacCoreMenu.status, + serviceOf: pacCoreMenu.serviceOf, + serviceName: pacCoreService.serviceName, + createby: pacCoreMenu.createby, + createName: pacAuthUser.nickname, + createtime: pacCoreMenu.createtime, + updateby: pacCoreMenu.updateby, + updateName: pacAuthUser.nickname, + updatetime: pacCoreMenu.updatetime, + }; + + // 菜单列表数据 + private readonly menuListDataType = { + menuId: pacCoreMenu.menuId, + pid: pacCoreMenu.pid, + haveChildren: pacCoreMenu.haveChildren, + apiPath: pacCoreMenu.apiPath, + webPath: pacCoreMenu.webPath, + webComponentPath: pacCoreMenu.webComponentPath, + menuName: pacCoreMenu.menuName, + menuType: pacCoreMenu.menuType, + menuTypeKey: pacCoreDict.dictKey, + menuIcon: pacCoreMenu.menuIcon, + isFrame: pacCoreMenu.isFrame, + isVisible: pacCoreMenu.isVisible, + isActivate: pacCoreMenu.isActivate, + orderNum: pacCoreMenu.orderNum, + serviceOf: pacCoreMenu.serviceOf, + serviceName: pacCoreService.serviceName, + }; + + constructor( + private readonly logger: LoggerService, + private readonly mysqlService: MysqlService, + private readonly redisService: RedisService, + private readonly snowflake: Snowflake, + private readonly config: ConfigService, + ) {} + + /** Service + * NAME: create + * DESC: 创建菜单内容 + * DATE: 2024-06-22 17:57:15 - + * */ + public async create(createCoreMenuDto: CreateCoreMenuDto, pacInfo: PacInfoType) { + // ! 加目标锁,允许同名,所以就不加锁了 + + // ? 判断是不是pac,不是的话直接退出 + if (this.config.get('masterId') !== pacInfo.userId) { + throw new HttpException('没有权限添加菜单!', HttpStatus.UNAUTHORIZED); + } + + // ! 执行写入 + const newPacCoreMenu = await this.addMenuData(createCoreMenuDto, pacInfo); + + // ? 判断是否存在pid,对pid的haveChildren进行变化 + await this.haveChildrenSelfIncreasing(createCoreMenuDto.pid); + return newPacCoreMenu; + } + + /** Service + * NAME: findAll + * DESC: 获取菜单列表/分页 + * DATE: 2024-06-22 18:21:57 - + * */ + public async findAll(getPacCoreMenuAllDto: GetPacCoreMenuAllDto, pacInfo: PacInfoType) { + // ? 是否查询列表 + if (isExistKey(getPacCoreMenuAllDto, 'isList') && isTrueEnum(getPacCoreMenuAllDto['isList'])) { + // ! 返回列表数据 + return await this.getMenuList(getPacCoreMenuAllDto, pacInfo); + } else { + // ! 返回分页数据 + return await this.getMenuPage(getPacCoreMenuAllDto, pacInfo); + } + } + + public update(id: string, updateCoreMenuDto: UpdateCoreMenuDto, pacInfo: PacInfoType) { + // ! 比较权限 + if (this.config.get('masterId') !== pacInfo.userId) { + throw new HttpException('没有权限删除菜单!', HttpStatus.UNAUTHORIZED); + } + + // ! 写入数据 + } + + public async remove(id: string, pacInfo: PacInfoType) { + // ! 比较权限 + if (this.config.get('masterId') !== pacInfo.userId) { + throw new HttpException('没有权限删除菜单!', HttpStatus.UNAUTHORIZED); + } + + // ! 查找菜单 + const result = await this.getMore(id); + if (result.length == 0) { + throw new HttpException('未找到目标菜单!', HttpStatus.BAD_REQUEST); + } + + // ! 执行删除 + await this.deleteMenuItem(id, pacInfo); + + // ! 更改发节点的子节点数 + if (result[0].pid != 0) { + await this.haveChildrenSelfIncreasing(result[0].pid, false); + } + + return '删除菜单成功'; + } + + // DB 增加菜单 + async addMenuData(createCoreMenuDto: CreateCoreMenuDto, pacInfo: PacInfoType) { + // ! 生成雪花id,用于字典主键 + const id = await this.snowflake.generate(); + + const newMenuData = { + menuId: id, + pid: createCoreMenuDto.pid, + apiPath: createCoreMenuDto.apiPath, + webPath: createCoreMenuDto.webPath, + webComponentPath: createCoreMenuDto.webComponentPath, + menuName: createCoreMenuDto.menuName, + menuDesc: createCoreMenuDto.menuDesc, + menuType: createCoreMenuDto.menuType, + menuIcon: createCoreMenuDto.menuIcon, + isFrame: isTrueEnum(createCoreMenuDto.isFrame) ? 1 : 0, + isVisible: isTrueEnum(createCoreMenuDto.isVisible) ? 0 : 1, + isActivate: isTrueEnum(createCoreMenuDto.isActivate) ? 0 : 1, + orderNum: createCoreMenuDto.orderNum, + serviceOf: createCoreMenuDto.serviceOf, + createby: pacInfo.userId, + createtime: sql`now()` as any, + }; + + return this.mysqlService.db.insert(pacCoreMenu).values(newMenuData); + } + + // DB 更新父级子元素数量 + private async haveChildrenSelfIncreasing(menuId: string, isAdd = true) { + return this.mysqlService.db + .update(pacCoreMenu) + .set({ + haveChildren: isAdd ? sql`${pacCoreMenu.haveChildren} + 1` : sql`${pacCoreMenu.haveChildren} - 1`, + }) + .where(eq(pacCoreMenu.menuId as any, menuId)); + } + + // 查菜单数据 + private getMenuData(data: GetPacCoreMenuAllDto, pacInfo: PacInfoType, selectData = undefined) { + // ! 定义基础查询函数 + // 启用动态查询模式 $dynamic + const query = this.mysqlService.db + .select(selectData) + .from(pacCoreMenu) + .leftJoin(pacCoreDict, eq(pacCoreMenu.menuType, pacCoreDict.dictId)) + .leftJoin(pacCoreService, eq(pacCoreMenu.serviceOf, pacCoreService.serviceKey)) + .orderBy( + isTrueEnum(data.isAsc) ? asc(pacCoreMenu.orderNum) : desc(pacCoreMenu.orderNum), + isTrueEnum(data.isAsc) ? asc(pacCoreMenu.menuId) : desc(pacCoreMenu.menuId), + ) + .$dynamic(); + + // ! 条件列表 + const wl = []; + + // ? 未删除 + wl.push(isNull(pacCoreMenu.deleteby)); + + // ? 模糊查询 + wl.push( + or(like(pacCoreMenu.menuName, likeQuery(data.menuInfo)), like(pacCoreMenu.menuDesc, likeQuery(data.menuInfo))).if(isExistKey(data, 'menuInfo')), + ); + + // ? 根据pid查 + wl.push(eq(pacCoreMenu.pid, data.hierarchy).if(isExistKey(data, 'hierarchy'))); + + // // ? 根据菜单类型查 + wl.push(eq(pacCoreMenu.menuType, data.menuType).if(isExistKey(data, 'menuType'))); + + // ? 根据服务名称查 + wl.push(eq(pacCoreMenu.serviceOf, data.serviceOf).if(isExistKey(data, 'serviceOf'))); + + // ? 根据是否是外部链接查 + wl.push(eq(pacCoreMenu.isFrame, isTrueEnum(data.isFrame) ? 1 : 0).if(isExistKey(data, 'isFrame'))); + + // ? 根据是否显示查 + wl.push(eq(pacCoreMenu.isVisible, isTrueEnum(data.isVisible) ? 0 : 1).if(isExistKey(data, 'isVisible'))); + + // ? 根据状态查 + wl.push(eq(pacCoreMenu.status, data.status as any).if(isExistKey(data, 'status'))); + + // ? 判断是否是pac查的 + if (this.config.get('masterId') === pacInfo.userId) { + // ? 是否要按照激活查 + if (isExistKey(data, 'isActivate')) { + wl.push(eq(pacCoreMenu.isActivate, isTrueEnum(data['isActivate']) ? 0 : 1)); + } + } else { + // 非pac只能查激活的 + wl.push(eq(pacCoreMenu.isActivate, 0)); + } + + query.where(and(...wl)); + return query; + } + + // DB 查列表数据 + private getMenuList(getMenuData: GetPacCoreMenuAllDto, pacInfo: PacInfoType) { + return this.getMenuData(getMenuData, pacInfo, this.menuListDataType); + } + + // DB查分页数据 + private async getMenuPage(getPacCoreMenuAllDto: GetPacCoreMenuAllDto, pacInfo: PacInfoType) { + const offset = (getPacCoreMenuAllDto.pageNumber - 1) * getPacCoreMenuAllDto.pageSize; + + // 使用基础查询构建查询总记录数 + const totalCountQuery = this.getMenuData(getPacCoreMenuAllDto, pacInfo, { + totalCount: sql`COUNT(*)`, + }); + + // 使用基础查询构建分页查询 + const paginatedQuery = this.getMenuData(getPacCoreMenuAllDto, pacInfo, this.menuMoreDataType) + .leftJoin(pacAuthUser, eq(pacCoreMenu.createby, pacAuthUser.userId)) + .limit(getPacCoreMenuAllDto.pageSize) + .offset(offset); + + return { + total: (await totalCountQuery)[0].totalCount, + rowData: await paginatedQuery, + searchData: getPacCoreMenuAllDto, + }; + } + + // DB 删除菜单 + private deleteMenuItem(id, pacInfo: PacInfoType) { + return this.mysqlService.db + .update(pacCoreMenu) + .set({ + deletetime: sql`now()`, + deleteby: pacInfo.userId, + }) + .where(eq(pacCoreMenu.menuId, id)); + } + + // DB 获取菜单信息 + private getMore(id) { + return this.mysqlService.db + .select({ + menuId: pacCoreMenu.menuId, + pid: pacCoreMenu.pid, + }) + .from(pacCoreMenu) + .where(and(isNull(pacCoreMenu.deleteby), eq(pacCoreMenu.menuId, id))); + } + + // DB 更新菜单信息 + private async updateMenuData(id, updateCoreMenuDto: UpdateCoreMenuDto, pacInfo: PacInfoType) { + return this.mysqlService.db + .update(pacCoreMenu) + .set({ + apiPath: updateCoreMenuDto.apiPath, + webPath: updateCoreMenuDto.webPath, + webComponentPath: updateCoreMenuDto.webComponentPath, + menuName: updateCoreMenuDto.menuName, + menuDesc: updateCoreMenuDto.menuDesc, + menuType: updateCoreMenuDto.menuType, + menuIcon: updateCoreMenuDto.menuIcon, + isFrame: isTrueEnum(updateCoreMenuDto.isFrame) ? 1 : 0, + isVisible: isTrueEnum(updateCoreMenuDto.isVisible) ? 0 : 1, + isActivate: isTrueEnum(updateCoreMenuDto.isActivate) ? 0 : 1, + orderNum: updateCoreMenuDto.orderNum, + status: updateCoreMenuDto.status, + serviceOf: updateCoreMenuDto.serviceOf, + updateby: pacInfo.userId, + updatetime: sql`now()`, + }) + .where(eq(pacCoreMenu.menuId, id)); + } +} diff --git a/src/application/core-menu/dto/create-core-menu.dto.ts b/src/application/core-menu/dto/create-core-menu.dto.ts new file mode 100644 index 0000000..b150a11 --- /dev/null +++ b/src/application/core-menu/dto/create-core-menu.dto.ts @@ -0,0 +1,185 @@ +import { ApiProperty } from '@nestjs/swagger'; +import Trim from '@common/decorator/trim/trim.decorator'; +import {IsEnum, IsInt, IsOptional, IsString, Length, Max, Min} from 'class-validator'; +import {BooleanEnum} from "@utils/boolean.enum"; + +export class CreateCoreMenuDto { + @ApiProperty({ + description: '菜单父ID', + type: String, + example: '0', + required: false, + minLength: 1, + maxLength: 32, + }) + @Trim() + @IsString({ message: '菜单关联属性应为字符串格式!' }) + @IsOptional() + readonly pid?: string = '0'; + + @ApiProperty({ + description: '菜单接口路径用:隔开', + type: String, + example: '0', + required: false, + minLength: 1, + maxLength: 255, + }) + @Trim() + @IsString({ message: '菜单接口路径应为字符串格式!' }) + @Length(1, 255, { message: '请将菜单接口路径长度控制在1到255位之间!' }) + @IsOptional() + readonly apiPath: string; + + @ApiProperty({ + description: '页面路由路径,前后不要带/,会被继承', + type: String, + example: '0', + required: false, + minLength: 1, + maxLength: 255, + }) + @Trim() + @IsString({ message: '页面路由路径应为字符串格式!' }) + @Length(1, 255, { message: '请将页面路由路径长度控制在1到255位之间!' }) + @IsOptional() + readonly webPath: string; + + @ApiProperty({ + description: '页面组件路径,从前端项目指定目录读取', + type: String, + example: '0', + required: false, + minLength: 1, + maxLength: 255, + }) + @Trim() + @IsString({ message: '页面组件路径应为字符串格式!' }) + @Length(1, 255, { message: '请将页面组件路径长度控制在1到255位之间!' }) + @IsOptional() + readonly webComponentPath: string; + + @ApiProperty({ + description: '菜单接口权限名称', + type: String, + example: '控制面板', + required: true, + minLength: 1, + maxLength: 32, + }) + @Trim() + @IsString({ message: '菜单接口权限名称应为字符串格式!' }) + @Length(1, 32, { message: '菜单接口权限名称长度控制在1到32位之间!' }) + readonly menuName: string; + + @ApiProperty({ + description: '菜单接口权限描述', + type: String, + example: '0', + required: false, + minLength: 1, + maxLength: 255, + }) + @Trim() + @IsString({ message: '菜单接口权限描述应为字符串格式!' }) + @Length(1, 255, { message: '请将菜单接口权限描述长度控制在1到255位之间!' }) + @IsOptional() + readonly menuDesc: string; + + @ApiProperty({ + description: '菜单类型,来自于字典', + type: String, + example: '0', + required: true, + minLength: 19, + maxLength: 19, + }) + @Trim() + @IsString({ message: '菜单类型格式不正确!' }) + @Length(19, 19, { message: '菜单类型格式不正确!' }) + readonly menuType: string; + + @ApiProperty({ + description: '菜单图标', + type: String, + example: '0', + required: false, + minLength: 1, + maxLength: 255, + }) + @Trim() + @IsString({ message: '菜单图标应为字符串格式!' }) + @Length(1, 255, { message: '请将菜单图标长度控制在1到255位之间!' }) + @IsOptional() + readonly menuIcon: string; + + @ApiProperty({ + description: '是否为外部链接', + type: BooleanEnum, + enum: BooleanEnum, + example: false, + required: false, + }) + @Trim() + @IsEnum(BooleanEnum, { message: '是否为外部链接参数格式错误' }) + @IsOptional() + readonly isFrame?: BooleanEnum = BooleanEnum.FALSE; + + @ApiProperty({ + description: '是否显示', + type: BooleanEnum, + enum: BooleanEnum, + example: false, + required: false, + }) + @Trim() + @IsEnum(BooleanEnum, { message: '是否显示参数格式错误' }) + @IsOptional() + readonly isVisible?: BooleanEnum = BooleanEnum.TRUE; + + @ApiProperty({ + description: '是否激活', + type: BooleanEnum, + enum: BooleanEnum, + example: false, + required: false, + }) + @Trim() + @IsEnum(BooleanEnum, { message: '是否激活参数格式错误' }) + @IsOptional() + readonly isActivate?: BooleanEnum = BooleanEnum.TRUE; + + @ApiProperty({ + description: '排序', + type: Number, + example: 10, + required: false, + minimum: -1000, + maximum: 1000, + }) + @IsOptional() + @IsInt({ + message: '排序必须是整数!', + }) + @Min(-1000, { + message: '排序不能小于-1000!', + }) + @Max(1000, { + message: '排序不能超过1000', + }) + readonly orderNum?: number = 0; + + @ApiProperty({ + description: '服务的唯一标识', + type: String, + example: 'CORE-PAC-AUTH', + required: false, + minLength: 2, + maxLength: 16, + }) + @Trim() + @IsString({ message: '服务标识应为字符串格式!' }) + @Length(2, 16, { message: '请将服务标识长度控制在2到16位之间!' }) + @IsOptional() + readonly serviceOf: string; +} diff --git a/src/application/core-menu/dto/get-core-menu.dto.ts b/src/application/core-menu/dto/get-core-menu.dto.ts new file mode 100644 index 0000000..31f2e04 --- /dev/null +++ b/src/application/core-menu/dto/get-core-menu.dto.ts @@ -0,0 +1,136 @@ +// | ------------------------------------------------------------ +// | @版本: version 0.1 +// | @创建人: 【Nie-hotok】 +// | @E-mail: x71291@outlook.com +// | @所在项目: pac-auth +// | @文件描述: get-core-menu.dto.ts - +// | @创建时间: 2024-06-22 16:05 +// | @更新时间: 2024-06-22 16:05 +// | @修改记录: +// | -*-*-*- (时间--修改人--修改说明) -*-*-*- +// | = +// | ------------------------------------------------------------ + +import { GetDto } from '@dto/get.dto'; +import { ApiProperty } from '@nestjs/swagger'; +import Trim from '@common/decorator/trim/trim.decorator'; +import { IsEnum, IsInt, IsOptional, IsString, Length, Max, Min } from 'class-validator'; +import { BooleanEnum } from '@utils/boolean.enum'; +import { Transform, Type } from 'class-transformer'; +import Int from '@common/decorator/int/int.descrator'; + +export class GetPacCoreMenuAllDto extends GetDto { + @ApiProperty({ + description: '菜单信息', + type: String, + example: '国家', + required: false, + minLength: 1, + maxLength: 128, + }) + @Trim() + @IsString({ message: '菜单信息应为字符串格式!' }) + @Length(0, 128, { message: '请将菜单信息长度控制在1到128位之间!' }) + @IsOptional() + readonly menuInfo?: string; + + @ApiProperty({ + description: '菜单类型,来自于字典', + type: String, + example: '0', + required: false, + minLength: 19, + maxLength: 19, + }) + @Trim() + @IsString({ message: '菜单类型格式不正确!' }) + @Length(19, 19, { message: '菜单类型格式不正确!' }) + @IsOptional() + readonly menuType: string; + + @ApiProperty({ + description: '服务的唯一标识', + type: String, + example: 'CORE-PAC-AUTH', + required: false, + minLength: 2, + maxLength: 16, + }) + @Trim() + @IsString({ message: '服务标识应为字符串格式!' }) + @Length(2, 16, { message: '请将服务标识长度控制在2到16位之间!' }) + @IsOptional() + readonly serviceOf: string; + + @ApiProperty({ + description: '是否为外部链接', + type: BooleanEnum, + enum: BooleanEnum, + example: false, + required: false, + }) + @Trim() + @IsEnum(BooleanEnum, { message: '是否为外部链接参数格式错误' }) + @IsOptional() + readonly isFrame?: BooleanEnum; + + @ApiProperty({ + description: '是否显示', + type: BooleanEnum, + enum: BooleanEnum, + example: false, + required: false, + }) + @Trim() + @IsEnum(BooleanEnum, { message: '是否显示参数格式错误' }) + @IsOptional() + readonly isVisible?: BooleanEnum; + + @ApiProperty({ + description: '是否激活', + type: BooleanEnum, + enum: BooleanEnum, + example: false, + required: false, + }) + @Trim() + @IsEnum(BooleanEnum, { message: '是否激活参数格式错误' }) + @IsOptional() + readonly isActivate?: BooleanEnum; + + @ApiProperty({ + description: '菜单状态', + type: Number, + example: 0, + required: false, + minimum: -100, + maximum: 100, + }) + @Trim() + @Int() + @IsInt({ + message: '菜单状态必须是整数!', + }) + @Min(-100, { + message: '菜单状态需要大于-100!', + }) + @Max(100, { + message: '菜单状态不能超过100', + }) + @IsOptional() + readonly status?: string; + + @ApiProperty({ + description: '字典层级id', + type: Number, + example: 0, + required: false, + minimum: 0, + maximum: 100, + }) + @Trim() + @IsString({ message: '字典层级id应为字符串格式!' }) + @Length(1, 20, { message: '字典层级id格式错误!' }) + @IsOptional() + readonly hierarchy?: string; +} diff --git a/src/application/core-menu/dto/update-core-menu.dto.ts b/src/application/core-menu/dto/update-core-menu.dto.ts new file mode 100644 index 0000000..6e3eb61 --- /dev/null +++ b/src/application/core-menu/dto/update-core-menu.dto.ts @@ -0,0 +1,25 @@ +import { ApiProperty, PartialType } from '@nestjs/swagger'; +import { CreateCoreMenuDto } from './create-core-menu.dto'; +import { IsInt, IsOptional, Max, Min } from 'class-validator'; + +export class UpdateCoreMenuDto extends PartialType(CreateCoreMenuDto) { + @ApiProperty({ + description: '状态', + type: Number, + example: 10, + required: false, + minimum: -100, + maximum: 100, + }) + @IsOptional() + @IsInt({ + message: '状态必须是整数!', + }) + @Min(-1000, { + message: '状态不能小于-100!', + }) + @Max(1000, { + message: '状态不能超过100', + }) + readonly status: number; +} diff --git a/src/application/core-menu/entities/core-menu.entity.ts b/src/application/core-menu/entities/core-menu.entity.ts new file mode 100644 index 0000000..3061fdf --- /dev/null +++ b/src/application/core-menu/entities/core-menu.entity.ts @@ -0,0 +1 @@ +export class CoreMenu {} diff --git a/src/application/core-service/core-service.service.ts b/src/application/core-service/core-service.service.ts index a854136..fcb6788 100644 --- a/src/application/core-service/core-service.service.ts +++ b/src/application/core-service/core-service.service.ts @@ -4,7 +4,7 @@ import { UpdateCoreServiceDto } from './dto/update-core-service.dto'; import { LoggerService } from '@service/logger/logger.service'; import { MysqlService } from '@common/service/mysql/mysql.service'; import { pacAuthUser, pacCoreService } from '@entities/schema'; -import { asc, desc, eq, isNull, like, or, sql } from 'drizzle-orm'; +import { and, asc, desc, eq, isNull, like, or, sql } from 'drizzle-orm'; import { PacInfoType } from '@utils/myType'; import { GetCoreServiceDto } from '@app/core-service/dto/get-core-service.dto'; import { likeQuery } from '@utils/likeQuery'; @@ -147,15 +147,18 @@ export class CoreServiceService { // 定义基础查询函数 const buildBaseQuery = (selectData = undefined) => { // 启用动态查询模式 $dynamic - let query = this.mysqlService.db.select(selectData).from(pacCoreService).where(isNull(pacCoreService.deleteby)).$dynamic(); + let query = this.mysqlService.db.select(selectData).from(pacCoreService).$dynamic(); // 根据条件添加额外的WHERE子句 if (getCoreServiceDto.serviceInfo) { query = query.where( - or( - like(pacCoreService.serviceKey, likeQuery(getCoreServiceDto.serviceInfo)), - like(pacCoreService.serviceName, likeQuery(getCoreServiceDto.serviceInfo)), - like(pacCoreService.serviceDesc, likeQuery(getCoreServiceDto.serviceInfo)), + and( + or( + like(pacCoreService.serviceKey, likeQuery(getCoreServiceDto.serviceInfo)), + like(pacCoreService.serviceName, likeQuery(getCoreServiceDto.serviceInfo)), + like(pacCoreService.serviceDesc, likeQuery(getCoreServiceDto.serviceInfo)), + ), + isNull(pacCoreService.deleteby), ), ); } diff --git a/src/common/decorator/int/int.descrator.ts b/src/common/decorator/int/int.descrator.ts new file mode 100644 index 0000000..3065aa4 --- /dev/null +++ b/src/common/decorator/int/int.descrator.ts @@ -0,0 +1,25 @@ +// | ------------------------------------------------------------ +// | @版本: version 0.1 +// | @创建人: 【Nie-hotok】 +// | @E-mail: x71291@outlook.com +// | @所在项目: pac-auth +// | @文件描述: int.descrator.ts - +// | @创建时间: 2024-06-22 19:07 +// | @更新时间: 2024-06-22 19:07 +// | @修改记录: +// | -*-*-*- (时间--修改人--修改说明) -*-*-*- +// | = +// | ------------------------------------------------------------ +import { Transform } from 'class-transformer'; + +export default function Int() { + return Transform(({ value }) => { + if (typeof value === 'string') { + if (value.trim() == '') { + return undefined; + } + return parseInt(value); + } + return value; + }); +} diff --git a/src/config/configuration.ts b/src/config/configuration.ts index 329c7d6..8c589a7 100644 --- a/src/config/configuration.ts +++ b/src/config/configuration.ts @@ -23,7 +23,7 @@ export default () => ({ version: process.env.npm_package_version || '0.0.1', }, logger: { - level: process.env['NODE_ENV'] === 'development' ? 'trace' : 'warning', + level: process.env['NODE_ENV'] === undefined || 'development' ? 'trace' : 'warning', }, swagger: { path: 'swagger', diff --git a/src/entities/schema.ts b/src/entities/schema.ts index d791642..aa243ce 100644 --- a/src/entities/schema.ts +++ b/src/entities/schema.ts @@ -293,11 +293,12 @@ export const pacCoreMenu = mysqlTable( menuId: bigint('menu_id', { mode: 'number' }).notNull(), pid: bigint('pid', { mode: 'number' }).notNull(), haveChildren: int('have_children').default(0).notNull(), - apiPath: varchar('api_path', { length: 255 }).notNull(), - webPath: varchar('web_path', { length: 255 }).notNull(), + apiPath: varchar('api_path', { length: 255 }), + webPath: varchar('web_path', { length: 255 }), + webComponentPath: varchar('web_component_path', { length: 255 }), menuName: varchar('menu_name', { length: 255 }).notNull(), menuDesc: varchar('menu_desc', { length: 255 }), - menuType: int('menu_type').default(0).notNull(), + menuType: bigint('menu_type', { mode: 'number' }).notNull(), menuIcon: varchar('menu_icon', { length: 255 }), isFrame: int('is_frame').default(0).notNull(), isVisible: int('is_visible').default(0).notNull(), diff --git a/src/main.ts b/src/main.ts index f5d7500..25df14b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -56,8 +56,6 @@ async function bootstrap() { // 获取日志模块 const logger = app.get(LoggerService); - // console.log(config); - // 开发环境 if (config.get('env') === 'development') { // 在开发环境下,开启openAPI diff --git a/src/service/logger/logger.service.ts b/src/service/logger/logger.service.ts index dadf34a..05c06d8 100644 --- a/src/service/logger/logger.service.ts +++ b/src/service/logger/logger.service.ts @@ -39,6 +39,8 @@ export class LoggerService { } }; + + // 创建一个 Winston 的 Logger 实例 private readonly logger: winston.Logger = winston.createLogger({ // 设置日志级别 diff --git a/src/service/snowflake/snowflake.service.ts b/src/service/snowflake/snowflake.service.ts index 8592c41..17557d2 100644 --- a/src/service/snowflake/snowflake.service.ts +++ b/src/service/snowflake/snowflake.service.ts @@ -40,7 +40,8 @@ export class Snowflake { if (machineId < 0 || machineId > Snowflake.MACHINE_ID_MASK) { throw new Error('Machine ID must be between 0 and ' + Snowflake.MACHINE_ID_MASK.toString()); } - console.log(machineId); + + // console.log(machineId); this.machineId = BigInt(machineId); } diff --git a/src/utils/boolean.enum.ts b/src/utils/boolean.enum.ts index 939a759..d6c2b6d 100644 --- a/src/utils/boolean.enum.ts +++ b/src/utils/boolean.enum.ts @@ -36,5 +36,5 @@ export function isTrueEnum(target) { // 判断是否存在目标值 export function isExistKey(target, key) { - return Object.keys(target).includes(key) && target[key] !== undefined && target[key] !== null && target[key] != ''; + return Object.keys(target).includes(key) && target[key] !== undefined && target[key] !== null && target[key] !== ''; } diff --git a/src/utils/customDrizzleRowWithRecursive.ts b/src/utils/customDrizzleRowWithRecursive.ts index 98bfae1..d65bf5f 100644 --- a/src/utils/customDrizzleRowWithRecursive.ts +++ b/src/utils/customDrizzleRowWithRecursive.ts @@ -13,7 +13,6 @@ import { sql } from 'drizzle-orm'; - // 将递归查询的自定义列明返回,数据来源于要查的列命,并增加level字段 export function customDrizzleRowWithRecursive(obj) { // ! 获取所有的列别名