-
Notifications
You must be signed in to change notification settings - Fork 22
/
sql.sql
408 lines (358 loc) · 26.4 KB
/
sql.sql
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
use AppsDB
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('DocumentCreate','创建','Create','Document',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('DocumentDelete','删除','Delete','Document',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('DocumentDetails','详细','Details','Document',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('DocumentEdit','编辑','Edit','Document',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('DocumentExport','导出','Export','Document',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('DocumentQuery','查询','Query','Document',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('DocumentSave','保存','Save','Document',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InfoCreate','创建','Create','Info',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InfoDelete','删除','Delete','Info',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InfoDetails','详细','Details','Info',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InfoEdit','编辑','Edit','Info',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InfoExport','导出','Export','Info',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InfoQuery','查询','Query','Info',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InfoSave','保存','Save','Info',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InfoHomeCreate','创建','Create','InfoHome',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InfoHomeDelete','删除','Delete','InfoHome',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InfoHomeDetails','详细','Details','InfoHome',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InfoHomeEdit','编辑','Edit','InfoHome',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InfoHomeExport','导出','Export','InfoHome',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InfoHomeQuery','查询','Query','InfoHome',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InfoHomeSave','保存','Save','InfoHome',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InformationCreate','创建','Create','Information',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InformationDelete','删除','Delete','Information',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InformationDetails','详细','Details','Information',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InformationEdit','编辑','Edit','Information',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InformationExport','导出','Export','Information',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InformationQuery','查询','Query','Information',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('InformationSave','保存','Save','Information',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('ManageInfoCreate','创建','Create','ManageInfo',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('ManageInfoDelete','删除','Delete','ManageInfo',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('ManageInfoDetails','详细','Details','ManageInfo',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('ManageInfoEdit','编辑','Edit','ManageInfo',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('ManageInfoExport','导出','Export','ManageInfo',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('ManageInfoQuery','查询','Query','ManageInfo',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('ManageInfoSave','保存','Save','ManageInfo',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('ModuleSettingCreate','创建','Create','ModuleSetting',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('ModuleSettingDelete','删除','Delete','ModuleSetting',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('ModuleSettingDetails','详细','Details','ModuleSetting',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('ModuleSettingEdit','编辑','Edit','ModuleSetting',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('ModuleSettingExport','导出','Export','ModuleSetting',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('ModuleSettingQuery','查询','Query','ModuleSetting',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('ModuleSettingSave','保存','Save','ModuleSetting',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('MyInfoCreate','创建','Create','MyInfo',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('MyInfoDelete','删除','Delete','MyInfo',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('MyInfoDetails','详细','Details','MyInfo',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('MyInfoEdit','编辑','Edit','MyInfo',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('MyInfoExport','导出','Export','MyInfo',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('MyInfoQuery','查询','Query','MyInfo',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('MyInfoSave','保存','Save','MyInfo',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('PersonDocumentCreate','创建','Create','PersonDocument',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('PersonDocumentDelete','删除','Delete','PersonDocument',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('PersonDocumentDetails','详细','Details','PersonDocument',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('PersonDocumentEdit','编辑','Edit','PersonDocument',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('PersonDocumentExport','导出','Export','PersonDocument',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('PersonDocumentQuery','查询','Query','PersonDocument',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('PersonDocumentSave','保存','Save','PersonDocument',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RightManageCreate','创建','Create','RightManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RightManageDelete','删除','Delete','RightManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RightManageDetails','详细','Details','RightManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RightManageEdit','编辑','Edit','RightManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RightManageExport','导出','Export','RightManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RightManageQuery','查询','Query','RightManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RightManageSave','保存','Save','RightManage',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RoleAuthorizeCreate','创建','Create','RoleAuthorize',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RoleAuthorizeDelete','删除','Delete','RoleAuthorize',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RoleAuthorizeDetails','详细','Details','RoleAuthorize',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RoleAuthorizeEdit','编辑','Edit','RoleAuthorize',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RoleAuthorizeExport','导出','Export','RoleAuthorize',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RoleAuthorizeQuery','查询','Query','RoleAuthorize',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RoleAuthorizeSave','保存','Save','RoleAuthorize',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RoleManageCreate','创建','Create','RoleManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RoleManageDelete','删除','Delete','RoleManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RoleManageDetails','详细','Details','RoleManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RoleManageEdit','编辑','Edit','RoleManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RoleManageExport','导出','Export','RoleManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RoleManageQuery','查询','Query','RoleManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('RoleManageSave','保存','Save','RoleManage',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SampleFileCreate','创建','Create','SampleFile',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SampleFileDelete','删除','Delete','SampleFile',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SampleFileDetails','详细','Details','SampleFile',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SampleFileEdit','编辑','Edit','SampleFile',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SampleFileExport','导出','Export','SampleFile',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SampleFileQuery','查询','Query','SampleFile',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SampleFileSave','保存','Save','SampleFile',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemConfigCreate','创建','Create','SystemConfig',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemConfigDelete','删除','Delete','SystemConfig',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemConfigDetails','详细','Details','SystemConfig',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemConfigEdit','编辑','Edit','SystemConfig',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemConfigExport','导出','Export','SystemConfig',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemConfigQuery','查询','Query','SystemConfig',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemConfigSave','保存','Save','SystemConfig',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemExcepitonCreate','创建','Create','SystemExcepiton',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemExcepitonDelete','删除','Delete','SystemExcepiton',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemExcepitonDetails','详细','Details','SystemExcepiton',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemExcepitonEdit','编辑','Edit','SystemExcepiton',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemExcepitonExport','导出','Export','SystemExcepiton',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemExcepitonQuery','查询','Query','SystemExcepiton',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemExcepitonSave','保存','Save','SystemExcepiton',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemJobsCreate','创建','Create','SystemJobs',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemJobsDelete','删除','Delete','SystemJobs',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemJobsDetails','详细','Details','SystemJobs',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemJobsEdit','编辑','Edit','SystemJobs',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemJobsExport','导出','Export','SystemJobs',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemJobsQuery','查询','Query','SystemJobs',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemJobsSave','保存','Save','SystemJobs',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemLogCreate','创建','Create','SystemLog',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemLogDelete','删除','Delete','SystemLog',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemLogDetails','详细','Details','SystemLog',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemLogEdit','编辑','Edit','SystemLog',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemLogExport','导出','Export','SystemLog',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemLogQuery','查询','Query','SystemLog',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemLogSave','保存','Save','SystemLog',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemManageCreate','创建','Create','SystemManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemManageDelete','删除','Delete','SystemManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemManageDetails','详细','Details','SystemManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemManageEdit','编辑','Edit','SystemManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemManageExport','导出','Export','SystemManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemManageQuery','查询','Query','SystemManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('SystemManageSave','保存','Save','SystemManage',0,0)
GO
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('UserManageCreate','创建','Create','UserManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('UserManageDelete','删除','Delete','UserManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('UserManageDetails','详细','Details','UserManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('UserManageEdit','编辑','Edit','UserManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('UserManageExport','导出','Export','UserManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('UserManageQuery','查询','Query','UserManage',0,0)
INSERT INTO [SysModuleOperate] ([Id],[Name],[KeyCode],[ModuleId],[IsValid],[Sort]) values ('UserManageSave','保存','Save','UserManage',0,0)
GO
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorDocument','Document','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorInfo','Info','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorInfoHome','InfoHome','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorInformation','Information','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorManageInfo','ManageInfo','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorModuleSetting','ModuleSetting','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorMyInfo','MyInfo','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorPersonDocument','PersonDocument','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorRightManage','RightManage','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorRoleAuthorize','RoleAuthorize','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorRoleManage','RoleManage','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorSystemConfig','SystemConfig','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorSystemExcepiton','SystemExcepiton','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorSystemJobs','SystemJobs','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorSystemLog','SystemLog','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorSystemManage','SystemManage','administrator',1)
INSERT INTO [SysRight] ([Id],[ModuleId],[RoleId],[Rightflag]) values ('administratorUserManage','UserManage','administrator',1)
EXEC dbo.P_Sys_GetRightOperate2 'admin','SysLog'
/*创建存储过程,自动完成给SysRightOperate插入数据*/
ALTER PROCEDURE P_Sys_Insert_SysRightOperate
AS
DECLARE @RightId varchar(200)
DECLARE CUR_R CURSOR
FOR SELECT Id FROM SysRight
OPEN CUR_R
FETCH NEXT FROM CUR_R INTO @RightId
WHILE @@FETCH_STATUS = 0
BEGIN
INSERT INTO SysRightOperate(Id,RightId,KeyCode,IsValid)
VALUES(@RightId + 'Create',@RightId,'Create',1)
INSERT INTO SysRightOperate(Id,RightId,KeyCode,IsValid)
VALUES(@RightId + 'Delete',@RightId,'Delete',1)
INSERT INTO SysRightOperate(Id,RightId,KeyCode,IsValid)
VALUES(@RightId + 'Details',@RightId,'Details',1)
INSERT INTO SysRightOperate(Id,RightId,KeyCode,IsValid)
VALUES(@RightId + 'Edit',@RightId,'Edit',1)
INSERT INTO SysRightOperate(Id,RightId,KeyCode,IsValid)
VALUES(@RightId + 'Export',@RightId,'Export',1)
INSERT INTO SysRightOperate(Id,RightId,KeyCode,IsValid)
VALUES(@RightId + 'Query',@RightId,'Query',1)
INSERT INTO SysRightOperate(Id,RightId,KeyCode,IsValid)
VALUES(@RightId + 'Save',@RightId,'Save',1)
FETCH NEXT FROM CUR_R INTO @RightId
END
CLOSE CUR_R
DEALLOCATE CUR_R
GO
DELETE FROM SysRightOperate
EXEC P_Sys_Insert_SysRightOperate
GO
--触发器 当插入模块时,分配给管理员角色
drop TRIGGER T_Sys_InsertSysRight
ON SysModule
AFTER INSERT
AS
DECLARE @Id varchar(200), @ModuleId varchar(50), @RoleId varchar(50), @Rightflag bit
--获取插入的数据行
SELECT @ModuleId = Id FROM inserted
SET @RoleId = 'administrator'
SET @Id = @RoleId + @ModuleId
INSERT INTO SysRight VALUES(@Id,@ModuleId,@RoleId,1)
GO
--存储过程 检查是否叶子菜单才有操作码
CREATE PROCEDURE P_Check_SysRightOperate
AS
DELETE FROM SysRightOperate
WHERE RightId IN (
SELECT SysRight.Id
FROM SysModule JOIN SysRight ON SysModule.Id = SysRight.ModuleId
WHERE SysModule.IsLast != 1
)
GO
EXEC P_Check_SysRightOperate
GO
--存储过程 检查是否叶子模块才有模块操作码
CREATE PROCEDURE P_Check_SysModuleOperate
AS
DELETE FROM SysModuleOperate
WHERE ModuleId IN (
SELECT Id
FROM SysModule
WHERE IsLast != 1
)
GO
--存储过程 当插入模块时,分配给角色
CREATE PROC P_Sys_InsertSysRight
AS
INSERT INTO SysRight(Id,ModuleId,RoleId,Rightflag)
SELECT r.Id+m.Id,m.Id,r.Id,0
FROM SysModule m,SysRole r
WHERE r.Id + m.Id NOT IN (
SELECT r.Id
FROM SysRight r
)
GO
--测试
SELECT a.Id,a.Name,a.KeyCode,a.ModuleId,ISNULL(b.IsValid,0) as isValid,a.Sort
FROM SysModuleOperate a LEFT OUTER JOIN (
SELECT mo.Id,ro.IsValid IsValid
FROM SysRight r, SysRightOperate ro, SysModuleOperate mo
WHERE RightId in (
SELECT Id
FROM SysRight
WHERE RoleId = 'administrator' AND ModuleId = 'BaseSample'
)AND r.Id = ro.RightId AND ro.KeyCode = mo.KeyCode AND r.ModuleId = mo.ModuleId
)b ON a.Id = b.Id
WHERE a.ModuleId = 'BaseSample'
SELECT mo.Id,ISNULL(ro.IsValid, 0)
FROM SysRight r, SysRightOperate ro, SysModuleOperate mo
WHERE RightId in (
SELECT Id
FROM SysRight
WHERE RoleId = 'administrator' AND ModuleId = 'RoleManage'
)AND r.Id = ro.RightId AND ro.KeyCode = mo.KeyCode AND r.ModuleId = mo.ModuleId
--存储过程 清除权限操作码表中无用的项
CREATE PROC P_Sys_ClearUnusedRightOperate
AS
DELETE FROM SysRightOperate
WHERE Id NOT IN (
SELECT SysRight.Id + SysModuleOperate.KeyCode
FROM SysRight JOIN SysModuleOperate ON SysRight.ModuleId = SysModuleOperate.ModuleId
)
--存储过程 更新权限表的RightFlag字段
CREATE PROC P_Sys_UpdateSysRightRightFlag
@moduleId varchar(50),
@roleId varchar(50)
AS
DECLARE @count int
--计算模块权限
SELECT @count = COUNT(*) FROM SysRightOperate
WHERE RightId = @roleId + @moduleId
IF ( @count > 0 )
BEGIN
UPDATE SysRight SET Rightflag = 1 WHERE Id = @roleId AND ModuleId = @moduleId
END
ELSE
BEGIN
UPDATE SysRight SET Rightflag = 0 WHERE Id = @roleId AND ModuleId = @moduleId
END
--计算下层模块权限
DECLARE @parentId varchar(50)
SET @parentId = @moduleId
WHILE(@parentId <> 0)
BEGIN
SELECT @parentId = ParentId FROM SysModule WHERE Id = @parentId
IF ( @parentId IS NULL )
BEGIN
RETURN
END
SELECT @count = COUNT(*) FROM SysRight WHERE ModuleId IN (
SELECT Id FROM SysModule WHERE ParentId = @parentId
)AND RoleId = @roleId AND Rightflag = 1
IF (@count >0)
BEGIN
UPDATE SysRight SET Rightflag = 1 WHERE ModuleId = @parentId AND RoleId = @roleId
END
ELSE
BEGIN
UPDATE SysRight SET Rightflag = 0 WHERE ModuleId = @parentId AND RoleId = @roleId
END
END
EXEC P_Sys_GetRightByRoleAndModule 'ceshi','BaseSample'
EXEC P_Sys_UpdateSysRightRightFlag 'BaseSample','ceshi'
--存储过程 查找该用户对所有角色的拥有状态
ALTER PROC P_Sys_GetRoleByUserId
@userId varchar(50)
AS
SELECT R.Id,R.Name,R.Description,R.CreateTime,R.CreatePerson,ISNULL(RU.SysUserId,0) Flag
FROM SysRole R LEFT JOIN SysRoleSysUser RU ON R.Id = RU.SysRoleId AND RU.SysUserId = @userId
ORDER BY RU.SysUserId desc
GO
EXEC P_Sys_GetRoleByUserId 'admin'
GO
--存储过程 更新角色用户表
CREATE PROC P_Sys_UpdateSysRoleSysUser
@roleId varchar(50),@userId varchar(50)
AS
INSERT INTO SysRoleSysUser(SysRoleId,SysUserId) VALUES (@roleId,@userId)
GO
--存储过程 删除某用户的所有角色,为更新的中间过程
CREATE PROC P_Sys_DeleteSysRoleSysUserByUserId
@userId varchar(50)
AS
DELETE FROM SysRoleSysUser WHERE SysUserId = @userId
GO
--存储过程 查找该角色对所有用户的分配状态
ALTER PROC P_Sys_GetUserByRoleId
@roleId varchar(50)
AS
SELECT U.*,ISNULL(RU.SysRoleId,0) Flag
FROM SysUser U LEFT JOIN SysRoleSysUser RU ON U.Id = RU.SysUserId AND RU.SysRoleId = @roleId
ORDER BY RU.SysRoleId DESC
GO
EXEC P_Sys_GetUserByRoleId 'ceshi'
GO
--存储过程 删除某角色的所有用户,为更新的中间过程
CREATE PROC P_DeleteSysRoleSysUserByRoleId
@roleId varchar(50)
AS
DELETE FROM SysRoleSysUser WHERE SysRoleId = @roleId
----------------------------------T4模板使用----------------------------------
select *
from AppsDB.sys.objects obj JOIN AppsDB.sys.sysindexes idx ON obj.object_id = idx.id JOIN AppsDB.sys.schemas sem ON obj.schema_id = sem.schema_id
where obj.type = 'U'
order by obj.name
select *
from AppsDB.sys.indexes idx JOIN AppsDB.sys.index_columns ic ON idx.index_id = ic.index_id AND idx.object_id = ic.object_id
select col.name ColumnName,tp.name ColumnType,col.is_nullable IsNullable
from AppsDB.sys.columns col JOIN AppsDB.sys.types tp ON col.system_type_id = tp.system_type_id AND col.user_type_id = tp.user_type_id
LEFT JOIN AppsDB.sys.extended_properties ep ON col.object_id = ep.major_id AND col.column_id = ep.minor_id
where col.object_id = OBJECT_ID('SysSample')
order by col.column_id
--------------------------------------------------------------------------------------