当前位置: 首页 > 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

http://www.lryc.cn/news/278188.html

相关文章:

  • Jenkins基础篇--添加节点
  • 【C++】手撕 list类(包含迭代器)
  • @Autowired 和 @Resource 的区别是什么?
  • 栈和排序.
  • springboot 多数据源怎么配置在控制台的sql打印日志
  • 【WinForms 窗体】常见的“陷阱”
  • Android readelf 工具查找函数符号
  • MySQL-索引回顾
  • 重新认识Elasticsearch-一体化矢量搜索引擎
  • 【附源码】基于SSM框架的房屋租赁系统的设计与实现
  • [SpringBoot]如何在一个普通类中获取一个Bean
  • [ERROR] 不再支持目标选项 5。请使用 7 或更高版本
  • EasyMR:为 AI 未来赋能,打造弹性大数据引擎的革命
  • C //练习 4-10 另一种方法是通过getline函数读入整个输入行,这种情况下可以不使用getch与ungetch函数。请运用这一方法修改计算器程序。
  • 竞赛保研 基于深度学习的行人重识别(person reid)
  • Ncast盈可视 高清智能录播系统 IPSetup.php信息泄露+RCE漏洞复现(CVE-2024-0305)
  • GO语言Context的作用
  • 金和OA C6 upload_json 任意文件上传漏洞
  • 大模型学习第四课
  • Code Runner使用外部控制台,运行结束后等待用户输入
  • IC设计的前端和后端是如何区分的?
  • Unity WebView 中文输入支持
  • x-cmd pkg | trdsql - 能对 CSV、LTSV、JSON 和 TBLN 执行 SQL 查询的工具
  • Camunda Spin
  • strlen/Memcpy_s/strncasecmp
  • 水经微图安卓版APP正式上线!
  • 数据结构第十二弹---堆的应用
  • [NSSRound#3 Team]This1sMysql
  • Android 通知简介
  • QT开发 2024最新版本优雅的使用vscode开发QT