d531bc79
王彪总
feat(garden): 新增城...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
-- =====================================================
-- 城市部件 — 建表 SQL
-- 数据库:urban_ops_agent (MySQL 8.x)
-- 参考:西单项目一物一码模型命名规则
-- =====================================================
-- 1. 城市部件类型表
DROP TABLE IF EXISTS `garden_city_component_type`;
CREATE TABLE `garden_city_component_type` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`type_code` varchar(32) NOT NULL COMMENT '类型编码(2/3/4位数字,如 02、021、0211)',
`type_name` varchar(64) NOT NULL COMMENT '类型名称',
`level` tinyint NOT NULL COMMENT '层级:1=一级(2位) 2=二级(3位) 3=三级(4位)',
`parent_code` varchar(32) DEFAULT NULL COMMENT '父级类型编码(一级为NULL)',
`sort` int DEFAULT 0 COMMENT '排序序号',
`status` tinyint DEFAULT 1 COMMENT '状态:1启用 0禁用',
`remark` varchar(512) DEFAULT NULL COMMENT '备注',
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除',
`tenant_id` bigint DEFAULT 0 COMMENT '租户ID',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_type_code` (`type_code`),
KEY `idx_parent_code` (`parent_code`),
KEY `idx_level` (`level`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='城市部件类型三级分类表';
-- 初始化一级类型(来自西单项目一物一码模型命名规则)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('01', '建筑要素', 1, NULL, 1, 1, '1', '1'),
('02', '公共设施要素', 1, NULL, 2, 1, '1', '1'),
('03', '园林绿化要素', 1, NULL, 3, 1, '1', '1'),
('04', '道路交通要素', 1, NULL, 4, 1, '1', '1');
-- 初始化二级类型(公共设施要素 02 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('021', '照明灯', 2, '02', 1, 1, '1', '1'),
('022', '摄像头', 2, '02', 2, 1, '1', '1'),
('023', '井盖', 2, '02', 3, 1, '1', '1'),
('024', '宣传栏', 2, '02', 4, 1, '1', '1'),
('025', '垃圾桶', 2, '02', 5, 1, '1', '1'),
('026', '下水道口', 2, '02', 6, 1, '1', '1'),
('027', '路障', 2, '02', 7, 1, '1', '1'),
('028', '变电箱', 2, '02', 8, 1, '1', '1'),
('029', '街道家具', 2, '02', 9, 1, '1', '1');
-- 初始化二级类型(道路交通要素 04 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('041', '栏杆', 2, '04', 1, 1, '1', '1'),
('042', '标识牌', 2, '04', 2, 1, '1', '1'),
('043', '公交站牌', 2, '04', 3, 1, '1', '1'),
('044', '红绿灯', 2, '04', 4, 1, '1', '1');
-- 初始化二级类型(园林绿化要素 03 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('031', '花坛', 2, '03', 1, 1, '1', '1'),
('032', '树木', 2, '03', 2, 1, '1', '1'),
('034', '绿化带', 2, '03', 3, 1, '1', '1');
-- 初始化三级类型(照明灯 021 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('0211', '路灯', 3, '021', 1, 1, '1', '1'),
('0212', '投光灯', 3, '021', 2, 1, '1', '1');
-- 初始化三级类型(摄像头 022 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('0221', '球机', 3, '022', 1, 1, '1', '1'),
('0222', '枪机', 3, '022', 2, 1, '1', '1'),
('0223', '半球', 3, '022', 3, 1, '1', '1');
-- 初始化三级类型(井盖 023 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('0231', '电力', 3, '023', 1, 1, '1', '1'),
('0232', '污水', 3, '023', 2, 1, '1', '1'),
('0233', '排水', 3, '023', 3, 1, '1', '1'),
('0234', '通信', 3, '023', 4, 1, '1', '1'),
('0235', '雨水', 3, '023', 5, 1, '1', '1'),
('0236', '消防', 3, '023', 6, 1, '1', '1'),
('0237', '热力', 3, '023', 7, 1, '1', '1'),
('0238', '自来水', 3, '023', 8, 1, '1', '1'),
('0239', '其他', 3, '023', 9, 1, '1', '1');
-- 初始化三级类型(宣传栏 024 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('0241', '立式', 3, '024', 1, 1, '1', '1'),
('0242', '壁挂式', 3, '024', 2, 1, '1', '1');
-- 初始化三级类型(垃圾桶 025 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('0251', '单桶', 3, '025', 1, 1, '1', '1'),
('0252', '双桶', 3, '025', 2, 1, '1', '1'),
('0253', '三桶', 3, '025', 3, 1, '1', '1');
-- 初始化三级类型(下水道口 026 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('0261', '平篦', 3, '026', 1, 1, '1', '1'),
('0262', '立篦', 3, '026', 2, 1, '1', '1');
-- 初始化三级类型(路障 027 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('0271', '隔离墩', 3, '027', 1, 1, '1', '1'),
('0272', '防撞桶', 3, '027', 2, 1, '1', '1');
-- 初始化三级类型(变电箱 028 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('0281', '配电箱', 3, '028', 1, 1, '1', '1'),
('0282', '变电箱', 3, '028', 2, 1, '1', '1'),
('0283', '控制箱', 3, '028', 3, 1, '1', '1');
-- 初始化三级类型(街道家具 029 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('0291', '座椅', 3, '029', 1, 1, '1', '1'),
('0292', '花箱', 3, '029', 2, 1, '1', '1'),
('0293', '健身器材', 3, '029', 3, 1, '1', '1'),
('0294', '亭体', 3, '029', 4, 1, '1', '1'),
('0295', '景观设施', 3, '029', 5, 1, '1', '1'),
('0296', '应急救援', 3, '029', 6, 1, '1', '1');
-- 初始化三级类型(栏杆 041 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('0411', '人行道护栏', 3, '041', 1, 1, '1', '1'),
('0412', '隔离护栏', 3, '041', 2, 1, '1', '1'),
('0413', '河道护栏', 3, '041', 3, 1, '1', '1');
-- 初始化三级类型(标识牌 042 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('0421', '指示牌', 3, '042', 1, 1, '1', '1'),
('0422', '警示牌', 3, '042', 2, 1, '1', '1'),
('0423', '路名牌', 3, '042', 3, 1, '1', '1'),
('0424', '禁令牌', 3, '042', 4, 1, '1', '1');
-- 初始化三级类型(公交站牌 043 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('0431', '候车亭', 3, '043', 1, 1, '1', '1'),
('0432', '简易站牌', 3, '043', 2, 1, '1', '1');
-- 初始化三级类型(红绿灯 044 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('0441', '机动车灯', 3, '044', 1, 1, '1', '1'),
('0442', '行人灯', 3, '044', 2, 1, '1', '1'),
('0443', '组合灯', 3, '044', 3, 1, '1', '1');
-- 初始化三级类型(树木 032 下)
INSERT INTO `garden_city_component_type` (`type_code`, `type_name`, `level`, `parent_code`, `sort`, `status`, `creator`, `updater`) VALUES
('0321', '松树', 3, '032', 1, 1, '1', '1'),
('0322', '杨树', 3, '032', 2, 1, '1', '1');
-- =====================================================
-- 2. 城市部件管理表
DROP TABLE IF EXISTS `garden_city_component`;
CREATE TABLE `garden_city_component` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`component_code` varchar(64) NOT NULL COMMENT '资产ID(一物一码,如 110102001_02_0211_0001)',
-- 三级类型关联
`level_one_type_code` varchar(32) DEFAULT NULL COMMENT '一级资产类型编码',
`level_one_type_name` varchar(64) DEFAULT NULL COMMENT '一级资产类型名称(冗余)',
`level_two_type_code` varchar(32) DEFAULT NULL COMMENT '二级资产类型编码',
`level_two_type_name` varchar(64) DEFAULT NULL COMMENT '二级资产类型名称(冗余)',
`level_three_type_code` varchar(32) DEFAULT NULL COMMENT '三级资产类型编码',
`level_three_type_name` varchar(64) DEFAULT NULL COMMENT '三级资产类型名称(冗余)',
-- 行政区划
`city_code` varchar(16) DEFAULT NULL COMMENT '城市代码',
`district_code` varchar(16) DEFAULT NULL COMMENT '城区代码',
`street_code` varchar(16) DEFAULT NULL COMMENT '街道代码',
-- 位置信息
`area` varchar(128) DEFAULT NULL COMMENT '所属区域',
`road_code` varchar(16) DEFAULT NULL COMMENT '道路编码',
`road_name` varchar(128) DEFAULT NULL COMMENT '道路名称',
|