基于javaweb+mysql的ssm设备台账管理系统(java+ssm+html+jsp+js+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM设备台账管理系统(java+ssm+html+jsp+js+mysql)
项目介绍
管理员角色包含以下功能: 管理员登录,物理设备管理,IP地址资源管理,虚拟机管理,通知公告管理,学历管理,部门管理,员工管理等功能。
员工角色包含以下功能: 员工角色登录,查看物理设备,查看IP地址,查看虚拟机,通知公告查看等功能。
环境需要
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版本;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:HTML+CSS+JavaScript+jsp
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中application.yml配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
String path = request.getSession().getServletContext().getRealPath("/upload");
File file = new File(path);
if(!file.exists()){
file.mkdirs();
//解析request对象,获取文件上传项
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload fileUpload = new ServletFileUpload(factory);
//解析
List<FileItem> list = fileUpload.parseRequest(request);
//遍历
for (FileItem item:list
) {
if(item.isFormField()){//普通表单项
} else{
*/
@PostMapping("/brand")
@ResponseBody
public int addtDeviceBrand(DeviceBrand deviceBrand){
return baseInfoService.addtDeviceBrand(deviceBrand);
/**
* 删除设备品牌
* @param brandId
* @return
*/
@DeleteMapping("/brand/{brandId}")
@ResponseBody
JSONObject obj=new JSONObject();
Sysuser u=userService.getById(user.getUid());
String q=u.getQuestion();
if(u==null||u.equals("")){
obj.put("info", "ng");
}else{
if(q.equals(user.getQuestion())){
obj.put("info", u.getPwd());
}else{
obj.put("info", "ng");
response.setContentType("text/html;charset=utf-8");
PrintWriter out=null;
out=response.getWriter();
out.print(obj);
out.flush();
} catch (IOException e) {
e.printStackTrace();
}finally{
out.close();
@RequestMapping("checkmibao.do")
public void checkMB(Sysuser user,HttpServletResponse response,HttpSession session){
JSONObject obj=new JSONObject();
Sysuser u=userService.getById(user.getUid());
@Autowired
private LogService logService;
/**
* 获取所有设备类型信息
* @param map
* @return
*/
@RequestMapping("/type/list")
public String listDeviceType(ModelMap map){
List<DeviceType> typeList = baseInfoService.listDeviceType();
map.put("typeList",typeList);
return "deviceTypes::table-refresh";
* @param map
* @param pageName
* @return
*/
@PostMapping("/list")
public String listDeviceDTOByExample(ModelMap map,DeviceDTO example,String pageName,String userName){
List<DeviceDTO> deviceDTOList = deviceService.listDeviceDTOByexample(example);
if(!StringUtils.isEmpty(userName)){
deviceDTOList = deviceService.selectDeviceDTObyUserName(deviceDTOList,userName);
map.put("dtoList", deviceDTOList);
return pageName+"::table-refresh";
};
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());
try {
out=response.getWriter();
out.print(obj);
out.flush();
} catch (IOException e) {
e.printStackTrace();
}finally{
out.close();
// 验证用户名是否存在
@RequestMapping("checkUname.do")
public void checkReg(Sysuser user,HttpServletResponse response){
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";
// 处理修改个人信息
session.setAttribute("p", 1);
return "admin/user_list";
// 模糊查询并分页
@RequestMapping("admin/userListQuery.do")
public String useListQuery(@RequestParam(value = "page", required = false) String page, HttpSession session,
ModelMap map,Sysuser user) {
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());
//新增设备基本信息时,触发器会自动新增设备使用信息和运行信息
deviceService.addDevice(device);
return "deviceManage";
/**
* 检查设备id是否重复
* @param devId
* @return
*/
@GetMapping("/checkDevId")
@ResponseBody
public int checkDevId(String devId){
DeviceDTO deviceDTO = deviceService.getDeviceDtoById(devId);
device.setTypeId(request.getParameter("typeId"));
device.setBrandId(request.getParameter("brandId"));
device.setDevModel(request.getParameter("devModel"));
device.setErpCode(request.getParameter("erpCode"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
device.setPurchaseTime(sdf.parse(request.getParameter("purchaseTime")));
device.setLastUpate(new Date());
//新增设备基本信息时,触发器会自动新增设备使用信息和运行信息
deviceService.addDevice(device);
return "deviceManage";
/**
* 检查设备id是否重复
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);
map.put("user",userService.getById(id));
return "admin/update_user";
// 更新用户的信息
@RequestMapping("admin/updateUser.do")
public String updateUser(Sysuser user) {
userService.update(user);
return "redirect:userList.do";
// 查询所有用户的信息
@RequestMapping("admin/userList.do")
public String userList(@RequestParam(value = "page", required = false) String page, HttpSession session,
ModelMap map) {
if (page == null || page.equals("")) {
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();
* @return
*/
@GetMapping("/{devId}")
public String getDeviceById(ModelMap map,@PathVariable("devId") String devId){
DeviceDTO dto = deviceService.getDeviceDtoById(devId);
map.put("detailDTO", dto);
return "deviceList::modal-refresh";
/**
* 新增设备
* @param request
* @return
* @throws ParseException
*/
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){