文章目录
- 校园二手交易平台
- 一、项目演示
- 二、项目介绍
- 三、8000字论文参考
- 四、系统部分功能截图
- 五、部分代码展示
- 六、底部获取项目和8000字论文参考(9.9¥)
校园二手交易平台
一、项目演示
校园二手交易系统
二、项目介绍
基于springboot和vue前后端分离的校园二手物品交易平台
开发语言:java
运行环境:idea或eclipse vscode 数据库:mysql
有三个角色
1、游客:浏览主界面、注册
2、学生:登录、主界面、物品发布、消息模块、物品购买模块、收藏模块、下架模块、售出模块、购买模块、退出模块、个人信息
3、管理员:登录、用户管理、商品管理、订单管理、退出模块
三、8000字论文参考
四、系统部分功能截图
五、部分代码展示
package com.second.hand.trading.server.controller;import com.second.hand.trading.server.enums.ErrorMsg;
import com.second.hand.trading.server.model.AddressModel;
import com.second.hand.trading.server.service.AddressService;
import com.second.hand.trading.server.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@CrossOrigin
@RestController
@RequestMapping("/address")
public class AddressController {@Autowiredprivate AddressService addressService;@GetMapping("/info")public ResultVo getAddress(@CookieValue("shUserId")@NotNull(message = "登录异常 请重新登录")@NotEmpty(message = "登录异常 请重新登录") String shUserId,@RequestParam(value = "id",required = false) Long id){if(null==id){return ResultVo.success(addressService.getAddressByUser(Long.valueOf(shUserId)));}else {return ResultVo.success(addressService.getAddressById(id,Long.valueOf(shUserId)));}}@PostMapping("/add")public ResultVo addAddress(@CookieValue("shUserId")@NotNull(message = "登录异常 请重新登录")@NotEmpty(message = "登录异常 请重新登录") String shUserId,@RequestBody AddressModel addressModel){addressModel.setUserId(Long.valueOf(shUserId));if(addressService.addAddress(addressModel)){return ResultVo.success(addressModel);}return ResultVo.fail(ErrorMsg.SYSTEM_ERROR);}@PostMapping("/update")public ResultVo updateAddress(@CookieValue("shUserId")@NotNull(message = "登录异常 请重新登录")@NotEmpty(message = "登录异常 请重新登录") String shUserId,@RequestBody AddressModel addressModel){addressModel.setUserId(Long.valueOf(shUserId));if(addressService.updateAddress(addressModel)){return ResultVo.success();}return ResultVo.fail(ErrorMsg.SYSTEM_ERROR);}@PostMapping("/delete")public ResultVo deleteAddress(@CookieValue("shUserId")@NotNull(message = "登录异常 请重新登录")@NotEmpty(message = "登录异常 请重新登录") String shUserId,@RequestBody AddressModel addressModel){addressModel.setUserId(Long.valueOf(shUserId));if(addressService.deleteAddress(addressModel)){return ResultVo.success();}return ResultVo.fail(ErrorMsg.SYSTEM_ERROR);}
}
package com.second.hand.trading.server.controller;import com.second.hand.trading.server.enums.ErrorMsg;
import com.second.hand.trading.server.model.AdminModel;
import com.second.hand.trading.server.model.IdleItemModel;
import com.second.hand.trading.server.model.UserModel;
import com.second.hand.trading.server.service.AdminService;
import com.second.hand.trading.server.service.IdleItemService;
import com.second.hand.trading.server.service.OrderService;
import com.second.hand.trading.server.service.UserService;
import com.second.hand.trading.server.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpSession;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
@CrossOrigin
@RestController
@RequestMapping("admin")
public class AdminController {@Autowiredprivate AdminService adminService;@Autowiredprivate IdleItemService idleItemService;@Autowiredprivate OrderService orderService;@Autowiredprivate UserService userService;@GetMapping("login")public ResultVo login(@RequestParam("accountNumber") @NotNull @NotEmpty String accountNumber,@RequestParam("adminPassword") @NotNull @NotEmpty String adminPassword,HttpSession session){AdminModel adminModel=adminService.login(accountNumber,adminPassword);if (null == adminModel) {return ResultVo.fail(ErrorMsg.EMAIL_LOGIN_ERROR);}session.setAttribute("admin",adminModel);return ResultVo.success(adminModel);}@GetMapping("loginOut")public ResultVo loginOut( HttpSession session){session.removeAttribute("admin");return ResultVo.success();}@GetMapping("list")public ResultVo getAdminList(HttpSession session,@RequestParam(value = "page",required = false) Integer page,@RequestParam(value = "nums",required = false) Integer nums){if(session.getAttribute("admin")==null){return ResultVo.fail(ErrorMsg.COOKIE_ERROR);}int p=1;int n=8;if(null!=page){p=page>0?page:1;}if(null!=nums){n=nums>0?nums:8;}return ResultVo.success(adminService.getAdminList(p,n));}@PostMapping("add")public ResultVo addAdmin(HttpSession session,@RequestBody AdminModel adminModel){if(session.getAttribute("admin")==null){return ResultVo.fail(ErrorMsg.COOKIE_ERROR);}if(adminService.addAdmin(adminModel)){return ResultVo.success();}return ResultVo.fail(ErrorMsg.PARAM_ERROR);}@GetMapping("idleList")public ResultVo idleList(HttpSession session,@RequestParam("status") @NotNull @NotEmpty Integer status,@RequestParam(value = "page",required = false) Integer page,@RequestParam(value = "nums",required = false) Integer nums){if(session.getAttribute("admin")==null){return ResultVo.fail(ErrorMsg.COOKIE_ERROR);}int p=1;int n=8;if(null!=page){p=page>0?page:1;}if(null!=nums){n=nums>0?nums:8;}return ResultVo.success(idleItemService.adminGetIdleList(status,p,n));}@GetMapping("updateIdleStatus")public ResultVo updateIdleStatus(HttpSession session,@RequestParam("id") @NotNull @NotEmpty Long id,@RequestParam("status") @NotNull @NotEmpty Integer status){if(session.getAttribute("admin")==null){return ResultVo.fail(ErrorMsg.COOKIE_ERROR);}IdleItemModel idleItemModel=new IdleItemModel();idleItemModel.setId(id);idleItemModel.setIdleStatus(status.byteValue());if(idleItemService.updateIdleItem(idleItemModel)){return ResultVo.success();}return ResultVo.fail(ErrorMsg.SYSTEM_ERROR);}@GetMapping("orderList")public ResultVo orderList(HttpSession session,@RequestParam(value = "page",required = false) Integer page,@RequestParam(value = "nums",required = false) Integer nums){if(session.getAttribute("admin")==null){return ResultVo.fail(ErrorMsg.COOKIE_ERROR);}int p=1;int n=8;if(null!=page){p=page>0?page:1;}if(null!=nums){n=nums>0?nums:8;}return ResultVo.success(orderService.getAllOrder(p,n));}@GetMapping("deleteOrder")public ResultVo deleteOrder(HttpSession session,@RequestParam("id") @NotNull @NotEmpty Long id){if(session.getAttribute("admin")==null){return ResultVo.fail(ErrorMsg.COOKIE_ERROR);}if(orderService.deleteOrder(id)){return ResultVo.success();}return ResultVo.fail(ErrorMsg.SYSTEM_ERROR);}@GetMapping("userList")public ResultVo userList(HttpSession session,@RequestParam(value = "page",required = false) Integer page,@RequestParam(value = "nums",required = false) Integer nums,@RequestParam("status") @NotNull @NotEmpty Integer status){if(session.getAttribute("admin")==null){return ResultVo.fail(ErrorMsg.COOKIE_ERROR);}int p=1;int n=8;if(null!=page){p=page>0?page:1;}if(null!=nums){n=nums>0?nums:8;}return ResultVo.success(userService.getUserByStatus(status,p,n));}@GetMapping("updateUserStatus")public ResultVo updateUserStatus(HttpSession session,@RequestParam("id") @NotNull @NotEmpty Long id,@RequestParam("status") @NotNull @NotEmpty Integer status){if(session.getAttribute("admin")==null){return ResultVo.fail(ErrorMsg.COOKIE_ERROR);}UserModel userModel=new UserModel();userModel.setId(id);userModel.setUserStatus(status.byteValue());if(userService.updateUserInfo(userModel))return ResultVo.success();return ResultVo.fail(ErrorMsg.SYSTEM_ERROR);}}
package com.second.hand.trading.server.controller;import com.second.hand.trading.server.enums.ErrorMsg;
import com.second.hand.trading.server.model.FavoriteModel;
import com.second.hand.trading.server.service.FavoriteService;
import com.second.hand.trading.server.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
@CrossOrigin
@RestController
@RequestMapping("/favorite")
public class FavoriteController {@Autowiredprivate FavoriteService favoriteService;@PostMapping("/add")public ResultVo addFavorite(@CookieValue("shUserId")@NotNull(message = "登录异常 请重新登录")@NotEmpty(message = "登录异常 请重新登录") String shUserId,@RequestBody FavoriteModel favoriteModel){favoriteModel.setUserId(Long.valueOf(shUserId));favoriteModel.setCreateTime(new Date());if(favoriteService.addFavorite(favoriteModel)){return ResultVo.success(favoriteModel.getId());}return ResultVo.fail(ErrorMsg.FAVORITE_EXIT);}@GetMapping("/delete")public ResultVo deleteFavorite(@CookieValue("shUserId")@NotNull(message = "登录异常 请重新登录")@NotEmpty(message = "登录异常 请重新登录") String shUserId,@RequestParam Long id){if(favoriteService.deleteFavorite(id)){return ResultVo.success();}return ResultVo.fail(ErrorMsg.SYSTEM_ERROR);}@GetMapping("/check")public ResultVo checkFavorite(@CookieValue("shUserId")@NotNull(message = "登录异常 请重新登录")@NotEmpty(message = "登录异常 请重新登录") String shUserId,@RequestParam Long idleId){return ResultVo.success(favoriteService.isFavorite(Long.valueOf(shUserId),idleId));}@GetMapping("/my")public ResultVo getMyFavorite(@CookieValue("shUserId")@NotNull(message = "登录异常 请重新登录")@NotEmpty(message = "登录异常 请重新登录") String shUserId){return ResultVo.success(favoriteService.getAllFavorite(Long.valueOf(shUserId)));}
}
六、底部获取项目和8000字论文参考(9.9¥)
有问题,或者需要协助调试运行项目的也可以