基于SpringBoot+Bootstrap【爱码个人博客系统】附源码

简介: 基于SpringBoot+Bootstrap【爱码个人博客系统】附源码

前言介绍:


随着Internet的广泛应用,动态网页技术也应运而生。本文介绍了应用ASP动态网页技术开发博客系统的设计与实现,

博客系统主要为用户提供发表文章、浏览文章等功能,用户通过Internet 可以发表一些自己撰写的文章以和其他网友进行交流。博客系统主要实现了文章管理的数字化、信息化、智能化,是打破传统报刊、杂志发表文章方式的新尝试。本系统的开发设计实现采用JAVA技术,


系统后台使用SQL数据库,并通过使用JDBC技术访问。本文对博客系统进行整体分析,明确了系统的可行性和用户需求;根据模块化原理,规划设计了系统功能模块;在数据库设计部分,详细说明了系统数据库的结构和数据库的完整性、安全性措施;程序设计则采用面向对象的程序设计思想,提出系统的程序设计思路,对前台与后台功能的程序实现进行了详细论述;系统测试部分,具体分析测试过程中出现的主要问题,并提出了解决方案,实现系统功能。最后,对系统作以客观、全面的评价,并对进一步改进提出了建议。


With the wide application of Internet, dynamic web technology also arises at the historic moment. This paper introduces the design and implementation of the application of ASP dynamic web technology to develop the blog system. The blog system mainly provides users with the functions of publishing articles, browsing articles and so on. Users can publish some of their own articles through the Internet to communicate with other netizens. Blog system mainly realizes the digitalization, information and intelligence of article management, which is a new attempt to break the traditional way of publishing articles in newspapers and magazines. The development and design of this system adopts ASP technology, SQL Server 2008 database is used in the background of the system, and access by using ODBC technology. This article carries on the whole analysis to the blog system, has made clear the feasibility of the system and the user demand; According to the modularization principle, the functional modules of the system are planned and designed. In the database design part, detailed description of the system database structure and database integrity, security measures; The program design adopts object-oriented program design idea, puts forward the system program design idea, and discusses the program realization of the foreground and background function in detail. The system test part, the specific analysis of the test process of the main problems, and put forward solutions to achieve system functions. Finally, an objective and comprehensive evaluation of the system is made, and some suggestions for further improvement are put forward.


一、行业发展原因分析

个人博客能让个人在互联网上表达自己的心声。这是一个收集和共享任何感兴趣的事物的地方一可以是政治评论、个人日记或是指向您想记住的网站的链接。


它是一种简单有效的提供网络用户之间进行 在线交流的网络平台,通过个人博客可以结交更多的朋友, 表达更多的想法,它随时可以发布日志,方便快捷。个人博客作为一种新的表达方式,它传播的不仅是情绪,还包括大量的智慧、意见和思想。


从某种意义上说,它也是一种新的文化现象,个人博客的出现和繁荣,真正凸现了网络的知识价值,标志着互联网发展开始步入更高的阶段这样不仅促进了学习,更重要的是反映了一个人的在思想上的成长过程。访客可以直接在个人博客上留言,如提出问题或意见。通过研究开发本系统,使我们了解当今个人博客发展的最新动态,人博客对 以及个整个社会的影响力。同时,可以使我们掌握个人网站开发的基本方法和技术,为以后的实际开发莫定基础。

系统设计:

该项目是基于SpringBoot+Bootstrap【爱码个人博客系统】,下面做了功能和相关技术的描述,适合出入职场和即将进入职场的各位,如有问题欢迎留言。

系统总共分为几个大的模块。

博客系统分为两大模块:

1.博客前台页面,游客可以查看博主发表的文章,也可以注册后登录对博主文章进行评论

2.博客系统后台管理,管理员登录后可以发表,删除,修改文章,也可以对游客信息进行查看,修改等操作

运行环境

JDK8、Tomcat8、MySQL5.7、IntelliJ IDEA、Maven

  • 核心技术:

Spring Boot2、MyBatis、Bootstrap、jQuery


账号:

如果使用原配置及数据库文件,可以使用一下方式登录

首页:<http://127.0.0.1:8080/>

账号:zhangsan zhangsan


后台:http://127.0.0.1:8080/admin/login

账号:admin admin

功能截图:

代码实现:

package com.lee.common;

import java.util.ArrayList;
import java.util.List;

/**
 * 表格数据存储对象
 * 默认作为bootstrap表格对应的数据结构存储对象
 * author:lee
 */
public class DataGrid {
    private Long total = Long.valueOf(0);
    private List rows = new ArrayList();

    public Long getTotal() {
        return total;
    }
    public void setTotal(Long total) {
        this.total = total;
    }
    public List getRows() {
        return rows;
    }
    public void setRows(List rows) {
        this.rows = rows;
    }
}
package com.lee.controller.admin;


import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lee.common.DataGrid;
import com.lee.common.DateTimeUtil;
import com.lee.common.Message;
import com.lee.entity.Admin;
import com.lee.entity.Article;
import com.lee.service.ArticleService;
import com.lee.service.CateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lee
 * @since 2020-02-22
 */
@Controller
@RequestMapping("/admin/article")
public class ArticleController extends BasicController {
    @Autowired
    ArticleService articleService;
    @Autowired
    CateService cateService;
    @GetMapping("list")
    public String list(){
        return "admin/article/list";
    }
    @PostMapping("findList")
    @ResponseBody
    public DataGrid findList(@RequestBody JSONObject jsonObject){
        Map<String, Object> searchParams = (HashMap<String, Object>) jsonObject.get("search");
        int offset = "".equals(jsonObject.getString("offset")) ? 0 : jsonObject.getIntValue("offset");
        int size = "".equals(jsonObject.getString("limit")) ? 10 : jsonObject.getIntValue("limit");

        IPage<Map<String, Object>> page = articleService.getPageInfo(searchParams, offset, size);

        DataGrid result = new DataGrid();
        result.setTotal(page.getTotal());
        result.setRows(page.getRecords());
        return result;
    }
    @GetMapping("add")
    public String add(Model model) {
        model.addAttribute("cateInfos",cateService.getList());
        return "admin/article/add";
    }

    @PostMapping("add")
    @ResponseBody
    public Message doAdd(@Validated Article article, HttpServletRequest request){
        try {
            Admin admin = getCurrentUser(request);
            if(admin != null) {
                if(article.getIsTop() == null) {
                    article.setIsTop(0);
                }
                article.setCreateTime(DateTimeUtil.nowTimeStr());
                article.setMemberId(admin.getId());
                articleService.save(article);
                return Message.success("文章添加成功!");
            } else {
                return Message.fail("登录超时,请重新登录!",null,"/admin/login");
            }
        } catch (Exception e) {
            return Message.fail("文章数据保存异常,保存失败!");
        }

    }
    @PostMapping("top")
    @ResponseBody
    public Message top(@RequestParam(value = "id")Integer id,@RequestParam(value = "istop")Integer istop){
        try{
           Article article =  articleService.getById(id);
           if(article != null) {
               if(istop == 1) {
                   article.setIsTop(0);
               } else if(istop == 0) {
                   article.setIsTop(1);
               }
               articleService.updateById(article);
               return Message.success("操作成功!");
           } else {
               return Message.fail("文章不存在或已被删除,操作失败!");
           }
        } catch (Exception e) {
            return Message.fail("文章推荐操作处理异常!");
        }
    }
    @GetMapping("/update/{id}")
    public String update(@PathVariable Integer id,Model model){
       Article article =  articleService.getById(id);
        model.addAttribute("cateInfos",cateService.getList());
        model.addAttribute("articleInfo",article);
       return "admin/article/update";
    }
    @PostMapping("/update")
    @ResponseBody
    public Message doUpdate(@Validated Article article){
        try{
            Article articleInfo = articleService.getById(article.getId());
            if(articleInfo != null) {
                if(article.getIsTop() == null) {
                    articleInfo.setIsTop(0);
                } else {
                    articleInfo.setIsTop(article.getIsTop());
                }

                articleInfo.setTitle(article.getTitle());
                articleInfo.setAuthorname(article.getAuthorname());
                articleInfo.setTags(article.getTags());
                articleInfo.setArtdesc(article.getArtdesc());
                articleInfo.setContent(article.getContent());
                articleInfo.setCateId(article.getCateId());
                articleInfo.setUpdateTime(DateTimeUtil.nowTimeStr());
                articleService.updateById(articleInfo);
                return Message.success("文章修改成功!");
            } else {
                return Message.fail("文章不存在或已被删除!");
            }
        } catch (Exception e) {
            return Message.fail("文章修改保存异常,操作失败!");
        }
    }
    @PostMapping("delete")
    @ResponseBody
    public Message delete(@RequestParam(value = "ids") List<Integer> ids) {
        try {
            for (int id : ids) {
                articleService.deleteArticleAndCommentById(id);
            }
            return Message.success("文章删除成功");
        } catch (Exception e) {
            return Message.fail("文章删除异常!");
        }
    }

}

package com.lee.controller.admin;

import com.lee.entity.Article;
import com.lee.entity.Member;
import com.lee.service.ArticleService;
import com.lee.service.CommentService;
import com.lee.service.MemberService;
import com.sun.org.apache.xpath.internal.operations.Mod;
import org.apache.catalina.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.nio.channels.MembershipKey;

@Controller
@RequestMapping("/admin")
public class HomeController {
    @Autowired
    MemberService memberService;
    @Autowired
    ArticleService articleService;
    @Autowired
    CommentService commentService;

    @RequestMapping("home")
    public String home(Model model){
        int memberCount = memberService.count();
        int articleCount = articleService.count();
        int commentCount = commentService.count();
        model.addAttribute("memberCount",memberCount);
        model.addAttribute("articleCount",articleCount);
        model.addAttribute("commentCount",commentCount);
        return "admin/home";
    }

    /**
     * 退出管理
     * @return
     */
    @RequestMapping("logout")
    public String logout(HttpServletRequest request){
        request.getSession().removeAttribute("admin");
        if(request.getSession().getAttribute("admin") != null) {
            //ToDO session清空失败,可以跳转到退出失败页面
        }
//        return "redirect:/admin/login";
        return "admin/login";
    }
}

package com.lee.controller.admin;


import com.lee.common.DateTimeUtil;
import com.lee.common.Message;
import com.lee.entity.Syssetting;
import com.lee.service.SyssettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import java.sql.Time;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lee
 * @since 2020-02-24
 */
@Controller
@RequestMapping("/admin/syssetting")
public class SyssettingController {
    @Autowired
    SyssettingService syssettingService;

    @GetMapping("add")
    public String add(Model model){
        Syssetting syssetting =  syssettingService.getById(1);
        if(syssetting != null) {
            model.addAttribute("syssetting",syssetting);
        }
        return "admin/syssetting/add";
    }
    @PostMapping("add")
    @ResponseBody
    public Message doAdd(@Validated Syssetting syssetting){
        try{
            Syssetting syssettingInfo = syssettingService.getById(1);
            if (syssettingInfo == null) {
                syssettingInfo = new Syssetting();
                syssettingInfo.setCopyright(syssetting.getCopyright());
                syssettingInfo.setWebname(syssetting.getWebname());
                syssettingInfo .setCreateTime(DateTimeUtil.nowTimeStr());
                syssettingInfo.setSign(syssetting.getSign());
                syssettingService.save(syssettingInfo);
            } else {
                syssettingInfo.setCopyright(syssetting.getCopyright());
                syssettingInfo.setWebname(syssetting.getWebname());
                syssettingInfo .setUpdateTime(DateTimeUtil.nowTimeStr());
                syssettingInfo.setSign(syssetting.getSign());
                syssettingService.updateById(syssettingInfo);
            }
            return Message.success("系统设置保存成功");
        } catch (Exception e) {
            return Message.fail("系统设置保存异常!");
        }
    }
}

论文参考:

目录
相关文章
|
12月前
|
前端开发 Java 关系型数据库
基于Java+Springboot+Vue开发的鲜花商城管理系统源码+运行
基于Java+Springboot+Vue开发的鲜花商城管理系统(前后端分离),这是一项为大学生课程设计作业而开发的项目。该系统旨在帮助大学生学习并掌握Java编程技能,同时锻炼他们的项目设计与开发能力。通过学习基于Java的鲜花商城管理系统项目,大学生可以在实践中学习和提升自己的能力,为以后的职业发展打下坚实基础。技术学习共同进步
721 7
|
11月前
|
JavaScript 前端开发 Java
制造业ERP源码,工厂ERP管理系统,前端框架:Vue,后端框架:SpringBoot
这是一套基于SpringBoot+Vue技术栈开发的ERP企业管理系统,采用Java语言与vscode工具。系统涵盖采购/销售、出入库、生产、品质管理等功能,整合客户与供应商数据,支持在线协同和业务全流程管控。同时提供主数据管理、权限控制、工作流审批、报表自定义及打印、在线报表开发和自定义表单功能,助力企业实现高效自动化管理,并通过UniAPP实现移动端支持,满足多场景应用需求。
1066 1
|
前端开发 Java 物联网
智慧班牌源码,采用Java + Spring Boot后端框架,搭配Vue2前端技术,支持SaaS云部署
智慧班牌系统是一款基于信息化与物联网技术的校园管理工具,集成电子屏显示、人脸识别及数据交互功能,实现班级信息展示、智能考勤与家校互通。系统采用Java + Spring Boot后端框架,搭配Vue2前端技术,支持SaaS云部署与私有化定制。核心功能涵盖信息发布、考勤管理、教务处理及数据分析,助力校园文化建设与教学优化。其综合性和可扩展性有效打破数据孤岛,提升交互体验并降低管理成本,适用于日常教学、考试管理和应急场景,为智慧校园建设提供全面解决方案。
665 70
|
11月前
|
供应链 JavaScript BI
ERP系统源码,基于SpringBoot+Vue+ElementUI+UniAPP开发
这是一款专为小微企业打造的 SaaS ERP 管理系统,基于 SpringBoot+Vue+ElementUI+UniAPP 技术栈开发,帮助企业轻松上云。系统覆盖进销存、采购、销售、生产、财务、品质、OA 办公及 CRM 等核心功能,业务流程清晰且操作简便。支持二次开发与商用,提供自定义界面、审批流配置及灵活报表设计,助力企业高效管理与数字化转型。
826 2
ERP系统源码,基于SpringBoot+Vue+ElementUI+UniAPP开发
|
10月前
|
机器学习/深度学习 数据采集 人机交互
springboot+redis互联网医院智能导诊系统源码,基于医疗大模型、知识图谱、人机交互方式实现
智能导诊系统基于医疗大模型、知识图谱与人机交互技术,解决患者“知症不知病”“挂错号”等问题。通过多模态交互(语音、文字、图片等)收集病情信息,结合医学知识图谱和深度推理,实现精准的科室推荐和分级诊疗引导。系统支持基于规则模板和数据模型两种开发原理:前者依赖人工设定症状-科室规则,后者通过机器学习或深度学习分析问诊数据。其特点包括快速病情收集、智能病症关联推理、最佳就医推荐、分级导流以及与院内平台联动,提升患者就诊效率和服务体验。技术架构采用 SpringBoot+Redis+MyBatis Plus+MySQL+RocketMQ,确保高效稳定运行。
738 0
|
小程序 Java 关系型数据库
weixin117新闻资讯系统设计+springboot(文档+源码)_kaic
本文介绍了一款基于微信小程序的新闻资讯系统,涵盖其开发全过程。该系统采用Java的SSM框架进行后台管理开发,使用MySQL作为本地数据库,并借助微信开发者工具确保稳定性。管理员可通过个人中心、用户管理等功能模块实现高效管理,而用户则能注册登录并查看新闻与视频内容。系统设计注重可行性分析(技术、经济、操作),强调安全性与数据完整性,界面简洁易用,功能全面,极大提升了信息管理效率及用户体验。关键词包括基于微信小程序的新闻资讯系统、SSM框架和MYSQL数据库。
|
小程序 JavaScript Java
基于SpringBoot的智慧停车场微信小程序源码分享
智慧停车场微信小程序主要包含管理端和小程序端。管理端包括停车场管理,公告信息管理,用户信息管理,预定信息管理,用户反馈管理等功能。小程序端包括登录注册,预约停车位,停车导航,停车缴费,用户信息,车辆信息,钱包充值,意见反馈等功能。
767 5
基于SpringBoot的智慧停车场微信小程序源码分享
|
Java Spring
SpringBoot自动配置源码调试
SpringBoot自动配置源码调试
801 0
|
Java Spring
SpringBoot自动配置源码调试
SpringBoot自动配置源码调试之前对SpringBoot的自动配置原理进行了较为详细的介绍(https://www.cnblogs.com/stm32stm32/p/10560933.html),接下来就对自动配置进行源码调试,探究下这个配置过程中各参数的情况。
1987 0
|
6月前
|
JavaScript Java 关系型数据库
基于springboot的项目管理系统
本文探讨项目管理系统在现代企业中的应用与实现,分析其研究背景、意义及现状,阐述基于SSM、Java、MySQL和Vue等技术构建系统的关键方法,展现其在提升管理效率、协同水平与风险管控方面的价值。