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






基于javaweb的SSM失物招领信息管理系统(java+ssm+jsp+javascript+h-ui+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. 前端:JSP+CSS+JavaScript+H-UI
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中config/spring-mvc.xml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入http://localhost:8080/ssm_swzl_sys/ 登录
——————————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
|
@Controller @RequestMapping(value = "Gongao") public class GongaoController { @Autowired private GongaoMapper gongaoMapper;
@RequestMapping(value = "/initUtil.do") public String initUtil(HttpServletRequest request, Model model) { return "Gongao/saveOrUpdate"; }
@RequestMapping(value = "/selectUtil.do") public String selectUtil(HttpServletRequest request, Gongao util, Model model) { util = gongaoMapper.selectObject(util.getId()); model.addAttribute("util", util); return "Gongao/saveOrUpdate"; }
@SuppressWarnings({ "rawtypes", "unchecked" }) @RequestMapping(value = "/getAllUtil.do") public String getAllUtil(HttpServletRequest request, Model model) { String field = request.getParameter("field"); String fieldValue = request.getParameter("fieldValue"); try { fieldValue = new String(fieldValue.getBytes("UTF-8"), "UTF-8"); } catch (Exception e) {} String pageNo = request.getParameter("pageModel.currentPageNo"); int currentPageNo = 1; try{ currentPageNo = Integer.parseInt(pageNo); }catch(Exception e){ } List<Gongao> list = gongaoMapper.getObjectList(field, fieldValue); PageModel pageModel = new PageModel(); pageModel = pageModel.getUtilByController(list, currentPageNo); model.addAttribute("pageModel", pageModel); model.addAttribute("fieldValue", fieldValue); model.addAttribute("field", field); return "Gongao/find"; }
@RequestMapping(value = "/deleteUtil.do") public String deleteUtil(HttpServletRequest request, Gongao util, Model model) { try{ gongaoMapper.deleteObject(util.getId());
|
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
| return "Ymdjb/saveOrUpdate"; }
@RequestMapping(value = "/selectUtil.do") public String selectUtil(HttpServletRequest request, Ymdjb util, Model model) { util = ymdjbMapper.selectObject(util.getId()); model.addAttribute("util", util); List<User> listUser = userMapper.getObjectList(null, null); model.addAttribute("listUser", listUser); return "Ymdjb/saveOrUpdate"; }
@SuppressWarnings({ "rawtypes", "unchecked" }) @RequestMapping(value = "/getAllUtil.do") public String getAllUtil(HttpServletRequest request, Model model) { String field = request.getParameter("field"); String fieldValue = request.getParameter("fieldValue"); try { fieldValue = new String(fieldValue.getBytes("UTF-8"), "UTF-8"); } catch (Exception e) {} String pageNo = request.getParameter("pageModel.currentPageNo"); int currentPageNo = 1; try{ currentPageNo = Integer.parseInt(pageNo); }catch(Exception e){ } List<Ymdjb> list = ymdjbMapper.getObjectList(field, fieldValue); List<Ymdjb> listYmdjb = new ArrayList<Ymdjb>(); HttpSession session = request.getSession(); int user_id = (Integer) session.getAttribute("user_id"); String user_type = (String) session.getAttribute("user_type"); for (Ymdjb temp : list) { if (user_id == temp.getUser().getId()) { listYmdjb.add(temp); } } if (!"admin".equals(user_type)) { }
PageModel pageModel = new PageModel(); pageModel = pageModel.getUtilByController(list, currentPageNo); model.addAttribute("pageModel", pageModel); model.addAttribute("fieldValue", fieldValue); model.addAttribute("field", field); return "Ymdjb/find";
|
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
| return new BaseState(false, AppInfo.NOT_ALLOW_FILE_TYPE); }
savePath = PathFormat.parse(savePath, originFileName);
String physicalPath = (String) conf.get("rootPath") + savePath;
InputStream is = fileStream.openStream(); State storageState = StorageManager.saveFileByInputStream(is, physicalPath, maxSize); is.close();
if (storageState.isSuccess()) { storageState.putInfo("url", PathFormat.format(savePath)); storageState.putInfo("type", suffix); storageState.putInfo("original", originFileName + suffix); }
return storageState; } catch (FileUploadException e) { return new BaseState(false, AppInfo.PARSE_REQUEST_ERROR); } catch (IOException e) { } return new BaseState(false, AppInfo.IO_ERROR); }
private static boolean validType(String type, String[] allowTypes) { List<String> list = Arrays.asList(allowTypes);
return list.contains(type); } } package system.common.util;
@SuppressWarnings("serial") public class ImageServlet extends HttpServlet {
|
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
| @Controller @RequestMapping(value = "User") public class UserController { @Autowired private UserMapper userMapper;
@RequestMapping(value = "/login.do") public String login(HttpServletRequest request, User util, Model model) {
HttpSession session = request.getSession(); String code = (String) session.getAttribute("code"); String userCode = request.getParameter("code");
if (!code.equals(userCode)) { model.addAttribute("errMsg", "验证码错误"); return "../login"; } User user = userMapper.getObjectByName(util); if (null == user) { model.addAttribute("errMsg", "登录失败"); return "../login"; } boolean flag = user.getS_1().equals(util.getS_1()); if (!flag) { model.addAttribute("errMsg", "登录失败"); return "../login"; }
if (flag && !SysUtil.getSysFlag()) { model.addAttribute("errMsg", "无法登陆,请联系管理员"); return "../login"; }
session.setAttribute("user_id", user.getId()); session.setAttribute("user_type", user.getS_11()); session.setAttribute("type1", "admin"); session.setAttribute("type2", "admin"); session.setAttribute("name", user.getS_2());
|
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
| public class ActionEnter { private HttpServletRequest request = null; private String rootPath = null; private String contextPath = null; private String actionType = null; private ConfigManager configManager = null;
public ActionEnter ( HttpServletRequest request, String rootPath ) { this.request = request; this.rootPath = rootPath; this.actionType = request.getParameter( "action" ); this.contextPath = request.getContextPath(); this.configManager = ConfigManager.getInstance( this.rootPath, this.contextPath, request.getRequestURI() ); } public String exec () { String callbackName = this.request.getParameter("callback"); if ( callbackName != null ) {
if ( !validCallbackName( callbackName ) ) { return new BaseState( false, AppInfo.ILLEGAL ).toJSONString(); } return callbackName+"("+this.invoke()+");"; } else { return this.invoke(); }
} public String invoke() { if ( actionType == null || !ActionMap.mapping.containsKey( actionType ) ) { return new BaseState( false, AppInfo.INVALID_ACTION ).toJSONString(); } if ( this.configManager == null || !this.configManager.valid() ) { return new BaseState( false, AppInfo.CONFIG_ERROR ).toJSONString(); } State state = null;
|
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
| gxxfbMapper.deleteObject(util.getId()); }catch(Exception e){} } return this.getAllUtil(request, model); }
@RequestMapping(value = "/saveOrUpdateObject.do") public String saveOrUpdateObject(HttpServletRequest request, Gxxfb util, Model model) { List<Gxxfb> list = gxxfbMapper.getObjectList("s_0", util.getS_0()); List<GxxType> listGxxType = gxxTypeMapper.getObjectList(null, null); model.addAttribute("listGxxType", listGxxType); List<User> listUser = userMapper.getObjectList(null, null); model.addAttribute("listUser", listUser); if (0 == util.getId()) { if (list.size() > 0) { model.addAttribute("util", util); model.addAttribute("errMsg", "该信息已存在!"); return "Gxxfb/saveOrUpdate"; } gxxfbMapper.insertObject(util); } else { if (list.size() > 1) { model.addAttribute("util", util); model.addAttribute("errMsg", "该信息已存在!"); return "Gxxfb/saveOrUpdate"; } gxxfbMapper.updateObject(util); } return this.getAllUtil(request, model); } } package graduation.design.controller;
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=311122522008200oq
https://javayms.pages.dev?id=311122522008200oq