基于javaweb的SpringBoot宠物平台系统(java+springboot+mybaits+vue+elementui+mysql)

运行环境

Java≥8、MySQL≥5.7、Node.js≥14

开发工具

后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可

❗没学过node.js的不要搞前后端分离项目

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

411524372608

421524372608

431524372608

441524372608

451524372608

461524372608

471524372608

481524372608

491524372608

501524372608

基于javaweb的SpringBoot宠物平台系统(java+springboot+mybaits+vue+elementui+mysql)

项目介绍

基于Spring+Boot的宠物平台设计与实现

本系统分为前后台,包含管理员、用户两个角色。

管理员角色主要功能为:

登录、个人中心、用户管理、宠物分类管理、宠物科普管理、宠物信息管理、领养申请管理、爱心捐赠管理、捐赠信息管理、宠物救助管理、宠物论坛、社区留言板、系统管理等功能;

用户:登录、注册、个人中心管理、美食鉴赏管理、好友管理、收藏管理、个人信息管理、美食鉴赏发布与管理

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。

2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;

3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;

4.数据库:MySql 5.7/8.0版本均可;

5.是否Maven项目:是;

技术栈

后端:SpringBoot+Mybaits-Plus

前端:Vue+elementui

使用说明

项目运行:

  1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;

  2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;

  3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;

  4. 运行项目,在浏览器中输入地址:

前台地址:

http://localhost:8080/springboot3148x/front/dist/index.html

用户: 用户账号1 密码 123456

后台地址

http://localhost:8080/springboot3148x/admin/dist/index.html#/login

管理员:admin 密码:admin

用户: 用户账号1 密码:123456

注意项目文件路径中不能含有中文、空格、特殊字符等,否则图片会上传不成功。

宠物信息展示:

首页展示:

爱心捐赠页面展示:

宠物科普展示:

首页展示页面:

宠物论坛页面展示:

宠物科普页面展示:

 感谢公告页面展示:

社区留言板页面:

注册页面展示:

后台管理员控制层:

@Controller

@RequestMapping(“admin/user”)

public class adminUserController {

@Autowired

UserService userService;

@Autowired

PostMapper postMapper;

@Autowired

ShareMapper shareMapper;

@Autowired

SponsorMapper sponsorMapper;

@GetMapping(“”)

public String write(Model model, HttpSession session,

@RequestParam(value = “page”, defaultValue = “1”) int page,

@RequestParam(value = “limit”, defaultValue = “12”) int limit){

model.addAttribute(“info”,userService.queryUserAll(page,limit));

return “admin/admin_user”;

@GetMapping(“delete”)

public String deleteUser(@RequestParam(“userId”) int userId){

User user=userService.queryUserById(userId);

if(user.getUserPhone().equals(“1111”)){

return “redirect:/admin/user”;

postMapper.deletePostByPhone(user.getUserPhone());

shareMapper.deleteShareByPhone(user.getUserPhone());

sponsorMapper.deleteSponsorByPhone(user.getUserPhone());

userService.deleteUser(userId);

return “redirect:/admin/user”;

详情管理控制层: 

@Controller

@RequestMapping(“details”)

public class detailsController {

@Autowired

IndexService indexService;

@Autowired

NoticeService noticeService;

@Autowired

DetailsService detailsService;

@Autowired

PostService postService;

@Autowired

SponsorService sponsorService;

@Autowired

ShareService shareService;

@Autowired

CommentMapper commentMapper;

@Autowired

HttpSession session;

@Autowired

ReportService reportService;

@Autowired

SentenceService sentenceService;

@GetMapping

public String index(Model model,Integer id,String status){

int i=-1;

if(status.equals(IndexFrom.Post.getDesc())){

i=0;

}else if(status.equals(IndexFrom.Share.getDesc())){

i=1;

} else if(status.equals(IndexFrom.Sponsor.getDesc())){

i=2;

session.setAttribute(CatConst.USER_DETAILS_STATUS,i);

session.setAttribute(CatConst.USER_DETAILS_CODE,id);

model.addAttribute(“comments”,detailsService.findComment(i,id));

detailsService.addCount(id,i);

model.addAttribute(“count”,commentMapper.queryCount1(id,i));

model.addAttribute(“recommends”,detailsService.findRecommends(i));

IndexVo info=detailsService.findDetails(id,i);

model.addAttribute(“info”,info);

model.addAttribute(“url”,TitleUtil.getUrl());

List indexMax=indexService.findMaxCount();

List notices=noticeService.queryNotice();

model.addAttribute(“notices”,notices);

model.addAttribute(“indexMax”,indexMax);

Sentence sentence=sentenceService.findSentence();

model.addAttribute(“sentence”,sentence);

return “details”;

@PostMapping(“interceptor/addComment”)

public String comment(String comment,Model model){

int i= (int) session.getAttribute(CatConst.USER_DETAILS_STATUS);

int id= (int) session.getAttribute(CatConst.USER_DETAILS_CODE);

User user= (User) session.getAttribute(“user_session”);

Comment comment1=new Comment();

comment1.setCommentContent(comment);

comment1.setCommentPhone(user.getUserPhone());

comment1.setCommentCreatetime(new Date());

comment1.setCommentPsId(id);

comment1.setCommentSource(i);

commentMapper.addComment(comment1);

model.addAttribute(“comments”,detailsService.findComment(i,id));

detailsService.addCount(id,i);

model.addAttribute(“count”,commentMapper.queryCount1(id,i));

model.addAttribute(“recommends”,detailsService.findRecommends(i));

IndexVo info=detailsService.findDetails(id,i);

model.addAttribute(“info”,info);

List indexMax=indexService.findMaxCount();

List notices=noticeService.queryNotice();

model.addAttribute(“notices”,notices);

model.addAttribute(“indexMax”,indexMax);

Sentence sentence=sentenceService.findSentence();

model.addAttribute(“sentence”,sentence);

model.addAttribute(“url”,TitleUtil.getUrl());

return “details”;

@PostMapping(“interceptor/report”)

public String report(String reason,Model model){

int i= (int) session.getAttribute(CatConst.USER_DETAILS_STATUS);

int id= (int) session.getAttribute(CatConst.USER_DETAILS_CODE);

User user= (User) session.getAttribute(“user_session”);

if(reason.equals(“”)==false){

Report report=new Report();

report.setReportUser(user.getUserNickname());

report.setReportCreatetime(new Date());

report.setReportContent(reason);

if(i==0){

report.setReportFrom(“启示”);

}if(i==1){

report.setReportFrom(“分享”);

}if(i==2){

report.setReportFrom(“赞助”);

report.setReportFromId(id);

reportService.addReport(report);

model.addAttribute(“comments”,detailsService.findComment(i,id));

detailsService.addCount(id,i);

model.addAttribute(“recommends”,detailsService.findRecommends(i));

IndexVo info=detailsService.findDetails(id,i);

model.addAttribute(“info”,info);

List indexMax=indexService.findMaxCount();

List notices=noticeService.queryNotice();

model.addAttribute(“notices”,notices);

model.addAttribute(“indexMax”,indexMax);

Sentence sentence=sentenceService.findSentence();

model.addAttribute(“sentence”,sentence);

model.addAttribute(“url”,TitleUtil.getUrl());

return “details”;

登录管理控制层:

@Controller

@RequestMapping(“”)

public class loginController {

@Autowired

UserService userService;

@GetMapping(value = {“/login”})

public String login(){

return “login”;

@GetMapping(“reBack”)

public String reBack(HttpSession session){

String url= (String) session.getAttribute(“user_old_url”);

if(url==null){

url=”/“;

return “redirect:”+url;

@GetMapping(value = {“login1”})

public String login1(@RequestParam(value =”userUrl”) String userUrl,HttpSession session){

if(userUrl!=null){

session.setAttribute(CatConst.USER_SESSION_URL,userUrl);

return “login”;

@PostMapping(“login/getLogin”)

@ResponseBody

public LoginResult getLogin(@RequestParam(value =”phone”) String phone,

@RequestParam(value =”password”) String password, HttpSession session) {

User user = userService.queryByPhone(phone);

if(user!=null){

if(user.getUserPassword().equals(MD5Util.getMD5(password))){

session.setAttribute(CatConst.USER_SESSION_KEY, user);

if(user.getUserPhone().equals(“1111”)){

session.setAttribute(CatConst.USER_SESSION_administrators, user.getUserPhone());

return new LoginResult(true, “登录成功”);

}else {

return new LoginResult(false, “密码错误”);

}else {

return new LoginResult(false, “用户名错误”);

@PostMapping(“/login/register”)

@ResponseBody

public JsonResult register(User user,@RequestParam(value =”userCode”) String userCode,HttpSession session){

String code=session.getAttribute(CatConst.USER_SESSION_CODE).toString();

if(code.equals(userCode)){

if(userService.queryByPhone(user.getUserPhone())!=null){

return new JsonResult(false, “电话号码已经注册!”);

}else {

user.setUserPassword(MD5Util.getMD5(user.getUserPassword()));

user.setUserCreatetime(new Date());

user.setUserUrl(TitleUtil.getUrl());

int i=userService.addUser(user);

if(i==1){

session.removeAttribute(CatConst.USER_SESSION_CODE);

return new JsonResult(true, “注册成功!”);

}else {

return new JsonResult(false, “注册失败!”);

}else {

return new JsonResult(false, “验证码错误!”);

@PostMapping(“login/updatePassword”)

@ResponseBody

public JsonResult updatePassword(@RequestParam(value =”userPhone”) String userPhone,

@RequestParam(value =”userCode”) String userCode,

@RequestParam(value =”userPassword”) String userPassword,HttpSession session){

String code=session.getAttribute(CatConst.USER_SESSION_CODE).toString();

if(code.equals(userCode)){

int i=userService.updateUserPhone(MD5Util.getMD5(userPassword),userPhone);

if(i==1){

session.removeAttribute(CatConst.USER_SESSION_CODE);

return new JsonResult(true, “密码更新成功!”);

}else {

return new JsonResult(false, “密码更新失败!”);

}else {

return new JsonResult(false, “验证码错误!”);

@PostMapping(“login/getCode”)

@ResponseBody

public JsonResult getCode(@RequestParam(value =”userPhone”) String userPhone,HttpSession session){

DuanxinService duanxinService=new DuanxinService();

// int code=duanxinService.duanXin(userPhone);

session.setAttribute(CatConst.USER_SESSION_CODE,”1234”);

return new JsonResult(true,”发送成功”);

// 有时,一些网站的部分操作需要登录才能访问。如果跳转到登录界面登录成功后,怎样才能返回到登录之前的界面呢?

// 很简单,我们在代码部分中添加一部分很少的代码即可。在从一个页面跳转到登录界面之前的代码,我们用session保

// 存当前界面的url信息,在跳转到登录界面,登录成功后的代码中,判读是否有这个session信息,如果有,则跳转到

// session所存的url,记住跳转前清空这个session,否则在未关闭浏览器重新登录时可能又会跳到session中所存储url的界面。


项目链接:
https://javayms.github.io?id=481524512608201ns
https://javayms.pages.dev?id=481524512608201ns