当前位置: 首页 > news >正文

Java项目:117SpringBoot动漫论坛网站

博主主页:Java旅途
简介:分享计算机知识、学习路线、系统源码及教程
文末获取源码

117SpringBoot动漫论坛网站

一、项目介绍

动漫论坛网站是由SpringBoot+Mybatis开发的,旅游网站分为前台和后台,前台为用户浏览,后台进行数据管理

后台功能如下:

  • 帖子管理
  • 分类管理
  • 标签管理

前台功能如下:

  • 帖子浏览
  • 帖子搜索
  • 分类查找
  • 标签查找
  • 帖子留言
  • 帖子回复

二、技术框架

  • 后端:SpringBoot,jpa
  • 前端:jquery

三、安装教程

  1. 用idea打开项目

  2. 在idea中配置jdk环境

  3. 配置maven环境并下载依赖

  4. 新建数据库,导入数据库文件

  5. 在application.properties文件中将数据库账号密码改成自己本地的

  6. 启动运行,管理员账号密码 admin/123456

四、项目截图

image-20230719111123820

image-20230719111141974

image-20230719111153596

image-20230719111213126

image-20230719111228179

image-20230719111245143

五、相关代码

IndexController

package com.cartoonbbs.cartoonbbs.web;import com.cartoonbbs.cartoonbbs.servive.ControllerService;
import com.cartoonbbs.cartoonbbs.servive.TagService;
import com.cartoonbbs.cartoonbbs.servive.TypeService;
import com.cartoonbbs.cartoonbbs.vo.CartoonQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;@Controller
public class IndexController {@Autowiredprivate ControllerService controllerService;@Autowiredprivate TypeService typeService;@Autowiredprivate TagService tagService;@GetMapping("/")public String index(@PageableDefault(size = 8,sort = {"updateTime"},direction = Sort.Direction.DESC) Pageable pageable,Model model) {model.addAttribute("page",controllerService.listCartoon(pageable));model.addAttribute("types",typeService.listTypeTop(6));model.addAttribute("tags",tagService.listTagTop(10));model.addAttribute("recommendCartoon",controllerService.listRecommendCartoonTop(8));return "index";}@PostMapping("/search")public String search(@PageableDefault(size = 8,sort = {"updateTime"},direction = Sort.Direction.DESC) Pageable pageable,@RequestParam String query, Model model){model.addAttribute("page",controllerService.listCartoon("%"+query+"%",pageable));model.addAttribute("query",query);return "search";}@GetMapping("/details/{id}")public String details(@PathVariable Long id, Model model) {//model.addAttribute("cartoon",controllerService.getCartoon(id));model.addAttribute("cartoon",controllerService.getAndConvert(id));return "details";}}

LoginController

package com.cartoonbbs.cartoonbbs.web.admin;import com.cartoonbbs.cartoonbbs.dao.UserRepository;
import com.cartoonbbs.cartoonbbs.po.User;
import com.cartoonbbs.cartoonbbs.servive.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;import javax.servlet.http.HttpSession;@Controller
@RequestMapping("/admin")
public class LoginController {@Autowiredprivate UserService userService;@GetMappingpublic  String loginPage(){return "admin/login";}@PostMapping("login")public String login(@RequestParam String username,@RequestParam String password,HttpSession session,RedirectAttributes attributes){User user=userService.checkUse(username,password);if(user!=null){user.setPassword(null);session.setAttribute("user",user);return "admin/index";}else {attributes.addFlashAttribute("message","用户名和密码错误");return "redirect:/admin";}}@GetMapping("/logout")public  String logout(HttpSession session){session.removeAttribute("user");return "redirect:/admin";}
}

大家点赞、收藏、关注、评论啦 、👇🏻点开下方卡片👇🏻关注后回复 104

相关文章:

  • 前端随机验证码安全验证sdk
  • 【EMC专题】浪涌的成因与ICE 61000-4-5标准
  • 训练AI模型:寻找最优参数a和b
  • stm32学习笔记:USART串口通信
  • Day02
  • 远程登陆利器 ssh
  • C# 静态代码织入AOP组件之肉夹馍
  • 剑指offer面试题5 从尾到头打印链表
  • 第二百六十六回
  • Nano文本编辑器:轻松入门,简单实用(适用于Linux)
  • Win系统搭建Elasticsearch实现公网远程访问本地服务
  • 安卓多用户管理之Userinfo
  • 微服务架构的服务注册和发现究竟采用Nacos还是Eureka ?
  • 68、python - 第一版手写代码性能评估
  • Python的核心知识点整理大全66(已完结撒花)
  • 【407天】跃迁之路——程序员高效学习方法论探索系列(实验阶段164-2018.03.19)...
  • FastReport在线报表设计器工作原理
  • Go 语言编译器的 //go: 详解
  • Java教程_软件开发基础
  • JAVA之继承和多态
  • js 实现textarea输入字数提示
  • JWT究竟是什么呢?
  • nginx(二):进阶配置介绍--rewrite用法,压缩,https虚拟主机等
  • NSTimer学习笔记
  • php面试题 汇集2
  • vue-router 实现分析
  • vue学习系列(二)vue-cli
  • 精彩代码 vue.js
  • 如何设计一个比特币钱包服务
  • 一、python与pycharm的安装
  • 赢得Docker挑战最佳实践
  • 在 Chrome DevTools 中调试 JavaScript 入门
  • 正则学习笔记
  • 3月7日云栖精选夜读 | RSA 2019安全大会:企业资产管理成行业新风向标,云上安全占绝对优势 ...
  • 你学不懂C语言,是因为不懂编写C程序的7个步骤 ...
  • ​flutter 代码混淆
  • (DenseNet)Densely Connected Convolutional Networks--Gao Huang
  • (附源码)springboot助农电商系统 毕业设计 081919
  • (四)Android布局类型(线性布局LinearLayout)
  • (淘宝无限适配)手机端rem布局详解(转载非原创)
  • (学习日记)2024.03.12:UCOSIII第十四节:时基列表
  • (转)创业家杂志:UCWEB天使第一步
  • (转)用.Net的File控件上传文件的解决方案
  • .Net各种迷惑命名解释
  • .pub是什么文件_Rust 模块和文件 - 「译」
  • .vimrc php,修改home目录下的.vimrc文件,vim配置php高亮显示
  • :中兴通讯为何成功
  • @Builder用法
  • @RestController注解的使用
  • @transactional 方法执行完再commit_当@Transactional遇到@CacheEvict,你的代码是不是有bug!...
  • [120_移动开发Android]008_android开发之Pull操作xml文件
  • [2]十道算法题【Java实现】
  • [Android Pro] AndroidX重构和映射
  • [AutoSar NVM] 存储架构
  • [AX]AX2012 AIF(四):文档服务应用实例