-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnetdisk.sql
496 lines (436 loc) · 18.3 KB
/
netdisk.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
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
/*
Navicat Premium Data Transfer
Source Server : vm_01
Source Server Type : MySQL
Source Server Version : 50722
Source Host : 192.168.219.129:3306
Source Schema : netdisk
Target Server Type : MySQL
Target Server Version : 50722
File Encoding : 65001
Date: 04/05/2019 23:47:56
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for admin
-- ----------------------------
DROP TABLE IF EXISTS `admin`;
CREATE TABLE `admin` (
`admin_id` int(11) NOT NULL AUTO_INCREMENT,
`create_time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
`username` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`status` int(11) NULL DEFAULT 0,
`password` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`admin_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for fileupload
-- ----------------------------
DROP TABLE IF EXISTS `fileupload`;
CREATE TABLE `fileupload` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`upload_time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
`file_path` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`File_Save_Name` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`File_Real_Name` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`file_Ext_Name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`file_Size` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`file_Type` int(11) NULL DEFAULT NULL,
`is_Dir` int(11) NULL DEFAULT 1,
`upload_User_Id` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`parent_id` int(11) NULL DEFAULT NULL,
`media_Cache_Path` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`md5_Hex` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`file_Status` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0',
`Shoot_Time` datetime(0) NULL DEFAULT NULL,
`img_width` int(11) NULL DEFAULT NULL,
`img_height` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1398 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for message
-- ----------------------------
DROP TABLE IF EXISTS `message`;
CREATE TABLE `message` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` int(11) NULL DEFAULT NULL COMMENT '消息级别 success 0,info 1,warning 2,error 3',
`title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息标题',
`description` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息描述',
`user_id` int(11) NULL DEFAULT NULL COMMENT '消息接收者',
`status` int(11) NULL DEFAULT 0 COMMENT '消息状态 0 正常 1已读',
`create_time` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for recycle
-- ----------------------------
DROP TABLE IF EXISTS `recycle`;
CREATE TABLE `recycle` (
`recycle_id` int(11) NOT NULL AUTO_INCREMENT,
`file_id` int(11) NULL DEFAULT NULL,
`delete_user_id` int(11) NULL DEFAULT NULL,
`delete_time` datetime(0) NULL DEFAULT NULL,
`over_time` datetime(0) NULL DEFAULT NULL,
`recycle_status` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`recycle_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 140 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for sharefile
-- ----------------------------
DROP TABLE IF EXISTS `sharefile`;
CREATE TABLE `sharefile` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`share_Id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`share_User_Id` int(11) NULL DEFAULT NULL,
`share_User` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`share_Pwd` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`share_Time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
`share_Status` int(11) NULL DEFAULT NULL,
`file_id` int(11) NULL DEFAULT NULL,
`access_times` int(11) NULL DEFAULT NULL,
`download_times` int(11) NULL DEFAULT NULL,
`save_times` int(11) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Table structure for user_friend_apply_for
-- ----------------------------
DROP TABLE IF EXISTS `user_friend_apply_for`;
CREATE TABLE `user_friend_apply_for` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`applicant` int(11) NULL DEFAULT NULL COMMENT '申请者id',
`respondent` int(11) NULL DEFAULT NULL COMMENT '被申请者id',
`verify` int(1) NULL DEFAULT 0 COMMENT '验证状态 0:待验证;1:同意好友申请;2:不同意好友申请',
`status` int(1) NULL DEFAULT 0 COMMENT '状态 0:正常;1:删除',
`postscript` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附言',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户好友申请表' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for user_friend_list
-- ----------------------------
DROP TABLE IF EXISTS `user_friend_list`;
CREATE TABLE `user_friend_list` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_id` int(11) NULL DEFAULT NULL COMMENT '用户id',
`friend_id` int(11) NULL DEFAULT NULL COMMENT '好友用户id',
`status` int(1) NULL DEFAULT 0 COMMENT '状态 0:正常;1:删除',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for user_friend_message
-- ----------------------------
DROP TABLE IF EXISTS `user_friend_message`;
CREATE TABLE `user_friend_message` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`from` int(11) NULL DEFAULT NULL COMMENT '消息从何处来(发送消息用户id)',
`to` int(11) NULL DEFAULT NULL COMMENT '消息到何处去(接收消息用户id)',
`content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息内容',
`file_id` int(11) NULL DEFAULT NULL COMMENT '关联file id',
`status` int(1) NULL DEFAULT 0 COMMENT '状态 0:正常;1:删除',
`create_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 31 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for usernetdisk
-- ----------------------------
DROP TABLE IF EXISTS `usernetdisk`;
CREATE TABLE `usernetdisk` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`password` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`sex` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`real_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`reg_Time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0),
`total_Memory` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`used_Memory` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`phone` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`email` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`user_Status` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0',
`avatar` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`signature` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '个性签名',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 36 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact;
-- ----------------------------
-- Procedure structure for delete_dir
-- ----------------------------
DROP PROCEDURE IF EXISTS `delete_dir`;
delimiter ;;
CREATE DEFINER=`xuxiake`@`%` PROCEDURE `delete_dir`(IN rootId INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmpList;
CREATE TEMPORARY TABLE IF NOT EXISTS tmpList(
sno INT PRIMARY KEY AUTO_INCREMENT,
id INT,
depth INT);
CALL pro_cre_childlist_del(rootId,0);
UPDATE fileupload SET file_Status='2' WHERE id in
(SELECT t.id from (SELECT fileupload.id FROM tmpList,fileupload
WHERE tmpList.id=fileupload.id ORDER BY tmpList.sno) t)
and file_Status='0';
END
;;
delimiter ;
-- ----------------------------
-- Function structure for fn_tree_path
-- ----------------------------
DROP FUNCTION IF EXISTS `fn_tree_path`;
delimiter ;;
CREATE DEFINER=`xuxiake`@`%` FUNCTION `fn_tree_path`(nid INT,delimit VARCHAR(10)) RETURNS varchar(2000) CHARSET utf8
BEGIN
DECLARE pathid VARCHAR(1000);
SET pathid = CAST(nid AS CHAR);
CALL pro_cre_pathlist(nid,delimit,pathid);
RETURN pathid;
END
;;
delimiter ;
-- ----------------------------
-- Function structure for fn_tree_pathname
-- ----------------------------
DROP FUNCTION IF EXISTS `fn_tree_pathname`;
delimiter ;;
CREATE DEFINER=`xuxiake`@`%` FUNCTION `fn_tree_pathname`(nid INT,delimit VARCHAR(10)) RETURNS varchar(2000) CHARSET utf8
BEGIN
DECLARE pathid VARCHAR(1000);
SET pathid='';
CALL pro_cre_pnlist(nid,delimit,pathid);
RETURN pathid;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for get_sumsize_del
-- ----------------------------
DROP PROCEDURE IF EXISTS `get_sumsize_del`;
delimiter ;;
CREATE DEFINER=`xuxiake`@`%` PROCEDURE `get_sumsize_del`(IN rootId INT,OUT sumsize INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmpList;
CREATE TEMPORARY TABLE IF NOT EXISTS tmpList(
sno INT PRIMARY KEY AUTO_INCREMENT,
id INT,
depth INT);
CALL pro_cre_childlist_del(rootId,0);
select sum(0+file_Size) INTO sumsize from fileupload
WHERE id in
(SELECT t.id from (SELECT fileupload.id FROM tmpList,fileupload
WHERE tmpList.id=fileupload.id ORDER BY tmpList.sno) t)
and file_Status='0';
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for get_sumsize_rbk
-- ----------------------------
DROP PROCEDURE IF EXISTS `get_sumsize_rbk`;
delimiter ;;
CREATE DEFINER=`xuxiake`@`%` PROCEDURE `get_sumsize_rbk`(IN rootId INT,OUT sumsize INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmpList;
CREATE TEMPORARY TABLE IF NOT EXISTS tmpList(
sno INT PRIMARY KEY AUTO_INCREMENT,
id INT,
depth INT);
CALL pro_cre_childlist_rbk(rootId,0);
select sum(0+file_Size) INTO sumsize from fileupload
WHERE id in
(SELECT t.id from (SELECT fileupload.id FROM tmpList,fileupload
WHERE tmpList.id=fileupload.id ORDER BY tmpList.sno) t)
and file_Status='2';
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for pro_cre_childlist
-- ----------------------------
DROP PROCEDURE IF EXISTS `pro_cre_childlist`;
delimiter ;;
CREATE DEFINER=`xuxiake`@`%` PROCEDURE `pro_cre_childlist`(IN rootId int, IN nDepth int)
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE b INT;
DECLARE cur1 CURSOR FOR SELECT id FROM fileupload WHERE parent_id=rootId and file_Status='0';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
SET max_sp_recursion_depth=12;
INSERT INTO tmpList VALUES (NULL,rootId,nDepth);
OPEN cur1;
FETCH cur1 INTO b;
WHILE done=0 DO
CALL pro_cre_childlist(b,nDepth+1);
FETCH cur1 INTO b;
END WHILE;
CLOSE cur1;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for pro_cre_childlist_del
-- ----------------------------
DROP PROCEDURE IF EXISTS `pro_cre_childlist_del`;
delimiter ;;
CREATE DEFINER=`xuxiake`@`%` PROCEDURE `pro_cre_childlist_del`(IN rootId INT,IN nDepth INT)
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE b INT;
DECLARE cur1 CURSOR FOR SELECT id FROM fileupload WHERE parent_id=rootId and file_Status='0';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
SET max_sp_recursion_depth=12;
INSERT INTO tmpList VALUES (NULL,rootId,nDepth);
OPEN cur1;
FETCH cur1 INTO b;
WHILE done=0 DO
CALL pro_cre_childlist_del(b,nDepth+1);
FETCH cur1 INTO b;
END WHILE;
CLOSE cur1;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for pro_cre_childlist_rbk
-- ----------------------------
DROP PROCEDURE IF EXISTS `pro_cre_childlist_rbk`;
delimiter ;;
CREATE DEFINER=`xuxiake`@`%` PROCEDURE `pro_cre_childlist_rbk`(IN rootId INT,IN nDepth INT)
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE b INT;
DECLARE cur1 CURSOR FOR SELECT id FROM fileupload WHERE parent_id=rootId and file_Status='2';
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
SET max_sp_recursion_depth=12;
INSERT INTO tmpList VALUES (NULL,rootId,nDepth);
OPEN cur1;
FETCH cur1 INTO b;
WHILE done=0 DO
CALL pro_cre_childlist_rbk(b,nDepth+1);
FETCH cur1 INTO b;
END WHILE;
CLOSE cur1;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for pro_cre_parentlist
-- ----------------------------
DROP PROCEDURE IF EXISTS `pro_cre_parentlist`;
delimiter ;;
CREATE DEFINER=`xuxiake`@`%` PROCEDURE `pro_cre_parentlist`(IN rootId INT,IN nDepth INT)
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE b INT;
DECLARE cur1 CURSOR FOR SELECT parent_id FROM fileupload WHERE id=rootId;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
SET max_sp_recursion_depth=12;
INSERT INTO tmpList VALUES(NULL,rootId,nDepth);
OPEN cur1;
FETCH cur1 INTO b;
WHILE done=0 DO
CALL pro_cre_parentlist(b,nDepth+1);
FETCH cur1 INTO b;
END WHILE;
CLOSE cur1;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for pro_cre_pathlist
-- ----------------------------
DROP PROCEDURE IF EXISTS `pro_cre_pathlist`;
delimiter ;;
CREATE DEFINER=`xuxiake`@`%` PROCEDURE `pro_cre_pathlist`(IN nid INT,IN delimit VARCHAR(10),
INOUT pathstr VARCHAR(1000))
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE parentid INT DEFAULT 0;
DECLARE cur1 CURSOR FOR
SELECT t.parent_id,CONCAT(CAST(t.parent_id AS CHAR),delimit,pathstr)
from fileupload AS t WHERE t.id = nid;
-- 下面这行表示若没有数据返回,程序继续,并将变量done设为1
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
-- mysql中可以利用系统参数 max_sp_recursion_depth 来控制递归调用的层数上限。
SET max_sp_recursion_depth=12;
OPEN cur1;
-- 游标向下走一步
FETCH cur1 INTO parentid,pathstr;
WHILE done=0 DO
CALL pro_cre_pathlist(parentid,delimit,pathstr);
-- 游标向下走一步
FETCH cur1 INTO parentid,pathstr;
END WHILE;
CLOSE cur1;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for pro_cre_pnlist
-- ----------------------------
DROP PROCEDURE IF EXISTS `pro_cre_pnlist`;
delimiter ;;
CREATE DEFINER=`xuxiake`@`%` PROCEDURE `pro_cre_pnlist`(IN nid INT,IN delimit VARCHAR(10),
INOUT pathstr VARCHAR(1000))
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE parentid INT DEFAULT 0;
DECLARE cur1 CURSOR FOR
SELECT t.parent_id,CONCAT(t.File_Real_Name,delimit,pathstr)
from fileupload AS t WHERE t.id = nid;
-- 下面这行表示若没有数据返回,程序继续,并将变量done设为1
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
-- mysql中可以利用系统参数 max_sp_recursion_depth 来控制递归调用的层数上限。
SET max_sp_recursion_depth=12;
OPEN cur1;
-- 游标向下走一步
FETCH cur1 INTO parentid,pathstr;
WHILE done=0 DO
CALL pro_cre_pnlist(parentid,delimit,pathstr);
-- 游标向下走一步
FETCH cur1 INTO parentid,pathstr;
END WHILE;
CLOSE cur1;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for pro_show_childlist
-- ----------------------------
DROP PROCEDURE IF EXISTS `pro_show_childlist`;
delimiter ;;
CREATE DEFINER=`xuxiake`@`%` PROCEDURE `pro_show_childlist`(IN rootId int)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmpList;
CREATE TEMPORARY TABLE IF NOT EXISTS tmpList(
sno INT PRIMARY KEY AUTO_INCREMENT,
id INT,
depth INT);
CALL pro_cre_childlist_del(rootId,0);
select tmpList.id from tmpList;
END
;;
delimiter ;
-- ----------------------------
-- Procedure structure for reback_dir
-- ----------------------------
DROP PROCEDURE IF EXISTS `reback_dir`;
delimiter ;;
CREATE DEFINER=`xuxiake`@`%` PROCEDURE `reback_dir`(IN rootId INT)
BEGIN
DROP TEMPORARY TABLE IF EXISTS tmpList;
CREATE TEMPORARY TABLE IF NOT EXISTS tmpList(
sno INT PRIMARY KEY AUTO_INCREMENT,
id INT,
depth INT);
CALL pro_cre_childlist_rbk(rootId,0);
UPDATE fileupload SET file_Status='0' WHERE id in
(SELECT t.id from (SELECT fileupload.id FROM tmpList,fileupload
WHERE tmpList.id=fileupload.id ORDER BY tmpList.sno) t)
and file_Status='2';
END
;;
delimiter ;
SET FOREIGN_KEY_CHECKS = 1;