Skip to content

Commit

Permalink
2021-5-27 增加电子书快照表,生成持久层代码
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhiZDK committed May 27, 2021
1 parent bd9dc42 commit 3999ec2
Show file tree
Hide file tree
Showing 6 changed files with 1,029 additions and 2 deletions.
16 changes: 15 additions & 1 deletion doc/all.sql
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,18 @@ create table `user` (
unique key `login_name_unique` (`login_name`)
) engine=innodb default charset=utf8mb4 comment='用户';

insert into `user` (id, login_name, name, password) values (1, 'test', '测试', 'test');
insert into `user` (id, login_name, name, password) values (1, 'test', '测试', 'test');

-- 电子书快照表
drop table if exists `ebook_snapshot`;
create table `ebook_snapshot` (
`id` bigint auto_increment not null comment 'id',
`ebook_id` bigint not null default 0 comment '电子书id',
`date` date not null comment '快照日期',
`view_count` int not null default 0 comment '阅读数',
`vote_count` int not null default 0 comment '点赞数',
`view_increase` int not null default 0 comment '阅读增长',
`vote_increase` int not null default 0 comment '点赞增长',
primary key (`id`),
unique key `ebook_id_date_unique` (`ebook_id`, `date`)
) engine=innodb default charset=utf8mb4 comment='电子书快照表';
92 changes: 92 additions & 0 deletions src/main/java/com/wzy/wiki/domain/EbookSnapshot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.wzy.wiki.domain;

import java.util.Date;

public class EbookSnapshot {
private Long id;

private Long ebookId;

private Date date;

private Integer viewCount;

private Integer voteCount;

private Integer viewIncrease;

private Integer voteIncrease;

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public Long getEbookId() {
return ebookId;
}

public void setEbookId(Long ebookId) {
this.ebookId = ebookId;
}

public Date getDate() {
return date;
}

public void setDate(Date date) {
this.date = date;
}

public Integer getViewCount() {
return viewCount;
}

public void setViewCount(Integer viewCount) {
this.viewCount = viewCount;
}

public Integer getVoteCount() {
return voteCount;
}

public void setVoteCount(Integer voteCount) {
this.voteCount = voteCount;
}

public Integer getViewIncrease() {
return viewIncrease;
}

public void setViewIncrease(Integer viewIncrease) {
this.viewIncrease = viewIncrease;
}

public Integer getVoteIncrease() {
return voteIncrease;
}

public void setVoteIncrease(Integer voteIncrease) {
this.voteIncrease = voteIncrease;
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", ebookId=").append(ebookId);
sb.append(", date=").append(date);
sb.append(", viewCount=").append(viewCount);
sb.append(", voteCount=").append(voteCount);
sb.append(", viewIncrease=").append(viewIncrease);
sb.append(", voteIncrease=").append(voteIncrease);
sb.append("]");
return sb.toString();
}
}
Loading

0 comments on commit 3999ec2

Please sign in to comment.