开发工具:IDEA
服务器:Tomcat9.0, jdk1.8
项目构建:maven
数据库:mysql5.7
系统分前后台,非前后端分离
前端技术:vue.js+elementUI等框架实现
服务端技术:springboot+mybatis-plus
项目功能描述:
系统主要分为三个角色:用户、卖家、管理员
用户功能:登录、注册、首页、个人中心、订单管理、商品求购管理、我的收藏
卖家功能:登录、注册、首页、个人中心、商品信息管理、订单管理
管理员功能:登录、首页、个人中心、用户管理、卖家管理、商品分类管理、订单管理、商品求购管理、管理员管理、留言板管理、系统管理
前台截图:
用户截图:
卖家截图:
管理员截图:
package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
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 com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.ErshoudingdanEntity;
import com.entity.view.ErshoudingdanView;
import com.service.ErshoudingdanService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 二手订单
* 后端接口
* @author
* @email
* @date 2021-02-22 15:46:58
*/
@RestController
@RequestMapping("/ershoudingdan")
public class ErshoudingdanController {
@Autowired
private ErshoudingdanService ershoudingdanService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,ErshoudingdanEntity ershoudingdan, HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("maijia")) {
ershoudingdan.setMaijiazhanghao((String)request.getSession().getAttribute("username"));
}
if(tableName.equals("yonghu")) {
ershoudingdan.setYonghuming((String)request.getSession().getAttribute("username"));
}
EntityWrapper<ErshoudingdanEntity> ew = new EntityWrapper<ErshoudingdanEntity>();
PageUtils page = ershoudingdanService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, ershoudingdan), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,ErshoudingdanEntity ershoudingdan, HttpServletRequest request){
EntityWrapper<ErshoudingdanEntity> ew = new EntityWrapper<ErshoudingdanEntity>();
PageUtils page = ershoudingdanService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, ershoudingdan), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( ErshoudingdanEntity ershoudingdan){
EntityWrapper<ErshoudingdanEntity> ew = new EntityWrapper<ErshoudingdanEntity>();
ew.allEq(MPUtil.allEQMapPre( ershoudingdan, "ershoudingdan"));
return R.ok().put("data", ershoudingdanService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(ErshoudingdanEntity ershoudingdan){
EntityWrapper< ErshoudingdanEntity> ew = new EntityWrapper< ErshoudingdanEntity>();
ew.allEq(MPUtil.allEQMapPre( ershoudingdan, "ershoudingdan"));
ErshoudingdanView ershoudingdanView = ershoudingdanService.selectView(ew);
return R.ok("查询二手订单成功").put("data", ershoudingdanView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
ErshoudingdanEntity ershoudingdan = ershoudingdanService.selectById(id);
return R.ok().put("data", ershoudingdan);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
ErshoudingdanEntity ershoudingdan = ershoudingdanService.selectById(id);
return R.ok().put("data", ershoudingdan);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody ErshoudingdanEntity ershoudingdan, HttpServletRequest request){
ershoudingdan.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(ershoudingdan);
ershoudingdanService.insert(ershoudingdan);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody ErshoudingdanEntity ershoudingdan, HttpServletRequest request){
ershoudingdan.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(ershoudingdan);
ershoudingdanService.insert(ershoudingdan);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody ErshoudingdanEntity ershoudingdan, HttpServletRequest request){
//ValidatorUtils.validateEntity(ershoudingdan);
ershoudingdanService.updateById(ershoudingdan);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
ershoudingdanService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<ErshoudingdanEntity> wrapper = new EntityWrapper<ErshoudingdanEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("maijia")) {
wrapper.eq("maijiazhanghao", (String)request.getSession().getAttribute("username"));
}
if(tableName.equals("yonghu")) {
wrapper.eq("yonghuming", (String)request.getSession().getAttribute("username"));
}
int count = ershoudingdanService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
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 com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.ShangpinfenleiEntity;
import com.entity.view.ShangpinfenleiView;
import com.service.ShangpinfenleiService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
-
商品分类
-
后端接口
-
@author
-
@email
-
@date 2021-02-22 15:46:58
*/
@RestController
@RequestMapping(“/shangpinfenlei”)
public class ShangpinfenleiController {
@Autowired
private ShangpinfenleiService shangpinfenleiService;/**
-
后端列表
*/
@RequestMapping(“/page”)
public R page(@RequestParam Map<String, Object> params,ShangpinfenleiEntity shangpinfenlei, HttpServletRequest request){
EntityWrapper ew = new EntityWrapper();
PageUtils page = shangpinfenleiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangpinfenlei), params), params));return R.ok().put(“data”, page);
}
/**
- 前端列表
*/
@RequestMapping(“/list”)
public R list(@RequestParam Map<String, Object> params,ShangpinfenleiEntity shangpinfenlei, HttpServletRequest request){
EntityWrapper ew = new EntityWrapper();
PageUtils page = shangpinfenleiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, shangpinfenlei), params), params));
return R.ok().put(“data”, page);
}
/**
- 列表
*/
@RequestMapping(“/lists”)
public R list( ShangpinfenleiEntity shangpinfenlei){
EntityWrapper ew = new EntityWrapper();
ew.allEq(MPUtil.allEQMapPre( shangpinfenlei, “shangpinfenlei”));
return R.ok().put(“data”, shangpinfenleiService.selectListView(ew));
}
/**
- 查询
*/
@RequestMapping(“/query”)
public R query(ShangpinfenleiEntity shangpinfenlei){
EntityWrapper< ShangpinfenleiEntity> ew = new EntityWrapper< ShangpinfenleiEntity>();
ew.allEq(MPUtil.allEQMapPre( shangpinfenlei, “shangpinfenlei”));
ShangpinfenleiView shangpinfenleiView = shangpinfenleiService.selectView(ew);
return R.ok(“查询商品分类成功”).put(“data”, shangpinfenleiView);
}
/**
- 后端详情
*/
@RequestMapping(“/info/{id}”)
public R info(@PathVariable(“id”) Long id){
ShangpinfenleiEntity shangpinfenlei = shangpinfenleiService.selectById(id);
return R.ok().put(“data”, shangpinfenlei);
}
/**
- 前端详情
*/
@RequestMapping(“/detail/{id}”)
public R detail(@PathVariable(“id”) Long id){
ShangpinfenleiEntity shangpinfenlei = shangpinfenleiService.selectById(id);
return R.ok().put(“data”, shangpinfenlei);
}
/**
- 后端保存
*/
@RequestMapping(“/save”)
public R save(@RequestBody ShangpinfenleiEntity shangpinfenlei, HttpServletRequest request){
shangpinfenlei.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(shangpinfenlei);
shangpinfenleiService.insert(shangpinfenlei);
return R.ok();
}
/**
- 前端保存
*/
@RequestMapping(“/add”)
public R add(@RequestBody ShangpinfenleiEntity shangpinfenlei, HttpServletRequest request){
shangpinfenlei.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(shangpinfenlei);
shangpinfenleiService.insert(shangpinfenlei);
return R.ok();
}
/**
- 修改
*/
@RequestMapping(“/update”)
public R update(@RequestBody ShangpinfenleiEntity shangpinfenlei, HttpServletRequest request){
//ValidatorUtils.validateEntity(shangpinfenlei);
shangpinfenleiService.updateById(shangpinfenlei);//全部更新
return R.ok();
}
/**
- 删除
*/
@RequestMapping(“/delete”)
public R delete(@RequestBody Long[] ids){
shangpinfenleiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
-
提醒接口
*/
@RequestMapping(“/remind/{columnName}/{type}”)
public R remindCount(@PathVariable(“columnName”) String columnName, HttpServletRequest request,
@PathVariable(“type”) String type,@RequestParam Map<String, Object> map) {
map.put(“column”, columnName);
map.put(“type”, type);if(type.equals(“2”)) {
SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd”);
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get(“remindstart”)!=null) {
Integer remindStart = Integer.parseInt(map.get(“remindstart”).toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put(“remindstart”, sdf.format(remindStartDate));
}
if(map.get(“remindend”)!=null) {
Integer remindEnd = Integer.parseInt(map.get(“remindend”).toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put(“remindend”, sdf.format(remindEndDate));
}
}Wrapper wrapper = new EntityWrapper();
if(map.get(“remindstart”)!=null) {
wrapper.ge(columnName, map.get(“remindstart”));
}
if(map.get(“remindend”)!=null) {
wrapper.le(columnName, map.get(“remindend”));
}int count = shangpinfenleiService.selectCount(wrapper);
return R.ok().put(“count”, count);
}
-
}