基于SSM框架的电脑测评系统

news2024/10/5 20:23:08

末尾获取源码
开发语言:Java
Java开发工具:JDK1.8
后端框架:SSM
前端:Vue
数据库:MySQL5.7和Navicat管理工具结合
服务器:Tomcat8.5
开发软件:IDEA / Eclipse
是否Maven项目:是


目录

一、项目简介

二、系统功能

三、系统项目截图

管理员模块的实现

用户信息管理

电脑类型管理

电脑信息管理

用户模块的实现

前台首页

电脑评测

我的收藏

四、核心代码

登录相关

文件上传

封装


一、项目简介

随着信息技术在管理上越来越深入而广泛的应用,作为一个一般的用户都开始注重与自己的信息展示平台,实现基于SSM框架的电脑测评系统在技术上已成熟。本文介绍了基于SSM框架的电脑测评系统的开发全过程。通过分析用户对于基于SSM框架的电脑测评系统的需求,创建了一个计算机管理基于SSM框架的电脑测评系统的方案。文章介绍了基于SSM框架的电脑测评系统的系统分析部分,包括可行性分析等,系统设计部分主要介绍了系统功能设计和数据库设计。

本基于SSM框架的电脑测评系统有管理员和用户两个角色。管理员功能有个人中心,用户管理,电脑类型管理,电脑分类管理,电脑品牌管理,电脑信息管理,电脑评测管理,论坛互助,系统管理等。用户功能有,个人中心,电脑品牌管理,电脑信息管理,电脑评测管理,我的收藏管理,论坛互助,系统管理等。因而具有一定的实用性。

本站是一个B/S模式系统,采用Java的SSM框架作为开发技术,MYSQL数据库设计开发,充分保证系统的稳定性。系统具有界面清晰、操作简单,功能齐全的特点,使得基于SSM框架的电脑测评系统管理工作系统化、规范化。


二、系统功能

本系统是基于B/S架构的网站系统,设计的管理员功能结构图如下图所示:

本系统是基于B/S架构的网站系统,设计的用户功能结构图如下图所示:

 



三、系统项目截图

管理员模块的实现

用户信息管理

基于SSM框架的电脑测评系统的系统管理员可以管理用户信息,可以对用户信息添加修改删除操作。

电脑类型管理

系统管理员可以对电脑类型进行添加,修改,删除操作。

 

电脑信息管理

系统管理员可以对电脑信息进行添加,修改,删除操作。

用户模块的实现

前台首页

用户登录后,可以在首页查看电脑信息。 

电脑评测

用户登录后,点击后台管理以后,再点击电脑评测,就可以查看电脑评测信息。

 

我的收藏

用户登录后可以在首页个人中心里面点击我的收藏,可以查看我的收藏。


四、核心代码

登录相关


package com.controller;


import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;

/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;

	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

文件上传

package com.controller;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;

/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

封装

package com.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}

	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}

	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1184374.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

leetcode:762. 二进制表示中质数个计算置位(python3解法)

难度&#xff1a;简单 给你两个整数 left 和 right &#xff0c;在闭区间 [left, right] 范围内&#xff0c;统计并返回 计算置位位数为质数 的整数个数。 计算置位位数 就是二进制表示中 1 的个数。 例如&#xff0c; 21 的二进制表示 10101 有 3 个计算置位。 示例 1&#xf…

爆火的小红书app拉新项目 地推网推百搭项目 附申请渠道

小红书app拉新在市场还是饱受地推团队和网推团队的喜爱&#xff0c;作业流程操作简单 可以通过“聚量推客”申请小红书app拉新推广 下面附送小红书app的拉新流程&#xff0c;目前也分为普通版本和高价版本&#xff08;普通版本更稳定&#xff0c;高价版本属于短期活动&#x…

双11购物节想入手一款音画好的智能电视,大家推荐一下吧?

智能家电更新太快,不想三五年后就淘汰,那就入手东芝电视Z700吧,Z700这次把观影体验和音箱效果做到哇塞,既然要享受生活那就要享受高品质的体验。东芝电视拥有70余年的原色调校技术,每款产品都有专属的日本调校工程师匠心打造,可以真实还原画面色彩,而且还有火箭炮音响系统,也是…

安卓 车轮视图 WheelView kotlin

安卓 车轮视图 WheelView kotlin 前言一、代码解析1.初始化2.初始化数据3.onMeasure4.onDraw5.onTouchEvent6.其他 6.ItemObject二、完整代码总结 前言 有个需求涉及到类似这个视图&#xff0c;于是在网上找了个轮子&#xff0c;自己改吧改吧用&#xff0c;拿来主义当然后&…

com.genuitec.eclipse.springframework.springnature

com.genuitec.eclipse.springframework.springnature

计算机毕业论文内容参考|基于spingboot的金融投资顾问推荐系统

文章目录 导文文章重点摘要前言绪论课题背景:国内外现状与趋势:课题内容:相关技术与方法介绍系统分析系统设计系统实现总结与展望1本文总结2后续工作展望导文 计算机毕业论文内容参考|基于spingboot的金融投资顾问推荐系统 文章重点 摘要 基于SpingBoot的金融投资顾问推荐…

大功率电源的应用场景有哪些(高压功率放大器)

大功率电源的应用非常广泛&#xff0c;其应用场景包括但不限于以下几个方面&#xff1a; 工业生产&#xff1a;大功率电源广泛应用于各种工业生产领域&#xff0c;如机床、冶金、化工、电力等。例如&#xff0c;用于驱动液压系统、加热炉、电焊机等设备。 实验室研究&#xff1…

百分点科技受邀参加“第五届治理现代化论坛”

11月4日&#xff0c;由北京大学政府管理学院主办的“面向新时代的人才培养——第五届治理现代化论坛”举行&#xff0c;北京大学校党委常委、副校长、教务长王博&#xff0c;政府管理学院院长燕继荣参加开幕式并致辞&#xff0c;百分点科技董事长兼CEO苏萌受邀出席论坛&#xf…

Leetcode2918. 数组的最小相等和

Every day a Leetcode 题目来源&#xff1a;2918. 数组的最小相等和 解法1&#xff1a;贪心 设数组 nums1 的元素总和为 sum1&#xff0c;其中 0 的个数为 countZero1&#xff1b;数组 nums2 的元素总和为 sum2&#xff0c;其中 0 的个数为 countZero2。 题目要求我们必须…

selenium元素定位 —— 提高篇 CSS定位元素

CSS (Cascading Style Sheets) 是一种用于渲染 HTML 或者 XML 文档的语言&#xff0c;CSS 利用其选择器可以将样式属性绑定到文档中的指定元素。理论上说无论一个元素定位有多复杂都能够定位到元素。 因为不同的浏览器 XPath 引擎不同甚至没有自己的 Xpath 引擎&#xff0c;这…

SpringBoot整合Mybatis-plus代码生成器

整合代码生成器过程中,发现好多博主提供的无法使用,自己整合了一套,没有花里胡哨,直接可用 备注:常规的依赖自己导入,提供的这套,默认已经导入了mybatis-plus,srpingboot等依赖了. 1.maven依赖导入,版本号要与自己的版本号想同 <!--代码生成器依赖--><dependency>…

手撕 视觉slam14讲 ch13 代码 总结

运行效果 &#xff08;Kitti 00&#xff09;4倍速 一、代码 GitHub - tzy0228/Easy-VO-SLAM: VSLAM-CH13工程代码注释版本 二、编译过程 踩坑 视觉SLAM 十四讲第二版 ch13 编译及运行问题_全日制一起混的博客-CSDN博客 三、代码解读 手撕 视觉slam14讲 ch13 代码&#xff0…

共话医疗数据安全,美创科技@2023南湖HIT论坛,11月11日见

11月11日浙江嘉兴 2023南湖HIT论坛 如约而来 深入数据驱动运营管理、运营数据中心建设、数据治理和数据安全、数据资产“入表”等热点、前沿话题 医疗数据安全、数字化转型深耕者—— 美创科技再次深入参与 全新发布&#xff1a;医疗数据安全白皮书 深度探讨&#xff1a;数字…

7天入门python系列之准备工作

寄语 编者打算开一个python 初学主题的系列文章&#xff0c;用于指导想要学习python的同学。关于文章有任何疑问都可以私信作者。对于初学者想在7天内入门Python&#xff0c;这是一个紧凑的学习计划。但并不是不可完成的。 7天的安排 如果你想在7天内入门Python&#xff0c;…

QT开发的摄像头电子地图Demo(采用百度地图),提供源码下载

一、前言 本软件的工程是在QT-5.8 32位下开发&#xff0c;可以支持其他qtcreator 32位版本&#xff08;用32位是因为视频播放的码流库是32位&#xff09;。工程采用的地图是百度地图&#xff0c;需要在百度地图开发者网站上注册账号&#xff0c;并获取到密钥。本工程数据库采用…

【node+JS】前端使用nodemailer发送邮件

前言邮箱配置完整代码 前言 最近需要实现客户提交表单后&#xff0c;把表单的内容作为邮件发送到对应的邮箱&#xff0c;不通过后端服务&#xff0c;前端直接进行发送。嘶——&#xff0c;说干就干&#xff01; 一通搜索下来&#xff0c;get到方法有很多种&#xff0c;但是。。…

redis主从复制玩法全过程笔记(redis7+版本)

目录标题 环境目的实操一主多仆服务器和本地主机配置环境docker 环境配置 薪火相传反客为主 主从复制的流程主从复制的特性主从复制的缺点本篇结语 环境 我的环境介绍window环境VM虚拟机一台并安装centos7&#xff0c;一台阿里云Linux服务器&#xff0c;另一台Linux系统主机并…

【STM32】TIM2的PWM:脉冲宽度调制

PWM是一种周期固定&#xff0c;脉宽可调整的输出波形。 0.通用寄存器输出 1.捕获/比较通道1的主电路--中间部分 2.捕获/比较通道的输出部分--输出 3.通用定时器输出PWM原理 PWM波周期或者频率由ARR&#xff08;就是要进递增/递减的值&#xff09;决定&#xff0c;PWM波占空比由…

卫浴服务信息展示预约小程序的作用如何

卫浴产品多种多样&#xff0c;尤其对经销商来说&#xff0c;各种品牌规格的产品都有&#xff0c;品牌商也一样&#xff0c;该产品在市场中并不缺客户&#xff0c;但想要获取却绝非易事&#xff0c;那么卫浴商家面临哪些痛点&#xff0c;又该如何解决呢&#xff1f; 1、品牌传播…

Ionic header content footer toolbar UI实例

1 ionic的button图标 <ion-header [translucent]"true"><ion-toolbar><ion-buttons slot"start"><ion-back-button default-href"/tabs/tab1" text"back" icon"caret-back"></ion-back-button&…