0
点赞
收藏
分享

微信扫一扫

IP地址c++题解

Jonescy 2023-09-04 阅读 14

【JavaEE】进阶 · 个人博客系统(1)

1. 使用Spring全家桶 + MyBatis框架进行开发

在这里插入图片描述

在这里插入图片描述

2. 页面

旧版本博客系统:

  1. 【JavaEE】前后端综合项目-博客系统(下)_s:103的博客-CSDN博客
  2. 【JavaEE】前后端综合项目-博客系统(下)_s:103的博客-CSDN博客

而进阶版的博客系统有以下几个页面,并总结需要用到的数据:

2.1 登录页

用户信息:

  1. 用户名
  2. 密码
  3. 头像

2.2 注册页

在这里插入图片描述

用户信息:

  1. 昵称

  2. 代码仓库链接

  3. 密码

  4. 头像

  5. 自动生成的用户名和id

2.3 详情页

在这里插入图片描述

用户信息:

  1. 博文作者id
  2. 代码仓库链接
  3. 文章总数

博文信息:

  1. 作者id
  2. 文章id
  3. 标题
  4. 时间
  5. 正文
  6. 阅读量

2.4 我的博客列表页

在这里插入图片描述

用户信息:

  1. 博文作者id
  2. 代码仓库链接
  3. 文章总数

博文信息:

  1. 标题
  2. 时间
  3. 摘要

3.5 所有人的博客列表页

在这里插入图片描述

博文信息:

  1. 作者id
  2. 文章id
  3. 作者头像
  4. 标题
  5. 时间
  6. 摘要

3.6 添加博客页

在这里插入图片描述

用户信息:

  1. 用户id

博文信息:

  1. 作者id,即当前用户id
  2. 标题
  3. 正文
  4. 创建时间,即提交时的时间
  5. 自动生成的文章id

3.7 修改文章页

在这里插入图片描述

用户信息:

  1. 用户id

博文信息:

  1. 文章id
  2. 作者id,即当前用户id
  3. 标题
  4. 正文
  5. 更新时间,即提交时的时间

新增页面的实现,项目功能升级,项目的亮点,我们会渗透一个页面一个页面的实现讲解中提到,最终进行总结!

  • 前端画面显示以及代码逻辑,后续根据相应的功能和逻辑进行调整以及补充即可
  • 甚至可能进行较大的修改!
  • 不过不需要纠结太多前端的东西~

3. 将静态资源部署到项目里

静态资源都是部署到resource的static目录里的:

在这里插入图片描述

4. 数据库设计

根据第2点的分析,总结出

一个数据库:

  • myblog_system
-- 创建数据库
drop database if exists myblog_system;
create database myblog_system charset=utf8;

-- 使用数据数据
use myblog_system;

配置文件修改:

在这里插入图片描述

两张表:

  1. userinfo 用户表
  2. articleinfo 博文表

4.1 userinfo表

  1. id,用户id
  2. username,用户名
  3. name, 昵称
  4. password,密码
  5. photo,头像
  6. git,代码仓库链接
  7. createtime,创建时间
  8. updatetime,更新时间
  9. state 状态(预留字段)
-- 创建表[用户表]
drop table if exists  userinfo;
create table userinfo(
    id int primary key auto_increment,
    username varchar(15) not null unique,
    name varchar(100) not null,
    password varchar(65) not null,
    photo varchar(500) default '',
    git varchar(500) default '',
    createtime timestamp default current_timestamp,
    updatetime timestamp default current_timestamp,
    `state` int default 1
);

4.2 articleinfo表

  1. id,文章id
  2. title,标题
  3. content,正文
  4. summary,摘要
  5. createtime,创建时间
  6. updatetime,更新时间
  7. uid,作者id
  8. photo,作者头像
  9. rcount,阅读量
  10. state 状态(预留字段)
-- 创建文章表
drop table if exists  articleinfo;
create table articleinfo(
    id int primary key auto_increment,
    title varchar(100) not null,
    content text not null,
    summary text not null,
    createtime timestamp default current_timestamp,
    updatetime timestamp default current_timestamp,
    uid int not null,
    photo varchar(500) default '',
    rcount int not null default 1,
    `state` int default 1
);

5. 创建实体类

5.1 model.UserInfo类

@Data
public class UserInfo {
    private int id;
    private String username;
    private String name;
    private String password;
    private String photo;
    private String git;
    private LocalDateTime createtime;
    private LocalDateTime updatetime;
    private int state;
}

5.2 model.ArticleInfo类

@Data
public class ArticleInfo {
    private int id;
    private String title;
    private String content;
    private String summary;
    private LocalDateTime createtime;
    private LocalDateTime updatetime;
    private int uid;
    private String photo;
    private int rcount;
    private int state;
}

5.3 扩展类UserInfoVO与ArticleInfoVO

@Data
public class UserInfoVO extends UserInfo {
    
}
@Data
public class ArticleInfoVO extends ArticleInfo {

}

对于一些特殊情况,特殊处理,可以在这里面增加属性,不是增加在原类里,因为数据库的表并没有变化,只不过这个对象要附带一些东西~

  • 到时候遇到再说

在这里插入图片描述



举报

相关推荐

0 条评论