alter database test default character set 'gbk';
set names 'gbk';
create table `test`.`test_tree`(
`id` bigint auto_increment primary key,
`p_id` int,
`d_name` varchar(40),
`username` varchar(20),
`leaf` int,
`levels` int
)type=myisam character set gbk;
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(1,0,'长城软件','null',0,1);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(2,1,'软件开发','null',0,2);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(3,2,'软件开发一部','null',0,3);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(4,2,'软件开发二部','null',0,3);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(5,3,'null','小张',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(6,3,'null','小王',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(7,3,'null','小李',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(8,3,'null','小黄',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(9,4,'null','小白',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(10,4,'null','小赵',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(11,4,'null','小孙',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(12,4,'null','小朱',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(13,1,'市场销售','null',0,2);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(14,13,'市场销售一部','null',0,3);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(15,13,'市场销售二部','null',0,3);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(16,14,'null','小张',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(17,14,'null','小王',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(18,14,'null','小李',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(19,14,'null','小黄',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(20,15,'null','小白',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(21,15,'null','小赵',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(22,15,'null','小孙',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(23,15,'null','小朱',1,4);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(24,32,'null','老朱',1,3);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(25,32,'null','老孙',1,3);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(26,32,'null','老赵',1,3);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(27,32,'null','老白',1,3);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(28,32,'null','老黄',1,3);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(29,32,'null','老李',1,3);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(30,32,'null','老王',1,3);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(31,32,'null','老张',1,3);
insert into test_tree(id,p_id,d_name,username,leaf,levels) values(32,1,'后勤部','null',0,2);