基于springboot的社区动物救助系统

一、系统简介

 


本项目采用idea工具开发,html+springboot+mybatis+jquery+thymeleaf技术编写,数据库采用的是mysql,navicat开发工具。

系统一共分为2个角色分别是:管理员,用户

二、模块简介

管理员

1、登录

2、个人信息管理

3、用户管理

4、动物类别管理

5、帖子管理

6、动物管理

7、公告管理

8、动物领养管理

9、动物捐赠管理

10、评论管理

11、退出

用户

1、登录注册

2、浏览动物网站

3、查看动物详情

4、爱心捐赠

5、查看公告

6、发布帖子

7、查看帖子详情

8、评论帖子信息

9、个人信息管理

10、申请领养宠物

11、历史记录查询

项目简介:
难度等级:✩✩✩
用户类型:2角色( 管理员,用户)
设计模式:MVC
项目架构:B/S架构
开发语言:Java语言
前端技术:bootstrap+HTML、CSS、JS、JQuery、thymeleaf等
后端技术:springboot+mybatis框架
运行环境:Windows7或10、JDK1.8
运行工具:本系统采用idea开发,仅支持idea运行,不支持MyEclipse和eclipse运行,因为三者的骨架不一样,强行导入打开运行可能会导致出现未知的错误。
数  据  库:MySQL5.5/5.7/8.0版本
是否基于Maven环境:是
是否采用框架:是
数据库表数量:9张表
JSP页面数量:30多张
是否有分页:有分页

相关截图

 

相关代码

登录


   
   
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns:th="http://www.thymeleaf.org">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>登录 </title>
  6. <link rel="icon" th:href="@{/public/favicon.ico}" type="image/x-icon"/>
  7. <link rel="bookmark" th:href="@{/public/favicon.ico}" type="image/x-icon"/>
  8. <link rel="stylesheet" type="text/css" th:href="@{/css/bootstrap.css}">
  9. <link rel="stylesheet" type="text/css" th:href="@{/css/back.css}">
  10. <link rel="stylesheet" type="text/css" th:href="@{/css/bootstrap-theme.css}">
  11. <script type="text/javascript" th:src="@{/js/jquery-3.6.0.js}"> </script>
  12. <script type="text/javascript" th:src="@{/js/login.js}"> </script>
  13. <script>
  14. $( function( ) {
  15. //防止页面后退
  16. history. pushState( null, null, document. URL);
  17. window. addEventListener( 'popstate', function ( ) {
  18. history. pushState( null, null, document. URL);
  19. });
  20. })
  21. </script>
  22. </head>
  23. <body onload="loadTopWindow()">
  24. <div id="magicalDragScene" class="mc-root mc-ui-absolute-pane">
  25. <h1 style="margin-left: 56%;margin-top: 8%;font-family: 隶书;font-size: 60px;color: white" >社区流浪动物救助管理系统 </h1>
  26. <br>
  27. <div id="tmd" style="width: 25%;height: 300px;">
  28. <form style="margin: 0 auto;width: 80%;height: 300px;" th:action="@{/loginUser}" method="post" onsubmit="return regCheck()">
  29. <h1 class="h3 mb-3 font-weight-normal" style="color:white;font-family: 隶书;text-align: center;" >登录 </h1>
  30. <input id="username" name="username" class="layui-input" type="text" th:placeholder="请填写用户名"/>
  31. <input id="password" name="password" class="layui-input" style="margin-top: 5px" type="password" th:placeholder="请填写用户密码" origin-type="password"/>
  32. <br>
  33. <select name="type" class="form-control" style="width: 75%">
  34. <option value="1" selected>管理员 </option>
  35. <option value="2">用户 </option>
  36. </select>
  37. <!--<input name="type" value="1" style="margin-top: 5px" type="radio" checked/>管理员
  38. <input name="type" value="2" style="margin-top: 5px" type="radio" />救助者-->
  39. <!-- <input name="remember" type="checkbox" style="margin-top: 15px;">&nbsp;<span style="color: #43a047;" ></span>-->
  40. <span id="statusTip" style="color: #d62727;font-size: 15px;margin-left: 40%" th:text="${status}"> </span>
  41. <br>
  42. <!-- <div class="form-check form-check-inline"></div>-->
  43. <!--<p class="mt-5 mb-3 text-muted text-sm-right" style="margin-top: 10px"><span >还没有账号,</span>
  44. <a class="text-info" th:href="@{/toReg}" draggable="false" style="color: #43a047" >求助者注册</a>
  45. <a class="text-info" th:href="@{/toReg2}" style="color: #00a1d6;margin-left: 2px" >救援者注册</a>
  46. </p>-->
  47. <button class="layui-btn1" style="width: 300px;height: 40px;font-size: 16px;color: white" type="submit">登录 </button>
  48. </form>
  49. </div>
  50. <br>
  51. <!-- <a style="color: white;margin-left: 75%" th:href="@{/login.html(language='zh_CN')}">中文</a>&nbsp;&nbsp;&nbsp;&nbsp;
  52. <a style="color: white" th:href="@{/login.html(language='en_US')}">English</a>-->
  53. </div>
  54. </body>
  55. </html>

   
   
  1. /**
  2. * 登录
  3. * @param username
  4. * @param password
  5. * @param type
  6. * @param httpSession
  7. * @param model
  8. * @return
  9. * @throws UnsupportedEncodingException
  10. */
  11. @RequestMapping(value = "/loginUser",method = RequestMethod.POST)
  12. public String loginUser ( String username,String password, String type,HttpSession httpSession, Model model) throws UnsupportedEncodingException {
  13. Admin admin = new Admin();
  14. if(type != null&& type.equals( "1")){
  15. admin = loginService.selectAdmin(username,password);
  16. if (admin != null){
  17. httpSession.setAttribute( "username",admin.getUsername());
  18. httpSession.setAttribute( "admin",admin);
  19. httpSession.setAttribute( "type",type);
  20. model.addAttribute( "type",type);
  21. return "home/homepage";
  22. } else{
  23. model.addAttribute( "status", "账号或者密码输入错误!");
  24. return "login";
  25. }
  26. }
  27. else if(type.equals( "2")){ //用户
  28. User user = loginService.selectUser(username,password);
  29. if(user != null){
  30. httpSession.setAttribute( "username",user.getRealname());
  31. httpSession.setAttribute( "user",user);
  32. httpSession.setAttribute( "type",type);
  33. model.addAttribute( "type",type);
  34. return "redirect:/toIndex";
  35. //return "home/homepage";
  36. } else{
  37. model.addAttribute( "status", "账号或者密码输入错误!");
  38. return "login";
  39. }
  40. } else{
  41. model.addAttribute( "status", "账号或者密码输入错误!");
  42. return "login";
  43. }
  44. }

其他模块代码都是类似的,此项目适合初学者学习借鉴
喜欢的朋友的点赞加关注,感兴趣的同学可以研究!!!!!

项目截图中的数据,很多是用来测试的,需要自行添加合适的数据图片!!
  = v =

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值