目录
全栈码农以及毕业设计实战开发,CSDN平台Java领域新星创作者
一、前言
在知识爆炸的今天,考研已成为众多学子提升自我、追求更高学术成就的重要途径。然而,面对琳琅满目的考研图书,如何快速准确地找到适合自己的学习资料,成为考研学子面临的一大难题。为了解决这一问题,我们设计并实现了基于SSM(Spring+SpringMVC+MyBatis)框架的考研图书电子商务平台。本系统旨在打造一个集图书展示、搜索、购买、评价等功能于一体的综合性电商平台,为考研学子提供便捷、高效、全面的图书选购服务。通过SSM框架的集成应用,系统实现了对图书信息的快速检索和精准匹配,帮助用户迅速找到所需的考研图书。同时,本系统还注重用户体验和个性化服务,提供了丰富的图书分类、智能推荐、用户评价等功能,旨在为用户提供更加贴心、个性化的购物体验。我们相信,通过本系统的应用,将能够进一步推动考研图书市场的繁荣发展,为广大学子提供更加优质的图书资源和服务。
二、技术介绍
语言:Java
使用框架:Spring Boot
前端技术:JS、Vue 、css3
开发工具:IDEA/Eclipse
数据库:MySQL 5.7/8.0
数据库管理工具:phpstudy/Navicat
JDK版本:jdk1.8
Maven: apache-maven 3.8.1-bin
前端环境:Node.Js 12\14\16
三、系统实现
热销商品管理
管理员权限中的热销商品管理,其运行效果见下图。管理员维护商品资料,能修改与删除。也能登记本页面没有的商品资料。
用户管理
管理员权限中的用户管理,其运行效果见下图。用户可以注册提交信息,也可以让管理员在后台添加用户,维护用户资料,包括修改与删除。
留言板管理
管理员权限中的留言板管理,其运行效果见下图。用户提交的留言,需要管理员在当前页面查看并回复。
已完成订单
管理员权限中的已完成订单,其运行效果见下图。管理员管理处于不同状态的订单,查询已完成订单,也能直接删除。
用户功能实现
商品信息
用户权限中的商品信息,其运行效果见下图。用户在本页面可以操作的功能比较多,可以收藏,评价页面内的商品,可以直接购买,也能暂时加入购物车保存商品。
购物车
用户权限中的购物车,其运行效果见下图。购物车帮助用户暂时保存购买的商品,方便用户一次性下单购买多种商品。
已支付订单
用户权限中的已支付订单,其运行效果见下图。用户对订单明细进行查看,可以选择对某些误购买的商品进行退款。
我的地址
用户权限中的我的地址,其运行效果见下图。用户管理收货地址,能修改与删除。
四、论文参考
五、核心代码
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();
}
}
六、源码获取
感谢大家点赞、收藏、关注、评论啦