——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7
开发工具 eclipse/idea/myeclipse/sts等均可配置运行
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot大学生兼职系统(java+springboot+html+maven+mysql)
环境要求:
JDK8 mysql 5.7 maven eclipse/idea
关于数据库导入 在mysql中创建数据库test,然后在数据库下执行sql文件,即parttimeplatform.sql
数据库相关配置: 打开application.yml文件,修改所有配置中数据库的ip地址、端口号、username、password等;
——————————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 @RequestMapping(value = "/list") @Permission(Const.ADMIN_NAME) @ResponseBody public Object list (String condition) { List<Map<String, Object>> list = this .dictService.list(condition); return super .warpObject(new DictWarpper(list)); } @RequestMapping(value = "/detail/{dictId}") @Permission(Const.ADMIN_NAME) @ResponseBody public Object detail (@PathVariable("dictId") Integer dictId) { return dictService.selectById(dictId); } @BussinessLog(value = "修改字典", key = "dictName,dictValues", dict = DictMap.class) @RequestMapping(value = "/update") @Permission(Const.ADMIN_NAME) @ResponseBody public Object update (Integer dictId, String dictCode, String dictName, String dictTips, String dictValues) { if (ToolUtil.isOneEmpty(dictId, dictCode, dictName, dictValues)) { throw new ServiceException(BizExceptionEnum.REQUEST_NULL); } dictService.editDict(dictId, dictCode, dictName, dictTips, dictValues); return SUCCESS_TIP; } @BussinessLog(value = "删除字典记录", key = "dictId", dict = DictMap.class) @RequestMapping(value = "/delete") @Permission(Const.ADMIN_NAME) @ResponseBody public Object delete (@RequestParam Integer dictId) {
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 throw new ServiceException(BizExceptionEnum.REQUEST_NULL); } User user = this .userService.selectById(userId); model.addAttribute(user); model.addAttribute("roleName" , ConstantFactory.me().getRoleName(user.getRoleid())); model.addAttribute("deptName" , ConstantFactory.me().getDeptName(user.getDeptid())); LogObjectHolder.me().set(user); return PREFIX + "user_view.html" ; } @RequestMapping("/user_chpwd") public String chPwd () { return PREFIX + "user_chpwd.html" ; } @RequestMapping("/changePwd") @ResponseBody public Object changePwd (@RequestParam String oldPwd, @RequestParam String newPwd, @RequestParam String rePwd) { if (!newPwd.equals(rePwd)) { throw new ServiceException(BizExceptionEnum.TWO_PWD_NOT_MATCH); } Integer userId = ShiroKit.getUser().getId(); User user = userService.selectById(userId); String oldMd5 = ShiroKit.md5(oldPwd, user.getSalt()); if (user.getPassword().equals(oldMd5)) { String newMd5 = ShiroKit.md5(newPwd, user.getSalt()); user.setPassword(newMd5); user.updateById(); return SUCCESS_TIP; } else { throw new ServiceException(BizExceptionEnum.OLD_PWD_NOT_RIGHT); } }
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 @ControllerAdvice @Order(-1) public class GlobalExceptionHandler { private Logger log = LoggerFactory.getLogger(this .getClass()); @ExceptionHandler(ServiceException.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) @ResponseBody public ErrorResponseData bussiness (ServiceException e) { LogManager.me().executeLog(LogTaskFactory.exceptionLog(ShiroKit.getUser().getId(), e)); getRequest().setAttribute("tip" , e.getMessage()); log.error("业务异常:" , e); return new ErrorResponseData(e.getCode(), e.getMessage()); } @ExceptionHandler(AuthenticationException.class) @ResponseStatus(HttpStatus.UNAUTHORIZED) public String unAuth (AuthenticationException e) { log.error("用户未登陆:" , e); return "/login.html" ; } @ExceptionHandler(DisabledAccountException.class)
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 = "/add") @BussinessLog(value = "菜单新增", key = "name", dict = MenuDict.class) @ResponseBody public ResponseData add (@Valid Menu menu, BindingResult result) { if (result.hasErrors()) { throw new ServiceException(BizExceptionEnum.REQUEST_NULL); } String existedMenuName = ConstantFactory.me().getMenuNameByCode(menu.getCode()); if (ToolUtil.isNotEmpty(existedMenuName)) { throw new ServiceException(BizExceptionEnum.EXISTED_THE_MENU); } menuSetPcode(menu); menu.setStatus(MenuStatus.ENABLE.getCode()); this .menuService.insert(menu); return SUCCESS_TIP; } @Permission(Const.ADMIN_NAME) @RequestMapping(value = "/remove") @BussinessLog(value = "删除菜单", key = "menuId", dict = MenuDict.class) @ResponseBody public ResponseData remove (@RequestParam Long menuId) { if (ToolUtil.isEmpty(menuId)) { throw new ServiceException(BizExceptionEnum.REQUEST_NULL); } LogObjectHolder.me().set(ConstantFactory.me().getMenuName(menuId)); this .menuService.delMenuContainSubMenus(menuId); return SUCCESS_TIP; } @RequestMapping(value = "/view/{menuId}") @ResponseBody public ResponseData view (@PathVariable Long menuId) { if (ToolUtil.isEmpty(menuId)) { throw new ServiceException(BizExceptionEnum.REQUEST_NULL); } this .menuService.selectById(menuId);
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 @BussinessLog(value = "删除字典记录", key = "dictId", dict = DictMap.class) @RequestMapping(value = "/delete") @Permission(Const.ADMIN_NAME) @ResponseBody public Object delete (@RequestParam Integer dictId) { LogObjectHolder.me().set(ConstantFactory.me().getDictName(dictId)); this .dictService.delteDict(dictId); return SUCCESS_TIP; } } package cn.stylefeng.guns.modular.system.controller;
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 */ @Permission @RequestMapping("/user_edit/{userId}") public String userEdit (@PathVariable Integer userId, Model model) { if (ToolUtil.isEmpty(userId)) { throw new ServiceException(BizExceptionEnum.REQUEST_NULL); } assertAuth(userId); User user = this .userService.selectById(userId); model.addAttribute(user); model.addAttribute("roleName" , ConstantFactory.me().getRoleName(user.getRoleid())); model.addAttribute("deptName" , ConstantFactory.me().getDeptName(user.getDeptid())); LogObjectHolder.me().set(user); return PREFIX + "user_edit.html" ; } @RequestMapping("/user_info") public String userInfo (Model model) { Integer userId = ShiroKit.getUser().getId(); if (ToolUtil.isEmpty(userId)) { throw new ServiceException(BizExceptionEnum.REQUEST_NULL); } User user = this .userService.selectById(userId); model.addAttribute(user); model.addAttribute("roleName" , ConstantFactory.me().getRoleName(user.getRoleid())); model.addAttribute("deptName" , ConstantFactory.me().getDeptName(user.getDeptid())); LogObjectHolder.me().set(user); return PREFIX + "user_view.html" ; } @RequestMapping("/user_chpwd") public String chPwd () { return PREFIX + "user_chpwd.html" ; } @RequestMapping("/changePwd") @ResponseBody public Object changePwd (@RequestParam String oldPwd, @RequestParam String newPwd, @RequestParam String rePwd) { if (!newPwd.equals(rePwd)) { throw new ServiceException(BizExceptionEnum.TWO_PWD_NOT_MATCH); }
——————————PayStart——————————
项目链接: https://javayms.github.io?id=271122522008200on https://javayms.pages.dev?id=271122522008200on