——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明







基于javaweb的SpringBoot垃圾分类查询管理系统(java+springboot+html+thymeleaf+maven+mysql)
项目介绍
垃圾分类查询管理系统。共分为两种角色,管理员、普通用户。
管理员角色具有功能: 系统设置-用户管理、页面管理、角色管理; 我的-首页、搜索记录、我的收益; 贡献管理-贡献管理、随机数据、每日垃圾、贡献记录; 垃圾管理-垃圾管理、分类管理、分类列表、垃圾列表、修改奖励; 数据分析-全国统计、分类统计、投放统计;
公告管理-公告管理、公告列表、必布公告;
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
4.数据库:MySql 8.0版本;
技术栈
后端:SpringBoot;
前端:html+thymeleaf;
使用说明
运行项目,输入localhost:8083
管理员账户:admin 密码:123456
普通用户账户:lcp 密码:123456
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| }
@RequestMapping(value = "/") public String index(Model model) { Subject subject = SecurityUtils.getSubject(); User user = (User) subject.getPrincipal();
if (null != user) { model.addAttribute("user", user);
List<Page> pageList = pageService.getAllRolePageByUserId(user.getId()+"");
model.addAttribute("pageList", pageList); return "index"; } else { return "login"; } }
@RequestMapping(value = "/main") public String main(Model model) { Subject subject = SecurityUtils.getSubject(); User user = (User) subject.getPrincipal(); if (null != user) { model.addAttribute("user", user); } else { return "login"; }
List<Page> pageList = pageService.getAllRolePageByUserId(user.getId()+"");
model.addAttribute("pageList", pageList); return "index"; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| searchService.update(search); }else { search.setViewCount(1L); search.setUserId(user.getId()); search.setCreateTime(new Date()); searchService.save(search); }
Categorization categorization = new Categorization(); categorization.setContent(search.getContent()); categorization.setViewCount(-1L);
return categorizationService.getAllByLimit(categorization); } catch (Exception e) { logger.error("查询异常", e); TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); return "ERROR"; } }
} package com.gcms.controller.user;
@Controller("UserGarbageController") @RequestMapping("/user/garbage") public class UserGarbageController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
@RequestMapping(value = "/index") public String login() { return "login"; }
@RequestMapping(value = "/regist") public String regist() { return "regist"; }
@RequestMapping(value = "/doRegist") @ResponseBody public ResultMap doRegist(User user) { User userByPhoneAndName = userService.getUserByPhoneAndName(null, user.getName()); if (userByPhoneAndName !=null){ return resultMap.fail().message("此用户名已注册!"); } try { user.setPassword(MD5.md5(user.getPassword())); user.setCreateTime(new Date()); userService.save(user); return resultMap.success().message("注册成功"); }catch (Exception e){ e.printStackTrace(); return resultMap.fail().message("注册失败"); } }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| if (null == id) { return new ResultMap().fail().message("参数错误"); } return pageService.delPageById(id); }
@RequestMapping("/addRole") @ResponseBody public String addRole(String name) { return roleService.addRole(name); }
@RequestMapping("/delRole") @ResponseBody public String delRole(int id) { boolean flag1 = roleService.delRoleById(id); boolean flag2 = pageRoleService.delPageRoleByRoleId(id); boolean flag3 = userRoleService.delUserRoleByRoleId(id);
if (flag1 && flag2 && flag3) { return "SUCCESS"; } return "ERROR"; }
@RequestMapping("/updateRole") @ResponseBody
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| /** * Method name: page <BR> * Description: 跳转到页面设置页面 <BR> * * @param model * @return String<BR> */ @RequestMapping("/page") public String page(Model model) { List<Page> pageList = pageService.getAllPage(); model.addAttribute("pageList", pageList); return "sa/page"; }
/** * Method name: role <BR> * Description: 跳转到角色设置页面 <BR> * * @param model * @return String<BR> */ @RequestMapping("/role") public String role(Model model) { return "sa/role"; }
/** * Method name: getAllRole <BR> * Description: 获取所有权限 <BR> * * @return List<Role><BR> */ @RequestMapping("/getAllRole") @ResponseBody public List<Role> getAllRole() { return roleService.getAllRole(); }
/** * Method name: getAllPage <BR> * Description: 获取所有页面 <BR> * * @return List<Page><BR> */ @RequestMapping("/getAllPage") @ResponseBody public List<Page> getAllPage() { return pageService.getAllPage(); }
/** * Method name: getPageByRole <BR>
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=151422312105200hw
https://javayms.pages.dev?id=151422312105200hw