Java项目:SSM实验室设备管理

作者主页:Java毕设网

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

一、项目介绍

本项目为后台管理系统,分为管理员、老师、学生三种角色;
管理员角色包含以下功能:
信息管理:用户管理;
基础管理:实验室管理,实验室申请记录,设备管理,设备记录管理,耗材管理,耗材记录管理等功能。
统计管理:查询统计管理;

老师角色包含以下功能:
信息管理:个人信息修改;
基础管理:实验室管理、实验室申请管理、设备管理、设备记录管理,耗材管理,耗材记录管理等功能。

学生角色包含以下功能:
信息管理:个人信息修改;

基础管理:实验室管理、实验室申请管理、设备管理、设备记录管理,耗材管理,耗材记录管理等功能。

二、环境需要

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项目:否;

三、技术栈

1. 后端:Spring+SpringMVC+Mybatis

2. 前端:JSP+CSS+JavaScript+jQuery

四、使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中applicationContext.xml配置文件中的数据库配置改为自己的配置;

4. 运行项目,输入http://localhost:8080/shiyanshi 登录

五、运行截图


六、相关代码

用户管理控制器

@Controller
public class SysuserController {
	@Resource
	private SysuserServier userService;

	@RequestMapping("flogin.do")
	public String login() {
		return "login";
	}
    
	@RequestMapping("admin/showUserInfo.do")
	public String showUserInfo(ModelMap map,HttpSession session){
		if(session.getAttribute("auser")==null){
			return "login";
		}
		Sysuser u=(Sysuser)session.getAttribute("auser");
		map.put("user",userService.getById(u.getUid()));
		return "admin/update_user_persion";
	}
	@RequestMapping("admin/updatePersionUser.do")
	public String updateUserInfo(ModelMap map,HttpSession session,Sysuser user){
		userService.update(user);
		map.put("user", userService.getById(user.getUid()));
		session.setAttribute("suc", "cc");
		return "redirect:showUserInfo.do";
	}
	
	
	@RequestMapping("admin/login.do")
	public String aLogin() {
		return "admin/login";
	}
//	处理修改个人信息
		@RequestMapping("showInfo.do")
	public String showInfo(HttpSession session,ModelMap map) {
		Sysuser u=(Sysuser)session.getAttribute("user");
		if(u==null){
			return "fore_login";
		}else{
			map.put("user", userService.getById(u.getUid()));
			return "showUserinfo";
		}
	}	
//		处理修改个人信息
			@RequestMapping("addShowInfo.do")
		public String addShowInfo(HttpSession session,ModelMap map,Sysuser user) {
				userService.update(user);
				return "success";
		}	
	
//	文件上传
	public String fileUpload(@RequestParam(value="file",required=false)MultipartFile file,
			HttpServletRequest request,String img){
		String path=request.getSession().getServletContext().getRealPath("upload");
		System.out.println("path==="+path);
		System.out.println("file==="+file);
		String fileName=file.getOriginalFilename();
		System.out.println("fileName==="+fileName);
		File targetFile=new File(path,fileName);
		if(!targetFile.exists()){
			targetFile.mkdirs();
		}
		try {
			file.transferTo(targetFile);
		} catch (IllegalStateException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		String pa=request.getContextPath()+"/upload/"+fileName;
		System.out.println("path==="+pa);
		if(fileName!=null&&!fileName.equals("")){
			img=fileName;
		}else{
			img=null;	
		}
		
		return img;
		
	}
	// 后台登录
	@RequestMapping("admin/alogin.do")
	public String checkLogin(ModelMap map,Sysuser user, HttpSession session) {
		Map<String,Object> u=new HashMap<String,Object>();
		System.out.println("name===" + user.getUname());
		System.out.println("pwd===" + user.getPwd());
		u.put("uname",user.getUname());
		u.put("utype", user.getUtype());
		u.put("pwd",user.getPwd());
		user = userService.adminLogin(u);
		if (user != null) {
			session.setAttribute("auser", user);
			System.out.println("auser=" + user);
			return "admin/index";
		} else {
			map.put("errorInfo", "用户名或者密码错误!");
			return "admin/login";
		}
	}

实验管理控制器

@Controller
public class ShiYanController {
	@Resource
	private ShiYanServer ShiYanService;
	@Resource
	private ForderServer orderService;
	@Resource
	private SysuserServier userService;
	
	
//	文件上传
	public String fileUpload(@RequestParam(value="file",required=false)MultipartFile file,
			HttpServletRequest request,String img){
		String path=request.getSession().getServletContext().getRealPath("upload");
		String fileName=file.getOriginalFilename();
		File targetFile=new File(path,fileName);
		if(!targetFile.exists()){
			targetFile.mkdirs();
		}
		try {
			file.transferTo(targetFile);
		} catch (IllegalStateException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		String pa=request.getContextPath()+"/upload/"+fileName;
		System.out.println("path==="+pa);
		if(fileName!=null&&!fileName.equals("")){
			img=fileName;
		}else{
			img="zanwu.jpg";	
		}
		return img;
		
	}
//	实验室管理
	@RequestMapping("admin/addShiYan.do")
	public String addShiYan(ModelMap map,ShiYan shiYan,HttpServletRequest request){
		Timestamp time=new Timestamp(System.currentTimeMillis());
		shiYan.setFtype("实验室");
		shiYan.setMstatus("空闲中");
		shiYan.setIsdel("1");
		shiYan.setPubtime(time.toString().substring(0, 19));
		ShiYanService.add(shiYan);
		return "redirect:ShiYanList.do";
	}
	@RequestMapping("admin/doUpdateShiYan.do")
	public String doUpdateShiYan(ModelMap map,int id){
		map.put("sy", ShiYanService.getById(id));
		return "admin/update_ShiYan";
	}
	@RequestMapping("admin/updateShiYan.do")
	public String updateShiYan(	HttpServletRequest request,ShiYan ShiYan){
		ShiYanService.update(ShiYan);
		return "redirect:ShiYanList.do";
	}
//	分页查询
	@RequestMapping("admin/ShiYanList.do")
	public String shiYanList(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page), PageBean.PAGESIZE);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", pageBean.getPageSize());
		Map<String, Object> cmap=new HashMap<String, Object>();
		pmap.put("name", null);
		cmap.put("name", null);
		cmap.put("ftype", "实验室");
		pmap.put("ftype", "实验室");
		int total=ShiYanService.getCount(cmap);
		pageBean.setTotal(total);
		List<ShiYan> list=ShiYanService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 1);
		return "admin/list_ShiYan";
	}
//   分页模糊查询
	@RequestMapping("admin/vagueShiYanList.do")
	public String vagueShiYanList(@RequestParam(value="page",required=false)String page,
			ModelMap map,HttpSession session,ShiYan cd){
		if(page==null||page.equals("")){
			page="1";
		}
		PageBean pageBean=new PageBean(Integer.parseInt(page),PageBean.PAGESIZE);
		Map<String, Object> pmap=new HashMap<String,Object>();
		pmap.put("pageno", pageBean.getStart());
		pmap.put("pageSize", pageBean.getPageSize());
		Map<String, Object> cmap=new HashMap<String,Object>();
       if(cd.getName()!=null&&!cd.getName().equals("")){
			cmap.put("name", cd.getName());
			pmap.put("name", cd.getName());
		}
        cmap.put("ftype", "实验室");
		pmap.put("ftype", "实验室");
		int total=ShiYanService.getCount(cmap);
		pageBean.setTotal(total);
		List<ShiYan> list=ShiYanService.getByPage(pmap);
		map.put("page", pageBean);
		map.put("list", list);
		session.setAttribute("p", 2);
		return "admin/list_ShiYan";
	}
	@RequestMapping("admin/deleteShiYan.do")
	public String deleteShiYan(int id){
		ShiYanService.delete(id);
		return "redirect:ShiYanList.do";
	}
	
	

七、如果也想学习本系统,下面领取。关注并回复:072ssm

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值