admin 管理员组文章数量: 1087652
基于java+springboot+mybatis+vue+elementui的古玩玉器交易系统
项目介绍
随着中国互联网的发展。上网的网民越来越多。拥有网络购物习惯的网民也越来越多。网上购物平台纷拥而出。如淘宝网。京东商城。拉手网等众多购物平台。
古玩玉器行业龙头公司也纷纷踏足网络购物平台。利用网络平台扩大知名度,提升业务量。某玉器公司有必要利用现有的网络平台,技术优势,业务优势,迅速建立网络购物平台,拉近与对手在网络上的差距。并以在线订购业务、关键字竞价排名功能、网上搜索业务做为首期的业务开拓重点,充分利用互联网广大的用户资源,网络资源,及多年的品牌优势,继续保持并提升公司在网络方面的知名度,提升用户心中品牌形象,扩大宣传。故而提出开发网络购物平台的需求。
系统将增加系统管理员,商品由系统管理员维护,在橱窗或商品展示页面显示有关商品,用户选择商品,生成订单,订单提交到系统后台。
开发环境
开发语言:Java
数据库 :MySQL
系统架构:B/S
后端框架:SpringBoot
前端框架:Vue
开发工具:IDEA或者Eclipse,JDK1.8,Maven
系统截图
部分代码
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.format.annotation.DateTimeFormat;
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.CartEntity;
import com.entity.view.CartView;import com.service.CartService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;/*** 购物车表* 后端接口*/
@RestController
@RequestMapping("/cart")
public class CartController {@Autowiredprivate CartService cartService;/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params,CartEntity cart,HttpServletRequest request){if(!request.getSession().getAttribute("role").toString().equals("管理员")) {cart.setUserid((Long)request.getSession().getAttribute("userId"));}EntityWrapper<CartEntity> ew = new EntityWrapper<CartEntity>();PageUtils page = cartService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cart), params), params));return R.ok().put("data", page);}/*** 前端列表*/@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params,CartEntity cart, HttpServletRequest request){EntityWrapper<CartEntity> ew = new EntityWrapper<CartEntity>();PageUtils page = cartService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cart), params), params));return R.ok().put("data", page);}/*** 列表*/@RequestMapping("/lists")public R list( CartEntity cart){EntityWrapper<CartEntity> ew = new EntityWrapper<CartEntity>();ew.allEq(MPUtil.allEQMapPre( cart, "cart")); return R.ok().put("data", cartService.selectListView(ew));}/*** 查询*/@RequestMapping("/query")public R query(CartEntity cart){EntityWrapper< CartEntity> ew = new EntityWrapper< CartEntity>();ew.allEq(MPUtil.allEQMapPre( cart, "cart")); CartView cartView = cartService.selectView(ew);return R.ok("查询购物车表成功").put("data", cartView);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id){CartEntity cart = cartService.selectById(id);return R.ok().put("data", cart);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id){CartEntity cart = cartService.selectById(id);return R.ok().put("data", cart);}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody CartEntity cart, HttpServletRequest request){cart.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(cart);cart.setUserid((Long)request.getSession().getAttribute("userId"));cartService.insert(cart);return R.ok();}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody CartEntity cart, HttpServletRequest request){cart.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());//ValidatorUtils.validateEntity(cart);cartService.insert(cart);return R.ok();}/*** 修改*/@RequestMapping("/update")public R update(@RequestBody CartEntity cart, HttpServletRequest request){//ValidatorUtils.validateEntity(cart);cartService.updateById(cart);//全部更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Long[] ids){cartService.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<CartEntity> wrapper = new EntityWrapper<CartEntity>();if(map.get("remindstart")!=null) {wrapper.ge(columnName, map.get("remindstart"));}if(map.get("remindend")!=null) {wrapper.le(columnName, map.get("remindend"));}if(!request.getSession().getAttribute("role").toString().equals("管理员")) {wrapper.eq("userid", (Long)request.getSession().getAttribute("userId"));}int count = cartService.selectCount(wrapper);return R.ok().put("count", count);}}
本文标签: 基于javaspringbootmybatisvueelementui的古玩玉器交易系统
版权声明:本文标题:基于java+springboot+mybatis+vue+elementui的古玩玉器交易系统 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/b/1687331703a90455.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论