From c10e7f94c74e42e409e0d097fbd9fdaa7fe41bd6 Mon Sep 17 00:00:00 2001 From: Kai Date: Fri, 18 Jun 2021 10:53:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20DB=20secma?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SolarPower/DBSchema/solar_power_schema.sql | 650 ++++++++++++++++++++- 1 file changed, 619 insertions(+), 31 deletions(-) diff --git a/SolarPower/DBSchema/solar_power_schema.sql b/SolarPower/DBSchema/solar_power_schema.sql index c2cb5b1..e596ec7 100644 --- a/SolarPower/DBSchema/solar_power_schema.sql +++ b/SolarPower/DBSchema/solar_power_schema.sql @@ -17,6 +17,390 @@ CREATE DATABASE IF NOT EXISTS `solar_power` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */; USE `solar_power`; +-- 傾印 資料表 solar_power.area 結構 +CREATE TABLE IF NOT EXISTS `area` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `CityId` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '縣市編號', + `Name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `ZipCode` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`Id`), + KEY `IDX_01` (`CityId`) +) ENGINE=InnoDB AUTO_INCREMENT=369 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='台灣區域'; + +-- 正在傾印表格 solar_power.area 的資料:~-1 rows (近似值) +DELETE FROM `area`; +/*!40000 ALTER TABLE `area` DISABLE KEYS */; +INSERT INTO `area` (`Id`, `CityId`, `Name`, `ZipCode`) VALUES + (1, 2, '松山區', '01'), + (2, 2, '信義區', '02'), + (3, 2, '大安區', '03'), + (4, 2, '中山區', '04'), + (5, 2, '中正區', '05'), + (6, 2, '大同區', '06'), + (7, 2, '萬華區', '07'), + (8, 2, '文山區', '08'), + (9, 2, '南港區', '09'), + (10, 2, '內湖區', '10'), + (11, 2, '士林區', '11'), + (12, 2, '北投區', '12'), + (13, 17, '鹽埕區', '01'), + (14, 17, '鼓山區', '02'), + (15, 17, '左營區', '03'), + (16, 17, '楠梓區', '04'), + (17, 17, '三民區', '05'), + (18, 17, '新興區', '06'), + (19, 17, '前金區', '07'), + (20, 17, '苓雅區', '08'), + (21, 17, '前鎮區', '09'), + (22, 17, '旗津區', '10'), + (23, 17, '小港區', '11'), + (24, 17, '鳳山區', '12'), + (25, 17, '林園區', '13'), + (26, 17, '大寮區', '14'), + (27, 17, '大樹區', '15'), + (28, 17, '大社區', '16'), + (29, 17, '仁武區', '17'), + (30, 17, '鳥松區', '18'), + (31, 17, '岡山區', '19'), + (32, 17, '橋頭區', '20'), + (33, 17, '燕巢區', '21'), + (34, 17, '田寮區', '22'), + (35, 17, '阿蓮區', '23'), + (36, 17, '路竹區', '24'), + (37, 17, '湖內區', '25'), + (38, 17, '茄萣區', '26'), + (39, 17, '永安區', '27'), + (40, 17, '彌陀區', '28'), + (41, 17, '梓官區', '29'), + (42, 17, '旗山區', '30'), + (43, 17, '美濃區', '31'), + (44, 17, '六龜區', '32'), + (45, 17, '甲仙區', '33'), + (46, 17, '杉林區', '34'), + (47, 17, '內門區', '35'), + (48, 17, '茂林區', '36'), + (49, 17, '桃源區', '37'), + (50, 17, '那瑪夏區', '38'), + (51, 3, '板橋區', '01'), + (52, 3, '三重區', '02'), + (53, 3, '中和區', '03'), + (54, 3, '永和區', '04'), + (55, 3, '新莊區', '05'), + (56, 3, '新店區', '06'), + (57, 3, '樹林區', '07'), + (58, 3, '鶯歌區', '08'), + (59, 3, '三峽區', '09'), + (60, 3, '淡水區', '10'), + (61, 3, '汐止區', '11'), + (62, 3, '瑞芳區', '12'), + (63, 3, '土城區', '13'), + (64, 3, '蘆洲區', '14'), + (65, 3, '五股區', '15'), + (66, 3, '泰山區', '16'), + (67, 3, '林口區', '17'), + (68, 3, '深坑區', '18'), + (69, 3, '石碇區', '19'), + (70, 3, '坪林區', '20'), + (71, 3, '三芝區', '21'), + (72, 3, '石門區', '22'), + (73, 3, '八里區', '23'), + (74, 3, '平溪區', '24'), + (75, 3, '雙溪區', '25'), + (76, 3, '貢寮區', '26'), + (77, 3, '金山區', '27'), + (78, 3, '萬里區', '28'), + (79, 3, '烏來區', '29'), + (80, 10, '中區', '01'), + (81, 10, '東區', '02'), + (82, 10, '南區', '03'), + (83, 10, '西區', '04'), + (84, 10, '北區', '05'), + (85, 10, '西屯區', '06'), + (86, 10, '南屯區', '07'), + (87, 10, '北屯區', '08'), + (88, 10, '豐原區', '09'), + (89, 10, '東勢區', '10'), + (90, 10, '大甲區', '11'), + (91, 10, '清水區', '12'), + (92, 10, '沙鹿區', '13'), + (93, 10, '梧棲區', '14'), + (94, 10, '后里區', '15'), + (95, 10, '神岡區', '16'), + (96, 10, '潭子區', '17'), + (97, 10, '大雅區', '18'), + (98, 10, '新社區', '19'), + (99, 10, '石岡區', '20'), + (100, 10, '外埔區', '21'), + (101, 10, '大安區', '22'), + (102, 10, '烏日區', '23'), + (103, 10, '大肚區', '24'), + (104, 10, '龍井區', '25'), + (105, 10, '霧峰區', '26'), + (106, 10, '太平區', '27'), + (107, 10, '大里區', '28'), + (108, 10, '和平區', '29'), + (109, 16, '新營區', '01'), + (110, 16, '鹽水區', '02'), + (111, 16, '白河區', '03'), + (112, 16, '柳營區', '04'), + (113, 16, '後壁區', '05'), + (114, 16, '東山區', '06'), + (115, 16, '麻豆區', '07'), + (116, 16, '下營區', '08'), + (117, 16, '六甲區', '09'), + (118, 16, '官田區', '10'), + (119, 16, '大內區', '11'), + (120, 16, '佳里區', '12'), + (121, 16, '學甲區', '13'), + (122, 16, '西港區', '14'), + (123, 16, '七股區', '15'), + (124, 16, '將軍區', '16'), + (125, 16, '北門區', '17'), + (126, 16, '新化區', '18'), + (127, 16, '善化區', '19'), + (128, 16, '新市區', '20'), + (129, 16, '安定區', '21'), + (130, 16, '山上區', '22'), + (131, 16, '玉井區', '23'), + (132, 16, '楠西區', '24'), + (133, 16, '南化區', '25'), + (134, 16, '左鎮', '26'), + (135, 16, '仁德區', '27'), + (136, 16, '歸仁區', '28'), + (137, 16, '關廟區', '29'), + (138, 16, '龍崎區', '30'), + (139, 16, '永康區', '31'), + (140, 16, '東區', '32'), + (141, 16, '南區', '33'), + (142, 16, '北區', '34'), + (143, 16, '安南區', '35'), + (144, 16, '安平區', '36'), + (145, 16, '中西區', '37'), + (146, 7, '宜蘭市', '01'), + (147, 7, '羅東鎮', '02'), + (148, 7, '蘇澳鎮', '03'), + (149, 7, '頭城鎮', '04'), + (150, 7, '礁溪鄉', '05'), + (151, 7, '壯圍鄉', '06'), + (152, 7, '員山鄉', '07'), + (153, 7, '冬山鄉', '08'), + (154, 7, '五結鄉', '09'), + (155, 7, '三星鄉', '10'), + (156, 7, '大同鄉', '11'), + (157, 7, '南澳鄉', '12'), + (158, 4, '桃園市', '01'), + (159, 4, '中壢市', '02'), + (160, 4, '大溪鎮', '03'), + (161, 4, '楊梅市', '04'), + (162, 4, '蘆竹市', '05'), + (163, 4, '大園鄉', '06'), + (164, 4, '龜山鄉', '07'), + (165, 4, '八德市', '08'), + (166, 4, '龍潭鄉', '09'), + (167, 4, '平鎮市', '10'), + (168, 4, '新屋鄉', '11'), + (169, 4, '觀音鄉', '12'), + (170, 4, '復興鄉', '13'), + (171, 6, '竹北市', '01'), + (172, 6, '竹東鎮', '02'), + (173, 6, '新埔鎮', '03'), + (174, 6, '關西鎮', '04'), + (175, 6, '湖口鄉', '05'), + (176, 6, '新豐鄉', '06'), + (177, 6, '芎林鄉', '07'), + (178, 6, '橫山鄉', '08'), + (179, 6, '北埔鄉', '09'), + (180, 6, '寶山鄉', '10'), + (181, 6, '峨眉鄉', '11'), + (182, 6, '尖石鄉', '12'), + (183, 6, '五峰鄉', '13'), + (184, 9, '苗栗市', '01'), + (185, 9, '苑裡鎮', '02'), + (186, 9, '通霄鎮', '03'), + (187, 9, '竹南鎮', '04'), + (188, 9, '頭份鎮', '05'), + (189, 9, '後龍鎮', '06'), + (190, 9, '卓蘭鎮', '07'), + (191, 9, '大湖鄉', '08'), + (192, 9, '公館鄉', '09'), + (193, 9, '銅鑼鄉', '10'), + (194, 9, '南庄鄉', '11'), + (195, 9, '頭屋鄉', '12'), + (196, 9, '三義鄉', '13'), + (197, 9, '西湖鄉', '14'), + (198, 9, '造橋鄉', '15'), + (199, 9, '三灣鄉', '16'), + (200, 9, '獅潭鄉', '17'), + (201, 9, '泰安鄉', '18'), + (202, 11, '彰化市', '01'), + (203, 11, '鹿港鎮', '02'), + (204, 11, '和美鎮', '03'), + (205, 11, '線西鄉', '04'), + (206, 11, '伸港鄉', '05'), + (207, 11, '福興鄉', '06'), + (208, 11, '秀水鄉', '07'), + (209, 11, '花壇鄉', '08'), + (210, 11, '芬園鄉', '09'), + (211, 11, '員林鎮', '10'), + (212, 11, '溪湖鎮', '11'), + (213, 11, '田中鎮', '12'), + (214, 11, '大村鄉', '13'), + (215, 11, '埔鹽鄉', '14'), + (216, 11, '埔心鄉', '15'), + (217, 11, '永靖鄉', '16'), + (218, 11, '社頭鄉', '17'), + (219, 11, '二水鄉', '18'), + (220, 11, '北斗鎮', '19'), + (221, 11, '二林鎮', '20'), + (222, 11, '田尾鄉', '21'), + (223, 11, '埤頭鄉', '22'), + (224, 11, '芳苑鄉', '23'), + (225, 11, '大城鄉', '24'), + (226, 11, '竹塘鄉', '25'), + (227, 11, '溪州鄉', '26'), + (228, 12, '南投市', '01'), + (229, 12, '埔里鎮', '02'), + (230, 12, '草屯鎮', '03'), + (231, 12, '竹山鎮', '04'), + (232, 12, '集集鎮', '05'), + (233, 12, '名間鄉', '06'), + (234, 12, '鹿谷鄉', '07'), + (235, 12, '中寮鄉', '08'), + (236, 12, '魚池鄉', '09'), + (237, 12, '國姓鄉', '10'), + (238, 12, '水里鄉', '11'), + (239, 12, '信義鄉', '12'), + (240, 12, '仁愛鄉', '13'), + (241, 13, '斗六市', '01'), + (242, 13, '斗南鎮', '02'), + (243, 13, '虎尾鎮', '03'), + (244, 13, '西螺鎮', '04'), + (245, 13, '土庫鎮', '05'), + (246, 13, '北港鎮', '06'), + (247, 13, '古坑鄉', '07'), + (248, 13, '大埤鄉', '08'), + (249, 13, '莿桐鄉', '09'), + (250, 13, '林內鄉', '10'), + (251, 13, '二崙鄉', '11'), + (252, 13, '崙背鄉', '12'), + (253, 13, '麥寮鄉', '13'), + (254, 13, '東勢鄉', '14'), + (255, 13, '褒忠鄉', '15'), + (256, 13, '臺西鄉', '16'), + (257, 13, '元長鄉', '17'), + (258, 13, '四湖鄉', '18'), + (259, 13, '口湖鄉', '19'), + (260, 13, '水林鄉', '20'), + (261, 15, '太保市', '01'), + (262, 15, '朴子市', '02'), + (263, 15, '布袋鎮', '03'), + (264, 15, '大林鎮', '04'), + (265, 15, '民雄鄉', '05'), + (266, 15, '溪口鄉', '06'), + (267, 15, '新港鄉', '07'), + (268, 15, '六腳鄉', '08'), + (269, 15, '東石鄉', '09'), + (270, 15, '義竹鄉', '10'), + (271, 15, '鹿草鄉', '11'), + (272, 15, '水上鄉', '12'), + (273, 15, '中埔鄉', '13'), + (274, 15, '竹崎鄉', '14'), + (275, 15, '梅山鄉', '15'), + (276, 15, '番路鄉', '16'), + (277, 15, '大埔鄉', '17'), + (278, 15, '阿里山鄉', '18'), + (279, 18, '屏東市', '01'), + (280, 18, '潮州鎮', '02'), + (281, 18, '東港鎮', '03'), + (282, 18, '恆春鎮', '04'), + (283, 18, '萬丹鄉', '05'), + (284, 18, '長治鄉', '06'), + (285, 18, '麟洛鄉', '07'), + (286, 18, '九如鄉', '08'), + (287, 18, '里港鄉', '09'), + (288, 18, '鹽埔鄉', '10'), + (289, 18, '高樹鄉', '11'), + (290, 18, '萬巒鄉', '12'), + (291, 18, '內埔鄉', '13'), + (292, 18, '竹田鄉', '14'), + (293, 18, '新埤鄉', '15'), + (294, 18, '枋寮鄉', '16'), + (295, 18, '新園鄉', '17'), + (296, 18, '崁頂鄉', '18'), + (297, 18, '林邊鄉', '19'), + (298, 18, '南州鄉', '20'), + (299, 18, '佳冬鄉', '21'), + (300, 18, '琉球鄉', '22'), + (301, 18, '車城鄉', '23'), + (302, 18, '滿州鄉', '24'), + (303, 18, '枋山鄉', '25'), + (304, 18, '三地門鄉', '26'), + (305, 18, '霧臺鄉', '27'), + (306, 18, '瑪家鄉', '28'), + (307, 18, '泰武鄉', '29'), + (308, 18, '來義鄉', '30'), + (309, 18, '春日鄉', '31'), + (310, 18, '獅子鄉', '32'), + (311, 18, '牡丹鄉', '33'), + (312, 19, '臺東市', '01'), + (313, 19, '成功鎮', '02'), + (314, 19, '關山鎮', '03'), + (315, 19, '卑南鄉', '04'), + (316, 19, '鹿野鄉', '05'), + (317, 19, '池上鄉', '06'), + (318, 19, '東河鄉', '07'), + (319, 19, '長濱鄉', '08'), + (320, 19, '太麻里鄉', '09'), + (321, 19, '大武鄉', '10'), + (322, 19, '綠島鄉', '11'), + (323, 19, '海端鄉', '12'), + (324, 19, '延平鄉', '13'), + (325, 19, '金峰鄉', '14'), + (326, 19, '達仁鄉', '15'), + (327, 19, '蘭嶼鄉', '16'), + (328, 8, '花蓮市', '01'), + (329, 8, '鳳林鎮', '02'), + (330, 8, '玉里鎮', '03'), + (331, 8, '新城鄉', '04'), + (332, 8, '吉安鄉', '05'), + (333, 8, '壽豐鄉', '06'), + (334, 8, '光復鄉', '07'), + (335, 8, '豐濱鄉', '08'), + (336, 8, '瑞穗鄉', '09'), + (337, 8, '富里鄉', '10'), + (338, 8, '秀林鄉', '11'), + (339, 8, '萬榮鄉', '12'), + (340, 8, '卓溪鄉', '13'), + (341, 20, '馬公市', '01'), + (342, 20, '湖西鄉', '02'), + (343, 20, '白沙鄉', '03'), + (344, 20, '西嶼鄉', '04'), + (345, 20, '望安鄉', '05'), + (346, 20, '七美鄉', '06'), + (347, 1, '中正區', '01'), + (348, 1, '七堵區', '02'), + (349, 1, '暖暖區', '03'), + (350, 1, '仁愛區', '04'), + (351, 1, '中山區', '05'), + (352, 1, '安樂區', '06'), + (353, 1, '信義區', '07'), + (354, 5, '東區', '01'), + (355, 5, '北區', '02'), + (356, 5, '香山區', '03'), + (357, 14, '東區', '01'), + (358, 14, '西區', '02'), + (359, 22, '南竿鄉', '01'), + (360, 22, '北竿鄉', '02'), + (361, 22, '莒光鄉', '03'), + (362, 22, '東引鄉', '04'), + (363, 21, '金城鎮', '01'), + (364, 21, '金沙鎮', '02'), + (365, 21, '金湖鎮', '03'), + (366, 21, '金寧鄉', '04'), + (367, 21, '烈嶼鄉', '05'), + (368, 21, '烏坵鄉', '06'); +/*!40000 ALTER TABLE `area` ENABLE KEYS */; + -- 傾印 資料表 solar_power.auth_page 結構 CREATE TABLE IF NOT EXISTS `auth_page` ( `AuthCode` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL, @@ -28,7 +412,58 @@ CREATE TABLE IF NOT EXISTS `auth_page` ( -- 正在傾印表格 solar_power.auth_page 的資料:~-1 rows (近似值) DELETE FROM `auth_page`; +/*!40000 ALTER TABLE `auth_page` DISABLE KEYS */; +INSERT INTO `auth_page` (`AuthCode`, `MainName`, `SubName`, `ControlName`) VALUES + ('A', '系統管理', '帳號管理', 'User,Role'), + ('B', '系統管理', '公司管理', 'Company'), + ('C', '系統管理', '電站資料管理', 'AAA'), + ('D', '系統管理', '定時任務設定', 'Setting'), + ('E', '系統管理', '功能清單', 'ASDA'), + ('F', '總覽', '地圖總覽', 'BBB'), + ('G', '總攬', '電占總覽', 'CCC'), + ('H', '總覽', '運為總覽', 'HHH'), + ('J', '即時告警', '即時告警', 'JJJ'), + ('K', '交叉分析', '逆變器', 'KKK'), + ('L', '交叉分析', '電站運轉效率', 'LLL'); +/*!40000 ALTER TABLE `auth_page` ENABLE KEYS */; +-- 傾印 資料表 solar_power.city 結構 +CREATE TABLE IF NOT EXISTS `city` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '縣市名稱', + `ZipCode` varchar(3) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '縣市代碼', + `Priority` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '優先順序', + PRIMARY KEY (`Id`), + KEY `IDX_01` (`Priority`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='台灣縣市'; + +-- 正在傾印表格 solar_power.city 的資料:~-1 rows (近似值) +DELETE FROM `city`; +/*!40000 ALTER TABLE `city` DISABLE KEYS */; +INSERT INTO `city` (`Id`, `Name`, `ZipCode`, `Priority`) VALUES + (1, '基隆市', '020', 1), + (2, '台北市', '021', 2), + (3, '新北市', '022', 3), + (4, '桃園縣', '030', 4), + (5, '新竹市', '031', 5), + (6, '新竹縣', '032', 6), + (7, '宜蘭縣', '033', 19), + (8, '花蓮縣', '034', 18), + (9, '苗栗縣', '037', 7), + (10, '台中市', '040', 8), + (11, '彰化縣', '041', 9), + (12, '南投縣', '049', 10), + (13, '雲林縣', '050', 11), + (14, '嘉義市', '051', 12), + (15, '嘉義縣', '052', 13), + (16, '台南市', '060', 14), + (17, '高雄市', '070', 15), + (18, '屏東縣', '080', 16), + (19, '臺東縣', '089', 17), + (20, '澎湖縣', '061', 20), + (21, '金門縣', '082', 21), + (22, '連江縣', '083', 22); +/*!40000 ALTER TABLE `city` ENABLE KEYS */; -- 傾印 資料表 solar_power.company 結構 CREATE TABLE IF NOT EXISTS `company` ( @@ -49,11 +484,14 @@ CREATE TABLE IF NOT EXISTS `company` ( `UpdatedAt` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT '修改時間', PRIMARY KEY (`Id`), KEY `IDX_01` (`Deleted`,`Status`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='公司資料'; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='公司資料'; -- 正在傾印表格 solar_power.company 的資料:~-1 rows (近似值) DELETE FROM `company`; /*!40000 ALTER TABLE `company` DISABLE KEYS */; +INSERT INTO `company` (`Id`, `Deleted`, `Status`, `Name`, `Logo`, `TaxIDNumber`, `Phone`, `Address`, `RegisterUpperLimit`, `SPStationAmount`, `RelationalDB`, `CreatedBy`, `CreatedAt`, `UpdatedBy`, `UpdatedAt`) VALUES + (1, 0, 1, '大眾電腦', NULL, '20840777', '02-87518751', '臺北市內湖區陽光街300號1至9樓', 100, 0, NULL, 1, '2021-06-14 14:52:20', NULL, '2021-06-14 14:52:37'), + (2, 0, 1, '台積電', '2.png', '11223345', NULL, NULL, 10, 0, 'solar_com_0002', 1, '2021-06-14 17:38:49', NULL, '2021-06-14 17:39:00'); /*!40000 ALTER TABLE `company` ENABLE KEYS */; -- 傾印 資料表 solar_power.company_auth_page 結構 @@ -72,6 +510,83 @@ DELETE FROM `company_auth_page`; /*!40000 ALTER TABLE `company_auth_page` DISABLE KEYS */; /*!40000 ALTER TABLE `company_auth_page` ENABLE KEYS */; +-- 傾印 資料表 solar_power.device 結構 +CREATE TABLE IF NOT EXISTS `device` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否刪除, 0:否 1:是', + `UID` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '設備編號,縣市 +區域+電廠流水號(0001~9999)+設備類別(字母:3碼) + SN(設備流水號;3碼)', + `PowerStationId` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬電站編號', + `Name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名稱', + `Type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '類型', + `TypeName` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '類型名稱', + `Brand` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '廠牌', + `ProductModel` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '型號', + `DBName` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `TableName` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `ColName` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `Remark` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `CreatedBy` int(10) unsigned NOT NULL COMMENT '建立者', + `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '建立時間', + `UpdatedBy` int(10) unsigned DEFAULT NULL COMMENT '修改者', + `UpdatedAt` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT '修改時間', + PRIMARY KEY (`Id`) USING BTREE, + KEY `IDX_01` (`Deleted`) USING BTREE, + KEY `IDX_02` (`UID`,`PowerStationId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='裝置列表'; + +-- 正在傾印表格 solar_power.device 的資料:~-1 rows (近似值) +DELETE FROM `device`; +/*!40000 ALTER TABLE `device` DISABLE KEYS */; +/*!40000 ALTER TABLE `device` ENABLE KEYS */; + +-- 傾印 資料表 solar_power.land_building 結構 +CREATE TABLE IF NOT EXISTS `land_building` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否刪除, 0:否 1:是', + `PowerStationId` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬電站編號', + `Address` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '地址', + `LeaseNotarizationAt` timestamp NULL DEFAULT NULL COMMENT '租約公證日期', + `Landowner` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '地主姓名', + `Purpose` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '房屋用途', + `LeaseRate` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '租金比例(%)', + `Coordinate` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '座標', + `Phone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '電話', + `CreatedBy` int(10) unsigned NOT NULL COMMENT '建立者', + `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '建立時間', + `UpdatedBy` int(10) unsigned DEFAULT NULL COMMENT '修改者', + `UpdatedAt` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT '修改時間', + PRIMARY KEY (`Id`), + KEY `IDX_01` (`Deleted`,`PowerStationId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='土地與房屋'; + +-- 正在傾印表格 solar_power.land_building 的資料:~-1 rows (近似值) +DELETE FROM `land_building`; +/*!40000 ALTER TABLE `land_building` DISABLE KEYS */; +/*!40000 ALTER TABLE `land_building` ENABLE KEYS */; + +-- 傾印 資料表 solar_power.operation_firm 結構 +CREATE TABLE IF NOT EXISTS `operation_firm` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否刪除, 0:否 1:是', + `PowerStationId` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '所屬電站編號', + `Name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名稱', + `Type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '廠商類別,0:施工 1:清洗 2:運維', + `ContactPerson` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '聯絡人', + `Phone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '電話', + `Email` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Email', + `CreatedBy` int(10) unsigned NOT NULL COMMENT '建立者', + `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '建立時間', + `UpdatedBy` int(10) unsigned DEFAULT NULL COMMENT '修改者', + `UpdatedAt` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT '修改時間', + PRIMARY KEY (`Id`), + KEY `IDX_01` (`Deleted`,`PowerStationId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='運維廠商'; + +-- 正在傾印表格 solar_power.operation_firm 的資料:~-1 rows (近似值) +DELETE FROM `operation_firm`; +/*!40000 ALTER TABLE `operation_firm` DISABLE KEYS */; +/*!40000 ALTER TABLE `operation_firm` ENABLE KEYS */; + -- 傾印 資料表 solar_power.operator_log 結構 CREATE TABLE IF NOT EXISTS `operator_log` ( `Id` bigint(19) unsigned NOT NULL AUTO_INCREMENT, @@ -83,28 +598,37 @@ CREATE TABLE IF NOT EXISTS `operator_log` ( PRIMARY KEY (`Id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='操作紀錄'; +-- 正在傾印表格 solar_power.operator_log 的資料:~-1 rows (近似值) +DELETE FROM `operator_log`; +/*!40000 ALTER TABLE `operator_log` DISABLE KEYS */; +/*!40000 ALTER TABLE `operator_log` ENABLE KEYS */; -- 傾印 資料表 solar_power.power_station 結構 CREATE TABLE IF NOT EXISTS `power_station` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, `Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否刪除, 0:否 1:是', `CompanyId` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '公司編號', + `CityId` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '電站縣市', + `AreaId` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '電站區域', + `Address` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '電站詳細地址', `Name` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '名稱', - `Code` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '電站代碼,縣市+區域+流水號 ', + `Code` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '電站代碼,縣市+區域+四碼流水號', + `SerialNumber` varchar(4) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '四碼流水號', `IsEscrow` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否為代管,0:否 1:是', `EscrowName` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '代管名稱', `ElectricityMeterAt` timestamp NULL DEFAULT NULL COMMENT '台電掛錶日', `EstimatedRecoveryTime` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '預估回收時間', `GeneratingCapacity` decimal(10,1) NOT NULL DEFAULT 0.0 COMMENT '電廠發電容量,單位(千瓦)', - `PowerRate` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '受電費率', + `PowerRate` decimal(10,3) NOT NULL DEFAULT 0.000 COMMENT '受電費率', `Coordinate` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '座標', `InverterBrand` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '逆變器廠牌', `InverterProductModel` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '逆變器型號', `InverterAmount` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '逆變器數量', `PhotovoltaicPanelBrand` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '光電板廠牌', `PhotovoltaicPanelProductModel` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '光電板型號', - `PhotovoltaicPanelSpecification` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '光電板規格', + `PhotovoltaicPanelSpecification` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '光電板規格', `PhotovoltaicPanelAmount` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '光電板數量', + `BoEFileName` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '能源局原檔案名', `BoEFile` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '能源局檔案', `BoEDiscountRate` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '能源局折扣率', `BoEDeviceRegisterNumber` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '能源局設備登記編號', @@ -121,7 +645,8 @@ CREATE TABLE IF NOT EXISTS `power_station` ( `UpdatedAt` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT '修改時間', PRIMARY KEY (`Id`), KEY `IDX_01` (`Deleted`), - KEY `IDX_02` (`CompanyId`) + KEY `IDX_02` (`CompanyId`), + KEY `IDX_03` (`CityId`,`AreaId`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='電站資料'; -- 正在傾印表格 solar_power.power_station 的資料:~-1 rows (近似值) @@ -129,6 +654,81 @@ DELETE FROM `power_station`; /*!40000 ALTER TABLE `power_station` DISABLE KEYS */; /*!40000 ALTER TABLE `power_station` ENABLE KEYS */; +-- 傾印 資料表 solar_power.power_station_exception 結構 +CREATE TABLE IF NOT EXISTS `power_station_exception` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否刪除, 0:否 1:是', + `PowerStationId` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '電站編號', + `Type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '類型,0:PR值', + `UpperLimit` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '上限值', + `LowerLimit` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '下限值', + `Alarm` tinyint(4) NOT NULL DEFAULT 0 COMMENT '警報方式,0:email通知', + `CreatedBy` int(10) unsigned NOT NULL COMMENT '建立者', + `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '建立時間', + `UpdatedBy` int(10) unsigned DEFAULT NULL COMMENT '修改者', + `UpdatedAt` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp() COMMENT '修改時間', + PRIMARY KEY (`Id`), + KEY `IDX_01` (`Deleted`,`PowerStationId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='電站異常值設定'; + +-- 正在傾印表格 solar_power.power_station_exception 的資料:~-1 rows (近似值) +DELETE FROM `power_station_exception`; +/*!40000 ALTER TABLE `power_station_exception` DISABLE KEYS */; +/*!40000 ALTER TABLE `power_station_exception` ENABLE KEYS */; + +-- 傾印 資料表 solar_power.power_station_image 結構 +CREATE TABLE IF NOT EXISTS `power_station_image` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否刪除, 0:否 1:是', + `PowerStationId` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '電站編號', + `IsMainDisplay` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否主要顯示圖片, 0:否 1:是', + ` image` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '圖片檔名', + `CreatedBy` int(10) unsigned NOT NULL COMMENT '建立者', + `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '建立時間', + PRIMARY KEY (`Id`), + KEY `IDX_01` (`Deleted`,`IsMainDisplay`,`PowerStationId`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='電站資料'; + +-- 正在傾印表格 solar_power.power_station_image 的資料:~-1 rows (近似值) +DELETE FROM `power_station_image`; +/*!40000 ALTER TABLE `power_station_image` DISABLE KEYS */; +/*!40000 ALTER TABLE `power_station_image` ENABLE KEYS */; + +-- 傾印 資料表 solar_power.power_station_operation_personnel 結構 +CREATE TABLE IF NOT EXISTS `power_station_operation_personnel` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Deleted` tinyint(4) NOT NULL DEFAULT 0, + `PowerStationId` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '電站編號', + `UserId` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '人員編號', + `CreatedBy` int(10) unsigned NOT NULL COMMENT '建立者', + `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '建立時間', + PRIMARY KEY (`Id`), + KEY `IDX_01` (`Deleted`), + KEY `IDX_02` (`PowerStationId`,`UserId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='電站運維人員'; + +-- 正在傾印表格 solar_power.power_station_operation_personnel 的資料:~-1 rows (近似值) +DELETE FROM `power_station_operation_personnel`; +/*!40000 ALTER TABLE `power_station_operation_personnel` DISABLE KEYS */; +/*!40000 ALTER TABLE `power_station_operation_personnel` ENABLE KEYS */; + +-- 傾印 資料表 solar_power.power_station_single_line_diagram 結構 +CREATE TABLE IF NOT EXISTS `power_station_single_line_diagram` ( + `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否刪除, 0:否 1:是', + `PowerStationId` int(10) unsigned NOT NULL DEFAULT 0 COMMENT '電站編號', + ` image` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '圖片檔名', + `CreatedBy` int(10) unsigned NOT NULL COMMENT '建立者', + `CreatedAt` timestamp NOT NULL DEFAULT current_timestamp() COMMENT '建立時間', + PRIMARY KEY (`Id`), + KEY `IDX_01` (`Deleted`,`PowerStationId`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='電站單線圖'; + +-- 正在傾印表格 solar_power.power_station_single_line_diagram 的資料:~-1 rows (近似值) +DELETE FROM `power_station_single_line_diagram`; +/*!40000 ALTER TABLE `power_station_single_line_diagram` DISABLE KEYS */; +/*!40000 ALTER TABLE `power_station_single_line_diagram` ENABLE KEYS */; + -- 傾印 資料表 solar_power.role 結構 CREATE TABLE IF NOT EXISTS `role` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT, @@ -143,11 +743,14 @@ CREATE TABLE IF NOT EXISTS `role` ( PRIMARY KEY (`Id`), KEY `IDX_01` (`Deleted`), KEY `IDX_02` (`CompanyId`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色資料'; +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='角色資料'; -- 正在傾印表格 solar_power.role 的資料:~-1 rows (近似值) DELETE FROM `role`; /*!40000 ALTER TABLE `role` DISABLE KEYS */; +INSERT INTO `role` (`Id`, `Deleted`, `CompanyId`, `Name`, `Layer`, `CreatedBy`, `CreatedAt`, `UpdatedBy`, `UpdatedAt`) VALUES + (1, 0, 1, '平台管理員', 0, 1, '2021-06-14 14:48:15', NULL, NULL), + (2, 0, 2, '公司管理員', 2, 1, '2021-06-14 17:38:49', NULL, NULL); /*!40000 ALTER TABLE `role` ENABLE KEYS */; -- 傾印 資料表 solar_power.role_auth 結構 @@ -191,47 +794,32 @@ CREATE TABLE IF NOT EXISTS `user` ( -- 正在傾印表格 solar_power.user 的資料:~-1 rows (近似值) DELETE FROM `user`; /*!40000 ALTER TABLE `user` DISABLE KEYS */; - +INSERT INTO `user` (`Id`, `Deleted`, `Status`, `Name`, `Account`, `Password`, `IsGod`, `CompanyId`, `DepartmentId`, `RoleId`, `JobTitle`, `Phone`, `Tel`, `Email`, `CreatedBy`, `CreatedAt`, `UpdatedBy`, `UpdatedAt`) VALUES + (1, 0, 1, '野原新之助', 'admin', 'Ki4SV2TZiQbvDjdEVLNMmVkJfZC9VyTh88DmLSXP+Iw=', 0, 1, 0, 1, NULL, '0987987987', NULL, 'god@admin.com', 1, '2021-06-07 19:19:08', NULL, '2021-06-14 14:30:02'); +/*!40000 ALTER TABLE `user` ENABLE KEYS */; -- 傾印 資料表 solar_power.variable 結構 CREATE TABLE IF NOT EXISTS `variable` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '變數名稱', - `value` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '變數內容值', + `value` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '變數內容值', `remark` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '備註', PRIMARY KEY (`id`), KEY `IDX_01` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='設定變數'; +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='設定變數'; -- 正在傾印表格 solar_power.variable 的資料:~-1 rows (近似值) DELETE FROM `variable`; /*!40000 ALTER TABLE `variable` DISABLE KEYS */; +INSERT INTO `variable` (`id`, `name`, `value`, `remark`) VALUES + (1, 'Type', '{"Type":[{"Name":"日照計","EName":"PYR"},{"Name":"模組溫度計","EName":"MTR"},{"Name":"環境溫度計","EName":"ETR"},{"Name":"環境濕度計","EName":"EMM"},{"Name":"風速計","EName":"VAN"},{"Name":" 電表","EName":"PWR"}]}', '裝置類型'); /*!40000 ALTER TABLE `variable` ENABLE KEYS */; -/*!40000 ALTER TABLE `auth_page` DISABLE KEYS */; -INSERT INTO `auth_page` (`AuthCode`, `MainName`, `SubName`, `ControlName`) VALUES - ('A', '系統管理', '帳號管理', 'User,Role'), - ('B', '系統管理', '公司管理', 'Company'), - ('C', '系統管理', '電站資料管理', 'AAA'), - ('D', '系統管理', '定時任務設定', 'Setting'), - ('E', '系統管理', '功能清單', 'ASDA'), - ('F', '總覽', '地圖總覽', 'BBB'), - ('G', '總攬', '電占總覽', 'CCC'), - ('H', '總覽', '運為總覽', 'HHH'), - ('J', '即時告警', '即時告警', 'JJJ'), - ('K', '交叉分析', '逆變器', 'KKK'), - ('L', '交叉分析', '電站運轉效率', 'LLL'); -/*!40000 ALTER TABLE `auth_page` ENABLE KEYS */; -INSERT INTO `user` (`Id`, `Deleted`, `Status`, `Name`, `Account`, `Password`, `IsGod`, `CompanyId`, `DepartmentId`, `RoleId`, `JobTitle`, `Phone`, `Tel`, `Email`, `CreatedBy`, `CreatedAt`, `UpdatedBy`, `UpdatedAt`) VALUES - (1, 0, 1, '野原新之助', 'admin', 'Ki4SV2TZiQbvDjdEVLNMmVkJfZC9VyTh88DmLSXP+Iw=', 1, 1, 0, 1, NULL, '0987987987', NULL, 'god@admin.com', 1, '2021-06-07 19:19:08', NULL, '2021-06-13 19:08:22'); -/*!40000 ALTER TABLE `user` ENABLE KEYS */; +/****************************** +** 後續SQL修改從以下開始新增 ** +*******************************/ --- 新增FIC平台公司 -INSERT INTO `solar_power`.`company` (`Name`, `TaxIDNumber`, `Phone`, `Address`, `RegisterUpperLimit`, `CreatedBy`) VALUES ('大眾電腦', '20840777', '02-87518751', '臺北市內湖區陽光街300號1至9樓', '100', '1'); - --- 新增平台管理員角色 -INSERT INTO `solar_power`.`role` (`CompanyId`, `Name`, `Layer`, `CreatedBy`) VALUES ('1', '平台管理員', '0', '1'); /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;