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







基于javaweb的SSM+Maven校园相册管理系统(java+ssm+html+bootstrap+layui+mysql)
项目介绍
实现了用户登录与注册,查看首页,查看我的相册,添加相册,提交评论,修改密码等功能
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本; 6.是否Maven项目:是;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:html+CSS+JavaScript+bootstrap+layui
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,在浏览器中输入 http://localhost:8080/ssm_xcselect
——————————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
| @RequestMapping("/update") public R update(@RequestBody CommentEntity comment){ commentService.update(comment); return R.ok(); }
@RequestMapping("/delete") public R delete(@RequestBody Long[] ids){ commentService.deleteBatch(ids); return R.ok(); } } package com.learn.controller;
@RestController @RequestMapping("/sys/config") public class SysConfigController extends AbstractController { @Autowired private SysConfigService sysConfigService;
|
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
| // 返回“图像”选项卡并显示图片 out.println("<script type=\"text/javascript\">"); out.println("window.parent.CKEDITOR.tools.callFunction(" + CKEditorFuncNum + ",'" + path + "','')"); out.println("</script>");
} catch (RuntimeException e) { out.println("<script type=\"text/javascript\">"); out.println("window.parent.CKEDITOR.tools.callFunction(" + CKEditorFuncNum + ",'','" + e.getMessage() + "');"); out.println("</script>"); } }
} package com.learn.controller;
/** * 角色管理 * * @email 123456@qq.com */ @RestController @RequestMapping("/sys/role") public class SysRoleController extends AbstractController { @Autowired private SysRoleService sysRoleService; @Autowired private SysRoleMenuService sysRoleMenuService; /** * 角色列表
|
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
| rootPath = classPath; rootPath = rootPath.replace("/", "\\"); } if ("/".equals(File.separator)) { rootPath = classPath.substring(0, classPath.indexOf("/WEB-INF/classes")); rootPath = rootPath.replace("\\", "/"); } return rootPath; }
public static boolean isEmpty(MultipartFile file) { return file == null || file.getSize() == 0 || "".equals(file.getOriginalFilename().trim()); }
public static String uploadFile(String prefix, MultipartFile file, HttpServletRequest request) { prefix = "/cdn/" + prefix; String myFileName = file.getOriginalFilename(); String suffix = myFileName.substring(myFileName.lastIndexOf(".") + 1); String fileName = UUID.randomUUID().toString() + "." + suffix.toLowerCase();
String filePath = getRootPath(request) + prefix + "/"; File f = new File(filePath);
|
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
| HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); sysLog.setIp(IPUtils.getIpAddr(request)); String username = ShiroUtils.getUserEntity().getUsername(); sysLog.setUsername(username); sysLog.setCreateDate(new Date()); sysLogService.save(sysLog); } } package com.learn.utils;
public class IPUtils { private static Logger logger = LoggerFactory.getLogger(IPUtils.class);
public static String getIpAddr(HttpServletRequest request) { String ip = null; try { ip = request.getHeader("x-forwarded-for"); if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("Proxy-Client-IP"); }
|
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
| sysMenuService.update(menu); return R.ok(); }
@SysLog("删除菜单") @RequestMapping("/delete") @RequiresPermissions("sys:menu:delete") public R delete(@RequestBody Long[] menuIds){ for(Long menuId : menuIds){ if(menuId.longValue() <= 30){ return R.error("系统菜单,不能删除"); } } sysMenuService.deleteBatch(menuIds); return R.ok(); }
@RequestMapping("/user") public R user(){ List<SysMenuEntity> menuList = sysMenuService.getUserMenuList(getUserId()); return R.ok().put("menuList", menuList); }
private void verifyForm(SysMenuEntity menu){ if(StringUtils.isBlank(menu.getName())){ throw new RRException("菜单名称不能为空"); }
|
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
| }
private void verifyForm(SysMenuEntity menu){ if(StringUtils.isBlank(menu.getName())){ throw new RRException("菜单名称不能为空"); } if(menu.getParentId() == null){ throw new RRException("上级菜单不能为空"); } if(menu.getType() == Constant.MenuType.MENU.getValue()){ if(StringUtils.isBlank(menu.getUrl())){ throw new RRException("菜单URL不能为空"); } } int parentType = Constant.MenuType.CATALOG.getValue(); if(menu.getParentId() != 0){ SysMenuEntity parentMenu = sysMenuService.queryObject(menu.getParentId()); parentType = parentMenu.getType(); } if(menu.getType() == Constant.MenuType.CATALOG.getValue() || menu.getType() == Constant.MenuType.MENU.getValue()){ if(parentType != Constant.MenuType.CATALOG.getValue()){ throw new RRException("上级菜单只能为目录类型"); } return ; } if(menu.getType() == Constant.MenuType.BUTTON.getValue()){ if(parentType != Constant.MenuType.MENU.getValue()){ throw new RRException("上级菜单只能为菜单类型"); } return ; } } } package com.learn.controller;
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=221122532008200qj
https://javayms.pages.dev?id=221122532008200qj