This is the 11th day of my participation in the August More Text Challenge

A blog, also known as a weblog, blog, or blog, is a web site that posts new articles from time to time, usually by an individual. Posts on blogs are usually arranged in reverse order from new to old, according to when they were posted. Many blogs provide commentary or news focused on specific topics, while others serve as more personal journals. A typical blog combines text, images, links to other blogs or websites, and other media related to the topic. Allowing readers to leave comments in an interactive way is an important element of many blogs. Most blogs are text-based, but there are still blogs that focus on art, photography, video, music, podcasts, and more. Blogs are part of social media networks. Blogs embrace the free spirit of personal websites, but combine new ways of inspiring creativity to make them more open and constructive. As a new means of expression, it spreads not only emotions, but also a great deal of wisdom, opinions and ideas. In a sense, it is also a new cultural phenomenon. The emergence and prosperity of blog really highlights the knowledge value of the Internet, marking the beginning of the Development of the Internet into a higher stage.

Demand analysis

This system mainly aims at the blog forum administrator to carry on the effective management to the forum information, the number of users, the number of links, the number of articles to increase, delete, change and check, can analyze the recent development of the forum through data statistics, but also can manage the interface of the forum through the category change. Visitors contribute to the forum by Posting articles, managing articles, and Posting their own thoughts.

User management.

The module is operated by the administrator, the user name of all users, mailbox, creation time, user status, listed in a table, convenient for the administrator to add, delete, modify, query user information, can also be deleted in batches.

Article management.

This module is the administrator and the user can operate, they can delete the existing articles, modify, query operations. They can also add a section in the article, article creation.

Link management.

This module adds links of friendship websites on the right side of the forum page to help each other. It also consists of two small sections, link addition and link list, which can only be viewed by the administrator.

Log management.

The log module is the access record of all users including the administrator forum to the background management system, which can be viewed by the administrator and can be queried, deleted and deleted in batches.

Data management.

The data module is a tool for analyzing the current situation of the website which can only be viewed by the administrator. It is divided into article publishing data and article browsing data.

System management.

There is a front column list below this module, which is the classification category displayed above the front forum. It has the functions of adding, deleting, modifying and querying by the administrator.

Functional analysis

User login registration:

Enter the account password to log in. The background determines whether the account is a common user or an administrator. Those who are not registered can enter the registration page to register

Blog Homepage:

After entering the home page, users can view the categories of blog content, click to view details, jump to hyperlinks on the right side, and log in and register

Article Details:

Comment interaction:

Blog details comment interactive

Background User management:

Adding a user:

Background article management:

Background link management:

Background log management:

Background data management:

Article data “published data and traffic data” monthly statistics show

Background menu management:

Partial table design

Use Mysql database, INNODB storage engine and UTF8 encoding format.

The users table

CREATE TABLE 'NewTable' (' id 'int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', 'username' varchar(255) CHARACTER SET utf8 COLLATE UTf8_general_ci NOT NULL COMMENT 'username', 'email' varchar(255) CHARACTER SET utf8 COLLATE UTf8_general_ci NULL DEFAULT NULL COMMENT 'email' varchar(255) CHARACTER SET utf8 COLLATE UTf8_general_ci NULL DEFAULT NULL COMMENT ' Varchar (255) CHARACTER SET utf8 COLLATE UTf8_general_ci NOT NULL COMMENT 'password', 'status' varchar(255) CHARACTER SET utf8 COLLATE UTf8_general_CI NULL DEFAULT '2' COMMENT' Status 0: normal 1: deleted 2: disabled or disabled ', 'Avatar' VARCHar (64) CHARACTER SET utf8 COLLATE UTf8_general_ci NULL DEFAULT NULL COMMENT 'avatar' varchar(64) CHARACTER SET utf8 COLLATE UTf8_general_ci NULL DEFAULT NULL COMMENT 'avatar', 'code' varchar(64) CHARACTER SET utf8 COLLATE UTf8_general_ci NULL DEFAULT NULL COMMENT 'iD', 'create_date' datetime NULL DEFAULT NULL COMMENT 'add time', 'create_by' varchar(64) CHARACTER SET utf8 COLLATE UTf8_general_ci NULL DEFAULT NULL COMMENT 'add user id', 'update_date' datetime NULL DEFAULT NULL COMMENT 'update time', 'update_by' varchar(64) CHARACTER SET utf8 COLLATE UTf8_general_ci NULL DEFAULT NULL COMMENT 'update_by' varchar(64) CHARACTER SET utf8 COLLATE UTf8_general_ci NULL DEFAULT NULL COMMENT 'update_by' 'remark' varchar(255) CHARACTER SET utf8 COLLATE UTf8_general_ci NULL DEFAULT NULL COMMENT 'remarks', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci AUTO_INCREMENT=21 ROW_FORMAT=DYNAMIC ;Copy the code

The article table

CREATE TABLE `NewTable` (
`id`  int(64) NOT NULL AUTO_INCREMENT ,
`type_id`  int(64) NOT NULL ,
`title`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`content`  longtext CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`create_date`  datetime NULL DEFAULT NULL ,
`create_by`  varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`update_date`  datetime NULL DEFAULT NULL ,
`update_by`  varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`status`  varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL ,
`read`  varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' ,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
AUTO_INCREMENT=24
ROW_FORMAT=DYNAMIC
;
Copy the code

Comment interactive table

CREATE TABLE `NewTable` (
`id`  int(11) NULL DEFAULT NULL ,
`news_id`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL ,
`content`  mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL ,
`create_date`  date NULL DEFAULT NULL ,
`create_by`  int(11) NULL DEFAULT NULL ,
`update_time`  date NULL DEFAULT NULL ,
`update_by`  int(11) NULL DEFAULT NULL ,
`status`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL 
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci
ROW_FORMAT=DYNAMIC
;
Copy the code

Partial code implementation

The function of this project is relatively simple, and the technology we use is also very familiar with the technology, mainly springboot, SpringMVC, mybatis before jquery, Layui, HTML and CSS and other basic styles. Take the login as a complete example, starting with writing the front-end static page and sending the login request

<div class="wrapper"> <div class="froyo-frame login-body"> <div class="admin-face"> <div class="face-img"> <img SRC ="${ctxStatic}/images/editor. PNG "Alt ="logo"> </div> </div> <h1 class="admin-login-tittle">" Starting now, "</h1> <div class="admin-login-form"> <form class="form" action="${CTX}/login" method="post" Autocomplete ="off"> <div class="admin-name"><input name="username" type="text" placeholder=" username" ></div> <div Class ="admin-password"><input name="password" type="password" placeholder=" password" Type = "submit" id = "login - button" > login < / button > < / div > < / form > <! <a href=""><img SRC ="${ctxStatic}/images/ qqlogin. PNG "style="width: 50px; margin: 10px" onclick="loginQQ()"></a> <img src="${ctxStatic}/images/weChatLogin.png" style="width: 50px; margin: 10px"> <img src="${ctxStatic}/images/weboLogin.png" style="width: 50px; margin: 10 px "> -- > < div class =" admin - button "> < a id =" login - button "href =" ${CTX} / index "> homepage < / a > < / div > < / div > < script type="text/javascript" src="${ctxStatic}/plugins/layui/layui.js"></script> <script type="text/javascript"> layui.use('layer', function() { var $ = layui.jquery, layer = layui.layer; //login-button click event.. $('#login-button').click(function (event) { event.preventDefault(); if (! $(" input [name = username] "). The val ()) {layer. MSG (" user name cannot be empty "); return false; } else if (! $(" input [name = "] "). The val ()) {layer. MSG (" password cannot be empty "); return false; } else { $('form').fadeOut(500); $('.wrapper').addClass('form-success'); $('.form').submit(); }}); </script> </body> </html>Copy the code

After receiving the login request from the front end, the background Controller verifies the parameters, verifies the user name, password and user role transmitted from the front end, invokes the loginController. login method to verify user login, queries whether the current account and password of the database are correct, and returns the status code to the front end and the front end Status code for relative page jumps and data effects.

/** * @param user * @param map * @return */ @postmapping ("/login") public String login(user user, ModelMap map) { if (user ! = null) { if (StringUtils.isBlank(user.getUsername()) || StringUtils.isBlank(user.getPassword())) { return Views.LOGIN; } AuthenticationToken token = new UsernamePasswordToken(user.getUsername(), user.getPassword(), true); If (token == null) {map.put("message", "username or password error "); return Views.LOGIN; } // Remember me ((UsernamePasswordToken) token). SetRememberMe (true); try { SecurityUtils.getSubject().login(token); return Views.REDIRECT_ADMIN; } Catch (AuthenticationException e) {if (instanceof UnknownAccountException) {map.put("message", "user does not exist "); } else if (e instanceof LockedAccountException) {map.put("message", "account not activated "); map.put("status", 2); map.put("user", user); } else if (e instanceof DisabledAccountException) {map.put("message", "account not enabled "); } e.printStackTrace(); Map. put("message", "user authentication failed "); } return Views.LOGIN; } else {map.put("message", "unknown exception "); return Views.LOGIN; }}}Copy the code

Subscribe to download the source code 

In general, this project is relatively simple and excellent, suitable for beginners as a reference for course design and graduation design

In addition, we need white piao Java learning materials including “JVM, Netty, Mysql, Mybatis, Redis, Dubbo, Nginx, design mode” and other 10G information package, you can see my home page or private blog

Clocking Java projects updated 11/100 days

Everyone can like, favorites, follow, comment on me, the following vote can also be actively interactive yo