评论回复功能,总结开发-Java
上一篇文章是将所有的评论和回复集成到一张表中,只能支持一级评论和回复,不能对别人的回复进行回复
所以这次将评论和回复划分出来,分为两张表,分别是评论表和回复表
Comment表和 Reply表
表格设计
Comment表
-- auto-generated definition
create table comment
(
id bigint not null
constraint comment_pk
primary key,
uid varchar(255),
uname varchar(50),
content text,
create_time timestamp
);
comment on table comment is '评论表';
comment on column comment.id is '主键id';
comment on column comment.uid is '用户id';
comment on column comment.uname is '用户名';
comment on column comment.content is '评论内容';
comment on column comment.create_time is '评论时间';
alter table comment
owner to postgres;
Reply表
-- auto-generated definition
create table reply
(
id bigint not null
constraint reply_pk
primary key,
tr_id bigint,
tr_status integer default 0,
uid varchar(255),
uname varchar(50),
rcontent text,
create_time timestamp
);
comment