好久没这么开心的笑了,果然还是小孩招人稀罕。
分类表设计与代码生成
sql语句
如下所示:
drop table if exists category;
CREATE TABLE `category` (
`id` bigint NOT NULL comment 'id',
`parent` bigint not null default 0 comment '父id',
`name` varchar(50) NOT NULL comment '名称',
`sort` int comment '顺序',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci comment ='分类';
insert into category (id, parent, name, sort) values (100, 000, '前端开发', 100);
insert into category (id, parent, name, sort) values (101, 100, 'Vue', 101);
insert into category(id, parent, name, sort) values (102, 100, 'HTML & CSS', 102);
insert into category(id, parent, name, sort) values (200, 000, 'Java', 200);
insert into category(id, parent, name, sort) values (201, 200, '基础应用', 201);
insert into category (id, parent, name, sort) values (202, 200, '框架应用', 202);
insert into category (id, parent, name, sort) values (300, 000, 'Python', 300);
insert into category(id, parent, name, sort) values (301, 300, '基础应用', 301);
insert into category(id, parent, name, sort) values (302, 300, '进阶方向应用', 302);
insert into category(id, parent, name, sort) values (400, 000, '数据库', 400);
insert into category(id, parent, name, sort) values (401, 400, 'MySQL ', 401);
insert into category(id, parent, name, sort) values (500, 000, '其它', 500);
2、代码生成
使用代码生成器生成结果如下:
这部分特别简单,如果不了解请参考,传送门