SSM框架---開發免費小說網站(h5+電腦端)

RightStar_發表於2020-12-10

前言

最近學習ssm框架,藉此設計開發了一個小說網站,後端技術框架SpringMVC+thymeleaf+mybatis+mysql+redis,前端ui和部分程式碼參考了幾個知名小說網站。

設計說明

前端頁面功能設計

  • 前端頁面目錄
頁面路徑描述優先順序
index.html主頁1
rangk.html排行2
category.html分類2
search.html搜尋2
book/bookDetail.html書本詳情2
book/bookView.html書本閱讀2
user/login.html使用者登入1
user/register.html使用者註冊1
user/index.html使用者首頁3
user/account.html賬戶3
user/bookShelf.html書架3
user/history.html使用者歷史3
user/info.html使用者資料3
  • 部分頁面展示(電腦)
    1
    1
    1
    1
    1

1

  • 頁面展示(H5)

1 1
11
1

後端模組設計

  • 檔案目錄
路徑說明路徑說明
com.rightstar.bean實體類com.rightstar.bean.mapper實體類mybatis對映
com.rightstar.controller控制器com.rightstar.filter過濾器
com.rightstar.dao.service.mapperDAO資料服務介面com.rightstar.dao.service.implDAO服務介面實現類
com.rightstar.util工具類
  • 目錄截圖
    11
  • bean目錄及service
    1 1

資料庫設計

表名描述表名描述
MyUser使用者表Books小說表
UserInfo使用者資訊表Account賬戶表
chapter小說目錄Recommend小說推薦表
Rank排行榜表Bookshelf書架
History觀看歷史表
  • 初始化 init.sql檔案
DROP DATABASE IF EXISTS shen;
CREATE DATABASE shen;
use shen;
DROP TABLE IF EXISTS myuser;
DROP TABLE IF EXISTS books;
DROP TABLE IF EXISTS userinfo;
DROP TABLE IF EXISTS account;
DROP TABLE IF EXISTS recommend;
DROP TABLE IF EXISTS ranktable;
DROP TABLE IF EXISTS bookshelf;

create table myuser(
     id int primary key auto_increment,
     name varchar(255) UNIQUE  not null,
     password varchar(255) not null,
     note varchar(20),
     UNIQUE INDEX userName(name)
)Engine=InnoDB default charset utf8;

create table userinfo(
     id int primary key,
     name varchar(255) UNIQUE not null,
     userLevel int default 1 not null,
     userExp int default 1 not null,
     signTime varchar(255),
     phone varchar(255),
     email varchar(255),
     qq varchar(255),
     weixin varchar(255),
     foreign key (id) references myuser (id) ON DELETE CASCADE ON UPDATE CASCADE,
     foreign key (name) references myuser (name) ON DELETE CASCADE ON UPDATE CASCADE
     
)Engine=InnoDB default charset utf8;

create table account(
     id int primary key,
     money float not null default 0,
     goldCoin int not null default 0,
     foreign key(id) references myuser(id) ON DELETE CASCADE ON UPDATE CASCADE
     
)Engine=InnoDB default charset utf8;

-- -- 觸發器連級建立account userinfo
create trigger after_insert_myuser after insert on myuser for each row
begin
    insert into userinfo(id,name,signTime) values(new.id,new.name, DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s'));
    insert into account(id,money,goldcoin) values(new.id,0,0);  
end;


create table books(
     id int primary key,
     bookType varchar(20) not null default '其他',  
     name varchar(255),
     author varchar(50),
     chepterNum int default 0,
     info varchar(255),
     imgURL varchar(255),
     updateTime varchar(255),
     viewNum int default 0,
     downloadNum int default 0,
     fileUrl varchar(255),
     index bookTypeIndex(bookType)
     
)Engine=InnoDB default charset utf8;

create table chapter(
    id int primary key  ,
    chapter LONGTEXT comment '存放書本json章節字串',
    foreign key(id) references books(id) ON DELETE CASCADE ON UPDATE CASCADE
)Engine=InnoDB default charset utf8;




create table recommend(
     id int not null primary key auto_increment,
     bookID int not null,
     bookType varchar(20) not null default '其他',
     foreign key(bookID) references books(id) ON DELETE CASCADE ON UPDATE CASCADE,
     foreign key(bookType) references books(bookType) ON DELETE CASCADE ON UPDATE CASCADE
     
     
)Engine=InnoDB default charset utf8;



create table ranktable(
     id int primary key auto_increment,
     bookID int,
     bookType varchar(20),
     hotNum int not null default 0,
     foreign key(bookID) references books(id) ON DELETE CASCADE ON UPDATE CASCADE,
     foreign key(bookType) references books(bookType) ON DELETE CASCADE ON UPDATE CASCADE
     
     
)Engine=InnoDB default charset utf8;

create table bookshelf(
     id int primary key auto_increment,
     userID int,
     bookID int not null,
     bookType varchar(20) not null default '其他',
     historyFlag int not null default 1,
     foreign key(userID) references myuser(id) ON DELETE CASCADE ON UPDATE CASCADE,
     foreign key(bookID) references books(id) ON DELETE CASCADE ON UPDATE CASCADE,
     foreign key(bookType) references books(bookType) ON DELETE CASCADE ON UPDATE CASCADE
     
)Engine=InnoDB default charset utf8;



後言

程式碼未上傳github,有需要的同學請留言,或聯絡博主,另外歡迎關注博主詳細開發過程的博文更新(*^▽^*)

相關文章