diff --git a/Backend/App_Data/BIMS_Mitsubishi_v01.ndm2 b/Backend/App_Data/BIMS_Mitsubishi_v03.ndm2 similarity index 99% rename from Backend/App_Data/BIMS_Mitsubishi_v01.ndm2 rename to Backend/App_Data/BIMS_Mitsubishi_v03.ndm2 index 6934d81..9b9b9f7 100644 --- a/Backend/App_Data/BIMS_Mitsubishi_v01.ndm2 +++ b/Backend/App_Data/BIMS_Mitsubishi_v03.ndm2 @@ -4606,260 +4606,6 @@ "triggers": [], "tablePartitions": [] }, - { - "objectType": "Table_MYSQL", - "name": "device_group", - "comment": "設備類別 - UI 過濾用", - "engine": "InnoDB", - "characterSet": "utf8mb4", - "collation": "utf8mb4_unicode_ci", - "autoIncrement": 0, - "tablespace": "", - "storage": "", - "insertMethod": "", - "connection": "", - "checksum": false, - "rowFormat": "Dynamic", - "avgRowLength": 0, - "maxRows": 0, - "minRows": 0, - "keyBlockSize": 0, - "packKeys": "", - "delayKeyWrite": false, - "dataDirectory": "", - "indexDirectory": "", - "statsAutoRecalc": "", - "statsPersistent": "", - "statsSamplePages": 0, - "union": "", - "pageCheckSum": false, - "transactional": false, - "compression": "", - "oldName": "device_group", - "encryption": false, - "createOptions": "", - "createTime": "2022-10-20 12:14:31", - "checkTime": "", - "dataFree": 0, - "dataLength": 147456, - "indexLength": 0, - "maxDataLength": 0, - "rows": 1040, - "updateTime": "", - "DDL": "CREATE TABLE `device_group` (\n `id` int(11) NOT NULL COMMENT 'id',\n `device_disaster` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '災類',\n `device_building_guid` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '設備東別guid',\n `device_floor_guid` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '設備樓層guid',\n `device_system_category_layer2` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,\n `device_system_category_layer3` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,\n `device_amount` int(11) NOT NULL DEFAULT '0' COMMENT '設備總計',\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='設備類別 - UI 過濾用'", - "partitionBy": "", - "partitionByExpr": "", - "partitions": 0, - "partitionKeyAlgorithm": "", - "subPartitionBy": "", - "subPartitionByExpr": "", - "subPartitions": 0, - "subPartitionKeyAlgorithm": "", - "fields": [ - { - "objectType": "TableField_MYSQL", - "name": "id", - "type": "int", - "length": 11, - "decimals": 0, - "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": "id" - }, - { - "objectType": "TableField_MYSQL", - "name": "device_disaster", - "type": "varchar", - "length": 50, - "decimals": 0, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "utf8mb4", - "collation": "utf8mb4_unicode_ci", - "isNullable": true, - "defaultType": "Null", - "defaultValue": "", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "災類", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "device_disaster" - }, - { - "objectType": "TableField_MYSQL", - "name": "device_building_guid", - "type": "varchar", - "length": 36, - "decimals": 0, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "utf8mb4", - "collation": "utf8mb4_unicode_ci", - "isNullable": true, - "defaultType": "Null", - "defaultValue": "", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "設備東別guid", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "device_building_guid" - }, - { - "objectType": "TableField_MYSQL", - "name": "device_floor_guid", - "type": "varchar", - "length": 36, - "decimals": 0, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "utf8mb4", - "collation": "utf8mb4_unicode_ci", - "isNullable": true, - "defaultType": "Null", - "defaultValue": "", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "設備樓層guid", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "device_floor_guid" - }, - { - "objectType": "TableField_MYSQL", - "name": "device_system_category_layer2", - "type": "varchar", - "length": 50, - "decimals": 0, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "utf8mb4", - "collation": "utf8mb4_unicode_ci", - "isNullable": true, - "defaultType": "Null", - "defaultValue": "", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "device_system_category_layer2" - }, - { - "objectType": "TableField_MYSQL", - "name": "device_system_category_layer3", - "type": "varchar", - "length": 50, - "decimals": 0, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "utf8mb4", - "collation": "utf8mb4_unicode_ci", - "isNullable": true, - "defaultType": "Null", - "defaultValue": "", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "device_system_category_layer3" - }, - { - "objectType": "TableField_MYSQL", - "name": "device_amount", - "type": "int", - "length": 11, - "decimals": 0, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "", - "collation": "", - "isNullable": false, - "defaultType": "Others", - "defaultValue": "0", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "設備總計", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "device_amount" - } - ], - "indexes": [], - "primaryKey": { - "objectType": "PrimaryKey_MYSQL", - "name": "", - "fields": [ - { - "objectType": "IndexField_MYSQL", - "name": "id", - "keyLength": 0, - "order": "", - "oldName": "id" - } - ], - "oldName": "", - "indexMethod": "BTREE", - "comment": "" - }, - "foreignKeys": [], - "triggers": [], - "tablePartitions": [] - }, { "objectType": "Table_MYSQL", "name": "device_item", @@ -9036,32 +8782,6 @@ "virtualType": "", "oldName": "floor_guid" }, - { - "objectType": "TableField_MYSQL", - "name": "building_guid", - "type": "varchar", - "length": 36, - "decimals": 0, - "isUnsigned": false, - "isZeroFill": false, - "setEnumValues": "", - "isBinary": false, - "charset": "utf8mb4", - "collation": "utf8mb4_unicode_ci", - "isNullable": false, - "defaultType": "Empty", - "defaultValue": "", - "isOnUpdateCurrentTimestamp": false, - "isAutoInc": false, - "comment": "區域guid", - "columnFormat": "", - "storage": "", - "isVirtual": false, - "isGeneratedAlways": false, - "virtualExpr": "", - "virtualType": "", - "oldName": "building_guid" - }, { "objectType": "TableField_MYSQL", "name": "building_tag", @@ -17489,6 +17209,286 @@ "foreignKeys": [], "triggers": [], "tablePartitions": [] + }, + { + "objectType": "Table_MYSQL", + "name": "device_group", + "comment": "設備類別 - UI 過濾用", + "engine": "InnoDB", + "characterSet": "utf8mb4", + "collation": "utf8mb4_unicode_ci", + "autoIncrement": 0, + "tablespace": "", + "storage": "", + "insertMethod": "", + "connection": "", + "checksum": false, + "rowFormat": "Dynamic", + "avgRowLength": 0, + "maxRows": 0, + "minRows": 0, + "keyBlockSize": 0, + "packKeys": "", + "delayKeyWrite": false, + "dataDirectory": "", + "indexDirectory": "", + "statsAutoRecalc": "", + "statsPersistent": "", + "statsSamplePages": 0, + "union": "", + "pageCheckSum": false, + "transactional": false, + "compression": "", + "oldName": "device_group", + "encryption": false, + "createOptions": "", + "createTime": "2022-10-20 12:14:31", + "checkTime": "", + "dataFree": 0, + "dataLength": 147456, + "indexLength": 0, + "maxDataLength": 0, + "rows": 1040, + "updateTime": "", + "DDL": "CREATE TABLE `device_group` (\n `id` int(11) NOT NULL COMMENT 'id',\n `device_disaster` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '災類',\n `device_building_guid` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '設備東別guid',\n `device_floor_guid` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '設備樓層guid',\n `device_system_category_layer2` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,\n `device_system_category_layer3` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,\n `device_amount` int(11) NOT NULL DEFAULT '0' COMMENT '設備總計',\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='設備類別 - UI 過濾用'", + "partitionBy": "", + "partitionByExpr": "", + "partitions": 0, + "partitionKeyAlgorithm": "", + "subPartitionBy": "", + "subPartitionByExpr": "", + "subPartitions": 0, + "subPartitionKeyAlgorithm": "", + "fields": [ + { + "objectType": "TableField_MYSQL", + "name": "id", + "type": "int", + "length": 11, + "decimals": 0, + "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": "id" + }, + { + "objectType": "TableField_MYSQL", + "name": "device_disaster", + "type": "varchar", + "length": 50, + "decimals": 0, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8mb4", + "collation": "utf8mb4_unicode_ci", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "災類", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "device_disaster" + }, + { + "objectType": "TableField_MYSQL", + "name": "device_area_tag", + "type": "varchar", + "length": 36, + "decimals": -2147483648, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": true, + "defaultType": "Others", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "設備區域tag", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "device_area_tag" + }, + { + "objectType": "TableField_MYSQL", + "name": "device_building_tag", + "type": "varchar", + "length": 36, + "decimals": 0, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8mb4", + "collation": "utf8mb4_unicode_ci", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "設備東別tag", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "device_building_tag" + }, + { + "objectType": "TableField_MYSQL", + "name": "device_floor_guid", + "type": "varchar", + "length": 36, + "decimals": 0, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8mb4", + "collation": "utf8mb4_unicode_ci", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "設備樓層guid", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "device_floor_guid" + }, + { + "objectType": "TableField_MYSQL", + "name": "device_system_category_layer2", + "type": "varchar", + "length": 50, + "decimals": 0, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8mb4", + "collation": "utf8mb4_unicode_ci", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "device_system_category_layer2" + }, + { + "objectType": "TableField_MYSQL", + "name": "device_system_category_layer3", + "type": "varchar", + "length": 50, + "decimals": 0, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "utf8mb4", + "collation": "utf8mb4_unicode_ci", + "isNullable": true, + "defaultType": "Null", + "defaultValue": "", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "device_system_category_layer3" + }, + { + "objectType": "TableField_MYSQL", + "name": "device_amount", + "type": "int", + "length": 11, + "decimals": 0, + "isUnsigned": false, + "isZeroFill": false, + "setEnumValues": "", + "isBinary": false, + "charset": "", + "collation": "", + "isNullable": false, + "defaultType": "Others", + "defaultValue": "0", + "isOnUpdateCurrentTimestamp": false, + "isAutoInc": false, + "comment": "設備總計", + "columnFormat": "", + "storage": "", + "isVirtual": false, + "isGeneratedAlways": false, + "virtualExpr": "", + "virtualType": "", + "oldName": "device_amount" + } + ], + "indexes": [], + "primaryKey": { + "objectType": "PrimaryKey_MYSQL", + "name": "", + "fields": [ + { + "objectType": "IndexField_MYSQL", + "name": "id", + "keyLength": 0, + "order": "", + "oldName": "id" + } + ], + "oldName": "", + "indexMethod": "BTREE", + "comment": "" + }, + "foreignKeys": [], + "triggers": [], + "tablePartitions": [] } ], "views": [] @@ -17513,8 +17513,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "auth_page", - "x": 20, - "y": 1440, + "x": 2080, + "y": 2270, "width": 270, "height": 250, "isBold": false, @@ -17529,8 +17529,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "building_menu", - "x": 720, - "y": 1260, + "x": 1960, + "y": 420, "width": 510, "height": 430, "isBold": false, @@ -17545,8 +17545,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "data_delivery_log", - "x": 1400, - "y": 2180, + "x": 490, + "y": 1730, "width": 181, "height": 170, "isBold": false, @@ -17577,8 +17577,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "device_disaster", - "x": 1230, - "y": 1100, + "x": 140, + "y": 510, "width": 320, "height": 110, "isBold": false, @@ -17593,10 +17593,10 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "device_group", - "x": 330, - "y": 1890, + "x": 1030, + "y": 80, "width": 320, - "height": 210, + "height": 220, "isBold": false, "titleColor": { "r": 55, @@ -17609,10 +17609,10 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "device_item", - "x": 30, - "y": 300, + "x": 1040, + "y": 460, "width": 430, - "height": 340, + "height": 380, "isBold": false, "titleColor": { "r": 55, @@ -17625,10 +17625,10 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "device_kind", - "x": 1100, - "y": 70, + "x": 0, + "y": 910, "width": 510, - "height": 750, + "height": 780, "isBold": false, "titleColor": { "r": 55, @@ -17673,8 +17673,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "emergency_event", - "x": 590, - "y": 2400, + "x": 30, + "y": 3160, "width": 280, "height": 220, "isBold": false, @@ -17689,8 +17689,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "emergency_item", - "x": 1410, - "y": 2380, + "x": 930, + "y": 3150, "width": 237, "height": 230, "isBold": false, @@ -17705,8 +17705,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "emergency_member", - "x": 890, - "y": 2360, + "x": 330, + "y": 3120, "width": 260, "height": 260, "isBold": false, @@ -17721,8 +17721,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "emergency_setting", - "x": 10, - "y": 1990, + "x": 620, + "y": 3070, "width": 290, "height": 310, "isBold": false, @@ -17737,8 +17737,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "floor", - "x": 350, - "y": 1320, + "x": 1880, + "y": 30, "width": 320, "height": 310, "isBold": false, @@ -17753,8 +17753,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "history_config", - "x": 370, - "y": 2120, + "x": 0, + "y": 1730, "width": 218, "height": 270, "isBold": false, @@ -17785,8 +17785,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "light_schedule", - "x": 1260, - "y": 1620, + "x": 190, + "y": 0, "width": 330, "height": 290, "isBold": false, @@ -17797,28 +17797,12 @@ "a": 1 } }, - { - "type": "table", - "schemaName": "bims_mitsubishi", - "tableName": "main_system", - "x": 870, - "y": 2080, - "width": 260, - "height": 250, - "isBold": false, - "titleColor": { - "r": 55, - "g": 131, - "b": 192, - "a": 1 - } - }, { "type": "table", "schemaName": "bims_mitsubishi", "tableName": "ontime_alarm_device_rawdata", - "x": 2150, - "y": 30, + "x": 40, + "y": 2890, "width": 230, "height": 230, "isBold": false, @@ -17833,8 +17817,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "ontime_device_subscription", - "x": 1610, - "y": 2150, + "x": 720, + "y": 1730, "width": 215, "height": 190, "isBold": false, @@ -17849,8 +17833,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "operation_back_log", - "x": 1140, - "y": 2160, + "x": 250, + "y": 1730, "width": 204, "height": 190, "isBold": false, @@ -17865,8 +17849,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "operation_log", - "x": 1170, - "y": 2390, + "x": 960, + "y": 1730, "width": 215, "height": 230, "isBold": false, @@ -17881,8 +17865,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "orion_OrionAppVersion", - "x": 2450, - "y": 30, + "x": 330, + "y": 2900, "width": 205, "height": 110, "isBold": false, @@ -17897,8 +17881,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "rescue_device", - "x": 10, - "y": 2320, + "x": 830, + "y": 1440, "width": 350, "height": 250, "isBold": false, @@ -17913,10 +17897,10 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "role", - "x": 2230, - "y": 870, + "x": 1800, + "y": 1740, "width": 181, - "height": 230, + "height": 250, "isBold": false, "titleColor": { "r": 55, @@ -17929,8 +17913,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "role_auth", - "x": 20, - "y": 1250, + "x": 2090, + "y": 2080, "width": 250, "height": 140, "isBold": false, @@ -17945,8 +17929,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "schedule_device", - "x": 360, - "y": 2430, + "x": 230, + "y": 370, "width": 230, "height": 110, "isBold": false, @@ -17957,46 +17941,14 @@ "a": 1 } }, - { - "type": "table", - "schemaName": "bims_mitsubishi", - "tableName": "sub_system", - "x": 600, - "y": 2110, - "width": 270, - "height": 220, - "isBold": false, - "titleColor": { - "r": 55, - "g": 131, - "b": 192, - "a": 1 - } - }, { "type": "table", "schemaName": "bims_mitsubishi", "tableName": "sub_system_floor", - "x": 1880, - "y": 30, + "x": 1560, + "y": 50, "width": 208, - "height": 290, - "isBold": false, - "titleColor": { - "r": 55, - "g": 131, - "b": 192, - "a": 1 - } - }, - { - "type": "table", - "schemaName": "bims_mitsubishi", - "tableName": "sub_system_floor_bak", - "x": 1920, - "y": 870, - "width": 239, - "height": 270, + "height": 310, "isBold": false, "titleColor": { "r": 55, @@ -18009,8 +17961,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "userinfo", - "x": 20, - "y": 870, + "x": 2100, + "y": 1700, "width": 240, "height": 330, "isBold": false, @@ -18025,8 +17977,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "variable", - "x": 290, - "y": 880, + "x": 1590, + "y": 500, "width": 250, "height": 310, "isBold": false, @@ -18041,8 +17993,8 @@ "type": "table", "schemaName": "bims_mitsubishi", "tableName": "building", - "x": 1260, - "y": 1270, + "x": 2300, + "y": 30, "width": 289, "height": 310, "isBold": false, @@ -18065,12 +18017,12 @@ "endStyle": "normal", "vertices": [ { - "x": 580, - "y": 490 + "x": 1590, + "y": 660 }, { - "x": 460, - "y": 490 + "x": 1470, + "y": 660 } ] }, @@ -18149,12 +18101,12 @@ "endStyle": "normal", "vertices": [ { - "x": 140, - "y": 1200 + "x": 2220, + "y": 2030 }, { - "x": 140, - "y": 1250 + "x": 2220, + "y": 2080 } ] }, @@ -18170,12 +18122,222 @@ "endStyle": "normal", "vertices": [ { - "x": 140, - "y": 1440 + "x": 2220, + "y": 2270 }, { - "x": 140, - "y": 1390 + "x": 2220, + "y": 2220 + } + ] + }, + { + "type": "arrow", + "name": "Arrow 1 Copy 1 Copy 1 Copy 3", + "opacity": 1.0, + "lineWidth": 3, + "dashStyle": "solid", + "capStyle": "flat", + "joinStyle": "miter", + "beginStyle": "none", + "endStyle": "normal", + "vertices": [ + { + "x": 330, + "y": 840 + }, + { + "x": 330, + "y": 910 + } + ] + }, + { + "type": "arrow", + "name": "Arrow 1 Copy 2", + "opacity": 1.0, + "lineWidth": 3, + "dashStyle": "solid", + "capStyle": "flat", + "joinStyle": "miter", + "beginStyle": "none", + "endStyle": "normal", + "vertices": [ + { + "x": 580, + "y": 440 + }, + { + "x": 460, + "y": 440 + } + ] + }, + { + "type": "arrow", + "name": "Arrow 1 Copy 1 Copy 1 Copy 3 Copy 1", + "opacity": 1.0, + "lineWidth": 3, + "dashStyle": "solid", + "capStyle": "flat", + "joinStyle": "miter", + "beginStyle": "none", + "endStyle": "normal", + "vertices": [ + { + "x": 350, + "y": 290 + }, + { + "x": 350, + "y": 370 + } + ] + }, + { + "type": "arrow", + "name": "Arrow 1 Copy 2 Copy 1", + "opacity": 1.0, + "lineWidth": 3, + "dashStyle": "solid", + "capStyle": "flat", + "joinStyle": "miter", + "beginStyle": "none", + "endStyle": "normal", + "vertices": [ + { + "x": 580, + "y": 570 + }, + { + "x": 460, + "y": 570 + } + ] + }, + { + "type": "arrow", + "name": "Arrow 1 Copy 1 Copy 1 Copy 3 Copy 1 Copy 1", + "opacity": 1.0, + "lineWidth": 3, + "dashStyle": "solid", + "capStyle": "flat", + "joinStyle": "miter", + "beginStyle": "none", + "endStyle": "normal", + "vertices": [ + { + "x": 2430, + "y": 340 + }, + { + "x": 2430, + "y": 420 + } + ] + }, + { + "type": "arrow", + "name": "Arrow 1 Copy 3", + "opacity": 1.0, + "lineWidth": 3, + "dashStyle": "solid", + "capStyle": "flat", + "joinStyle": "miter", + "beginStyle": "none", + "endStyle": "normal", + "vertices": [ + { + "x": 1960, + "y": 660 + }, + { + "x": 1840, + "y": 660 + } + ] + }, + { + "type": "arrow", + "name": "Arrow 1 Copy 2 Copy 1 Copy 1", + "opacity": 1.0, + "lineWidth": 3, + "dashStyle": "solid", + "capStyle": "flat", + "joinStyle": "miter", + "beginStyle": "none", + "endStyle": "normal", + "vertices": [ + { + "x": 1880, + "y": 190 + }, + { + "x": 1770, + "y": 190 + } + ] + }, + { + "type": "arrow", + "name": "Arrow 1 Copy 1 Copy 1 Copy 1 Copy 1", + "opacity": 1.0, + "lineWidth": 3, + "dashStyle": "solid", + "capStyle": "flat", + "joinStyle": "miter", + "beginStyle": "none", + "endStyle": "normal", + "vertices": [ + { + "x": 1980, + "y": 1860 + }, + { + "x": 2100, + "y": 1860 + } + ] + }, + { + "type": "arrow", + "name": "Arrow 1 Copy 2 Copy 1 Copy 1 Copy 1", + "opacity": 1.0, + "lineWidth": 3, + "dashStyle": "solid", + "capStyle": "flat", + "joinStyle": "miter", + "beginStyle": "none", + "endStyle": "normal", + "vertices": [ + { + "x": 2300, + "y": 190 + }, + { + "x": 2200, + "y": 190 + } + ] + }, + { + "type": "arrow", + "name": "Arrow 1 Copy 1 Copy 1 Copy 2 Copy 1 Copy 1", + "opacity": 1.0, + "lineWidth": 3, + "dashStyle": "solid", + "capStyle": "flat", + "joinStyle": "miter", + "beginStyle": "none", + "endStyle": "normal", + "vertices": [ + { + "x": 1660, + "y": 500 + }, + { + "x": 1660, + "y": 360 } ] } diff --git a/FrontendWebApi/ApiControllers/UserController.cs b/FrontendWebApi/ApiControllers/UserController.cs index 6e17d91..5dd475d 100644 --- a/FrontendWebApi/ApiControllers/UserController.cs +++ b/FrontendWebApi/ApiControllers/UserController.cs @@ -2,6 +2,7 @@ using FrontendWebApi.Models; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; using Repository.BackendRepository.Interface; using Repository.BaseRepository.Interface; using Repository.FrontendRepository.Interface; @@ -38,5 +39,617 @@ namespace FrontendWebApi.ApiControllers apiResult.Data = myUser; return apiResult; } + + /// + /// 帳號管理列表 + /// + /// + [HttpPost] + public async Task>> UserManagerList() + { + ApiResult> apiResult = new ApiResult>(); + List userManagerList = new List(); + + try + { + var sqlString = @$"SELECT A.userinfo_guid, A.full_name, B.full_name AS 'Role_full_name', A.email, A.phone, A.created_at,A.Account ,B.layer + FROM userinfo A + LEFT JOIN role B ON A.role_guid=B.role_guid AND B.deleted='0' + WHERE A.deleted = 0 + ORDER BY A.created_at DESC"; + userManagerList = await backendRepository.GetAllAsync(sqlString); + + apiResult.Code = "0000"; + apiResult.Data = userManagerList; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + return apiResult; + } + + /// + /// 角色管理列表 + /// + /// + [HttpPost] + public async Task>> RoleManagerList(int post) //是否判斷layer 0:否 1:是 + { + ApiResult> apiResult = new ApiResult>(); + List roleList = new List(); + + try + { + var layersql = ""; + if (post == 1) + { + layersql = "and A.layer = 1 "; + } + var sqlString = @$"SELECT * + FROM role A + WHERE A.deleted = 0 {layersql} + ORDER BY A.created_at DESC"; + roleList = await backendRepository.GetAllAsync(sqlString); + + apiResult.Code = "0000"; + apiResult.Data = roleList; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + return apiResult; + } + + /// + /// 新增 / 修改 使用者 + /// + /// + /// + [HttpPost] + public async Task> SaveUser(SaveUserManager post) + { + ApiResult apiResult = new ApiResult(); + + UserInfo userInfo = null; + + try + { + userInfo = await backendRepository.GetOneAsync("userinfo", $"userinfo_guid='{post.Id.ToString()}'"); + + if (userInfo == null) + { + + if (post.Id != "0") + { + apiResult.Code = "9998"; + apiResult.Msg = "查無該使用者。"; + return apiResult; + } + + #region 新增使用者 + //判斷帳號 是否已存在 + var exist = await backendRepository.HasExistsWithGuid(post.Account, "userinfo", "account"); + if (exist) + { + apiResult.Code = "9986"; + apiResult.Msg = "該帳號已被註冊,請重新輸入"; + return apiResult; + } + + EDFunction edFunction = new EDFunction(); + + //隨機產生亂數密碼 + Random random = new Random((int)DateTime.Now.Ticks); + const string chars = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789"; + string random_password = new string(Enumerable.Repeat(chars, 8).Select(s => s[random.Next(chars.Length)]).ToArray()); + + var newPassword = edFunction.GetSHA256Encryption(random_password); + + //產生一組GUID + var guid = Guid.NewGuid(); //使用者GUID + + Dictionary userinfo = new Dictionary(); + userinfo = new Dictionary() + { + { "@userinfo_guid", guid}, + { "@Full_name", post.Name}, + { "@Email", post.Email}, + { "@Account", post.Account}, + { "@Password", newPassword}, + { "@Role_guid", post.RoleId}, + { "@Phone", post.Phone}, + { "@created_by", myUser.userinfo_guid} + }; + + await backendRepository.AddOneByCustomTable(userinfo, "userinfo"); + + var sWhere = "system_type = 'website_config' AND system_key = 'website_url'"; + var website_url = await backendRepository.GetOneAsync("variable", sWhere); + + + var sendSubject = "新增帳號成功"; + var sendContent = $@"您的新密碼為:{random_password} +
立即前往:{website_url.system_value}"; + + Dictionary insertNotify = new Dictionary() + { + { "@task_type", 0}, + { "@recipient_name", post.Name}, + { "@recipient_phone", post.Phone}, + { "@recipient_email", post.Email}, + { "@message_content", sendContent} + }; + + await backendRepository.AddOneByCustomTable(insertNotify, "background_service_message_notification_task"); + + apiResult.Code = "0000"; + apiResult.Msg = "儲存成功"; + #endregion + } + else + { + #region 修改使用者 + Dictionary userinfo = new Dictionary(); + var role = await backendRepository.GetOneAsync(@$"select layer from role where role_guid = '{post.RoleId}'"); + var infoguid = await backendRepository.GetAllAsync($@"select r.full_name from userinfo u + left join role r on u.role_guid = r.role_guid + where r.layer = 0 and u.userinfo_guid != '{post.Id}'"); + if (infoguid.Count == 0 && role == 1) + { + apiResult.Code = "9998"; + var getrolename = await backendRepository.GetOneAsync("select r.full_name from role r where r.layer = 0"); + apiResult.Msg = getrolename + "-僅剩一位
故無法儲存"; + } + else + { + userinfo = new Dictionary() + { + { "@Full_name", post.Name}, + { "@Email", post.Email}, + { "@Role_guid", post.RoleId}, + { "@Phone", post.Phone}, + { "@updated_by", myUser.userinfo_guid}, + { "@updated_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} + }; + await backendRepository.UpdateOneByCustomTable(userinfo, "userinfo", $"userinfo_guid='{post.Id}'"); + + apiResult.Code = "0000"; + apiResult.Msg = "儲存成功"; + } + #endregion + } + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + string json = System.Text.Json.JsonSerializer.Serialize(post); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + json); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + return apiResult; + } + + /// + /// 取得單一使用者 + /// + /// + /// + [HttpPost] + public async Task> GetOneUser(string guid) + { + ApiResult apiResult = new ApiResult(); + + SimpleUser simpleUser = null; + + try + { + simpleUser = await backendRepository.GetOneAsync("userinfo", $"userinfo_guid='{guid}'"); + + if (simpleUser == null) + { + apiResult.Code = "9998"; + apiResult.Msg = "查無該使用者。"; + return apiResult; + } + + apiResult.Code = "0000"; + apiResult.Data = simpleUser; + + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + "Guid=" + guid); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + return apiResult; + } + + /// + /// 軟刪除單一使用者 + /// + /// + /// + [HttpPost] + public async Task> DeleteOneUser(string guid) + { + ApiResult apiResult = new ApiResult(); + + SimpleUser simpleUser = null; + + try + { + simpleUser = await backendRepository.GetOneAsync("userinfo", $"userinfo_guid='{guid}'"); + + if (simpleUser == null) + { + apiResult.Code = "9998"; + apiResult.Msg = "查無該使用者。"; + return apiResult; + } + + await backendRepository.DeleteOne(guid, "userinfo", "userinfo_guid"); + + apiResult.Code = "0000"; + apiResult.Msg = "刪除成功"; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + "Guid=" + guid); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + return apiResult; + } + + /// + /// 新增 / 修改 角色 + /// + /// + /// + [HttpPost] + public async Task> SaveRole(PostRole post) + { + ApiResult apiResult = new ApiResult(); + + RoleManagerList roleManager = null; + + try + { + roleManager = await backendRepository.GetOneAsync("role", $"role_guid='{post.Id.ToString()}'"); + + if (roleManager == null) + { + + if (post.Id != "0") + { + apiResult.Code = "9994"; + apiResult.Msg = "查無該角色"; + return apiResult; + } + + #region 新增角色 + //產生一組GUID + var guid = Guid.NewGuid(); //角色GUID + Dictionary role = new Dictionary(); + role = new Dictionary() + { + { "@role_guid", guid}, + { "@Full_name", post.Name}, + { "@created_by", myUser.userinfo_guid} + }; + + await backendRepository.AddOneByCustomTable(role, "role"); + + apiResult.Code = "0000"; + apiResult.Msg = "儲存成功"; + #endregion + } + else + { + #region 修改角色 + Dictionary role = new Dictionary(); + role = new Dictionary() + { + { "@Full_name", post.Name}, + { "@updated_by", myUser.userinfo_guid}, + { "@updated_at", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} + }; + await backendRepository.UpdateOneByCustomTable(role, "role", $"role_guid='{post.Id}'"); + + + apiResult.Code = "0000"; + apiResult.Msg = "儲存成功"; + #endregion + } + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + string json = System.Text.Json.JsonSerializer.Serialize(post); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + json); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + return apiResult; + } + + /// + /// 取得單一角色 + /// + /// + /// + [HttpPost] + public async Task> GetOneRole(string guid) + { + ApiResult apiResult = new ApiResult(); + + SimpleRole simpleRole = null; + + try + { + simpleRole = await backendRepository.GetOneAsync("role", $"role_guid='{guid}'"); + + if (simpleRole == null) + { + apiResult.Code = "9994"; + apiResult.Msg = "查無該角色"; + return apiResult; + } + + apiResult.Code = "0000"; + apiResult.Data = simpleRole; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + "Guid=" + guid); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + return apiResult; + } + + /// + /// 軟刪除單一角色 + /// + /// + /// + [HttpPost] + public async Task> DeleteOneRole(string guid) + { + ApiResult apiResult = new ApiResult(); + + SimpleRole simpleRole = null; + + try + { + simpleRole = await backendRepository.GetOneAsync("role", $"role_guid='{guid}'"); + + if (simpleRole == null) + { + apiResult.Code = "9998"; + apiResult.Msg = "查無該角色"; + return apiResult; + } + + //檢查是否有使用者為該角色 + var sWhere = $@"deleted = 0 AND role_guid = @Guid"; + var userInfos = await backendRepository.GetAllAsync("userinfo", sWhere, new { Guid = guid }); + if (userInfos.Count > 0) + { + apiResult.Code = "9997"; + apiResult.Msg = "帳號管理中尚有帳號正在使用該角色,故無法刪除"; + return apiResult; + } + + + await backendRepository.DeleteOne(guid, "role", "role_guid"); + + apiResult.Code = "0000"; + apiResult.Msg = "刪除成功"; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + "Guid=" + guid); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + return apiResult; + } + + /// + /// 角色權限管理列表 + /// + /// + [HttpPost] + public async Task>> RoleAuthList(PostRoleAuthFilter post) + { + ApiResult> apiResult = new ApiResult>(); + List roleAuthList = new List(); + + try + { + var sqlString = @$"SELECT A.role_guid, A.AuthCode, B.full_name AS 'Role_full_name', C.AuthType, C.MainName, C.SubName, D.full_name AS 'Building_full_name', A.created_at + FROM role_auth A + LEFT JOIN role B ON A.role_guid=B.role_guid AND B.deleted=0 + INNER JOIN auth_page C ON A.AuthCode=C.AuthCode + LEFT JOIN building D ON C.building_tag=D.building_tag AND D.deleted=0 + WHERE A.role_guid='{post.SelectedRoleId}' + ORDER BY A.created_at DESC"; + roleAuthList = await backendRepository.GetAllAsync(sqlString); + + apiResult.Code = "0000"; + apiResult.Data = roleAuthList; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + return apiResult; + } + + /// + /// 取得此角色未選擇的權限 + /// + /// + /// + public async Task>> GetRoleNotAuthPageList(PostRoleAuthFilter post) + { + ApiResult> apiResult = new ApiResult>(); + List authPage = new List(); + + try + { + if (!string.IsNullOrEmpty(post.SelectedRoleId)) + { + var buildingGuid = ""; + if (post.SelectedBuild != "0") + { + buildingGuid = $" AND ap.building_tag = '{post.SelectedBuild}'"; + } + var sqlString = @$" SELECT ap.AuthCode, ap.MainName, ap.SubName FROM auth_page ap + WHERE ap.AuthType='{post.SelectedAuthType}' + {buildingGuid} + AND ap.AuthCode NOT IN ( + SELECT ra.AuthCode FROM role_auth ra + LEFT JOIN auth_page ap ON ra.AuthCode = ap.AuthCode + WHERE ra.role_guid = '{post.SelectedRoleId}' + {buildingGuid} + AND ap.AuthType='{post.SelectedAuthType}' + )"; + authPage = await backendRepository.GetAllAsync(sqlString); + } + apiResult.Code = "0000"; + apiResult.Data = authPage; + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + return apiResult; + } + + /// + /// 新增 權限 + /// + /// + /// + [HttpPost] + public async Task> SaveRoleAuth(PostSaveRoleAuth post) + { + ApiResult apiResult = new ApiResult(); + + RoleManagerList roleManager = null; + + try + { + roleManager = await backendRepository.GetOneAsync("role", $"role_guid='{post.SelectedRoleId}'"); + + if (roleManager == null) + { + apiResult.Code = "9994"; + apiResult.Msg = "查無該角色"; + return apiResult; + } + else + { + if (post.SaveCheckAuth.Count > 0) + { + foreach (var item in post.SaveCheckAuth) + { + #region 新增權限 + Dictionary roleAuth = new Dictionary(); + roleAuth = new Dictionary() + { + { "@role_guid", post.SelectedRoleId}, + { "@AuthCode", item}, + { "@created_by", myUser.userinfo_guid} + }; + + await backendRepository.AddOneByCustomTable(roleAuth, "role_auth"); + + + #endregion + } + } + apiResult.Code = "0000"; + apiResult.Msg = "儲存成功"; + } + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + string json = System.Text.Json.JsonSerializer.Serialize(post); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + json); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + return apiResult; + } + + /// + /// 刪除 權限 + /// + /// + /// + [HttpPost] + public async Task> DeleteOneRoleAuth(PostDeleteRoleAuth post) + { + ApiResult apiResult = new ApiResult(); + + RoleManagerList roleManager = null; + + try + { + roleManager = await backendRepository.GetOneAsync("role", $"role_guid='{post.RoleId}'"); + + if (roleManager == null) + { + apiResult.Code = "9994"; + apiResult.Msg = "查無該角色"; + return apiResult; + } + + await backendRepository.PurgeOneByGuidWithCustomDBNameAndTable("role_auth", $"role_guid='{post.RoleId}' AND AuthCode='{post.AuthCode}'"); + + apiResult.Code = "0000"; + apiResult.Msg = "刪除成功"; + + } + catch (Exception exception) + { + apiResult.Code = "9999"; + apiResult.Msg = "系統內部錯誤,請聯絡管理者。"; + string json = System.Text.Json.JsonSerializer.Serialize(post); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + json); + Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message); + } + + return apiResult; + } } } diff --git a/FrontendWebApi/Models/MyBase.cs b/FrontendWebApi/Models/MyBase.cs index e18e4f2..1f880d3 100644 --- a/FrontendWebApi/Models/MyBase.cs +++ b/FrontendWebApi/Models/MyBase.cs @@ -45,4 +45,11 @@ namespace FrontendWebApi.Models { public int id { get; set; } } + + public class Variable : Actor + { + public string System_type { get; set; } + public string System_key { get; set; } + public string system_value { get; set; } + } } diff --git a/FrontendWebApi/Models/User.cs b/FrontendWebApi/Models/User.cs index 5b6426c..8ceced0 100644 --- a/FrontendWebApi/Models/User.cs +++ b/FrontendWebApi/Models/User.cs @@ -15,10 +15,159 @@ namespace FrontendWebApi.Models public string phone { get; set; } public string tel { get; set; } public string email { get; set; } + public List ShowView { get; set; } } public class Login { public string account { get; set; } public string password { get; set; } } + + public enum UserStatusEnum : byte + { + Suspend = 0, //停權 + Normal = 1, //正常 + } + + public class UserInfo : Actor + { + public string Userinfo_guid { get; set; } + public byte Deleted { get; set; } //是否刪除 + public byte Status { get; set; } //狀態 + public string StatusText //狀態文字 + { + get + { + Dictionary pairs = new Dictionary() + { + { 0, "停權"}, + { 1, "正常"}, + }; + + return pairs[Status]; + } + } + public string Role_guid { get; set; } //角色guid + public string Full_name { get; set; } //姓名 + public string Account { get; set; } //帳號 + public string Password { get; set; } //密碼 + public string Tel { get; set; } //市話 + public string Phone { get; set; } //手機 + public string Email { get; set; } //信箱 + } + + public class UserManagerList : Actor + { + public string Userinfo_guid { get; set; } + public string Full_name { get; set; } //姓名 + public string Role_full_name { get; set; } //角色名稱 + public string Email { get; set; } //信箱 + public string Phone { get; set; } //手機 + public string Account { get; set; } + public byte Layer { get; set; } + } + + public class RoleManagerList : Actor + { + public string Role_guid { get; set; } + public string Full_name { get; set; } //姓名 + public byte Layer { get; set; } + } + + public class SaveUserManager + { + public string Id { get; set; } + public string Name { get; set; } //姓名 + public string Email { get; set; } //信箱 + public string Account { get; set; } //帳號 + public string Phone { get; set; } //手機號碼 + public string RoleId { get; set; } //角色GUID + } + + public class SimpleUser + { + public string Full_name { get; set; } //姓名 + public string Account { get; set; } //帳號 + public string Email { get; set; } //信箱 + public string Phone { get; set; } //手機 + public string Role_guid { get; set; } //角色GUID + } + + public class PostRole + { + public string Id { get; set; } + public string Name { get; set; } + } + + public class SimpleRole + { + public string Full_name { get; set; } //姓名 + } + + public class RoleAuthList : Actor + { + public string Role_guid { get; set; } //角色GUID + public string AuthCode { get; set; } //權限代碼 + public string Role_full_name { get; set; } //角色名稱 + public int AuthType { get; set; } //角色類型 1:前台 2:後台 + public string AuthTypeText //角色類型文字 + { + get + { + Dictionary pairs = new Dictionary() + { + { 1, "前台"}, + { 2, "後台"}, + }; + + return pairs[AuthType]; + } + } + public string MainName { get; set; } //大項名稱 + public string SubName { get; set; } //功能名稱 + public string Building_full_name { get; set; } //區域名稱 + } + + public class PostRoleAuthFilter + { + public string SelectedRoleId { get; set; } + public string SelectedAuthType { get; set; } + public string SelectedBuild { get; set; } + } + + public class AuthPage + { + public string AuthCode { get; set; } + public string MainName { get; set; } + public string SubName { get; set; } + } + + public class PostSaveRoleAuth + { + public string SelectedRoleId { get; set; } + public List SaveCheckAuth { get; set; } + //public FrontEndCheckAuth BackEndCheckAuth { get; set; } + } + + public class PostDeleteRoleAuth + { + public string RoleId { get; set; } + public string AuthCode { get; set; } + } + + //public class FrontEndCheckAuth + //{ + // public string Building { get; set; } + // public List SelectedAuth { get; set; } + //} + public class Auth_page + { + public string AuthCode { get; set; } + public byte AuthType { get; set; } + public string MainName { get; set; } + public string SubName { get; set; } + public string building_guid { get; set; } + public string ShowView { get; set; } + public string created_at { get; set; } + } } diff --git a/z01_WinAPP/Service/procCompare.cs b/z01_WinAPP/Service/procCompare.cs index 3d5045e..d61efd2 100644 --- a/z01_WinAPP/Service/procCompare.cs +++ b/z01_WinAPP/Service/procCompare.cs @@ -30,7 +30,7 @@ namespace tpDomeWinAPP.Service { bool result = false; //tag - InsertNiagaraTagList(dt, building); + insertNiagaraTagList(dt, building); insertItemFromNiagara(dt, building); deviceComparison(); deviceItemComparison(); @@ -39,7 +39,7 @@ namespace tpDomeWinAPP.Service return result; } - protected void InsertNiagaraTagList(List dt, string building) + protected void insertNiagaraTagList(List dt, string building) { var ds2 = dt.GroupBy(x => new { @@ -209,6 +209,7 @@ namespace tpDomeWinAPP.Service conn.Open(); StringBuilder sb = new StringBuilder(); + StringBuilder sb2 = new StringBuilder(); sb.Append($@" SELECT m.* FROM import_niagara_tag m LEFT JOIN device d @@ -237,11 +238,19 @@ namespace tpDomeWinAPP.Service data.device_serial_tag + "', '" + data.niagara_tags + "', '" + data.device_system_tag + "', now(), now() );"); + + sb2.Append($@"INSERT device_kind (device_kind_guid, device_building_tag, device_system_tag, device_name_tag, + device_normal_flashing, device_close_flashing, device_error_flashing, device_error_independent, + created_by, created_at) + VALUES (uuid(), '" + data.device_building_tag + "', '" + data.device_system_tag + "', '" + data.device_name_tag + + "', 0, 0, 1, 0, 'B43E3CA7-96DD-4FC7-B6E6-974ACC3B0878', now());"); } if(sb.Length > 0) { conn.Execute(sb.ToString()); + conn.Execute(sb2.ToString()); sb.Clear(); + sb2.Clear(); } }