package com.controller;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.text.ParseException;
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.transaction.annotation.Transactional;
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.OrdersEntity;
import com.entity.view.OrdersView;
import com.service.OrdersService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MPUtil;
import com.utils.MapUtils;
import com.utils.CommonUtil;
import java.io.IOException;
/**
* 订单
* 后端接口
* @author
* @email
* @date 2024-04-10 13:23:28
*/
@RestController
@RequestMapping("/orders")
public class OrdersController {
@Autowired
private OrdersService ordersService;
/**
* 后台列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,OrdersEntity orders,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("shangjia")) {
orders.setDianpumingcheng((String)request.getSession().getAttribute("username"));
if(orders.getUserid()!=null) {
orders.setUserid(null);
}
}
else {
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
orders.setUserid((Long)request.getSession().getAttribute("userId"));
}
}
EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();
PageUtils page = ordersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, orders), params), params));
return R.ok().put("data", page);
}
/**
* 前台列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,OrdersEntity orders,
HttpServletRequest request){
EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();
PageUtils page = ordersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, orders), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( OrdersEntity orders){
EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();
ew.allEq(MPUtil.allEQMapPre( orders, "orders"));
return R.ok().put("data", ordersService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(OrdersEntity orders){
EntityWrapper< OrdersEntity> ew = new EntityWrapper< OrdersEntity>();
ew.allEq(MPUtil.allEQMapPre( orders, "orders"));
OrdersView ordersView = ordersService.selectView(ew);
return R.ok("查询订单成功").put("data", ordersView);
}
/**
* 后台详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
OrdersEntity orders = ordersService.selectById(id);
return R.ok().put("data", orders);
}
/**
* 前台详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
OrdersEntity orders = ordersService.selectById(id);
return R.ok().put("data", orders);
}
/**
* 后台保存
*/
@RequestMapping("/save")
public R save(@RequestBody OrdersEntity orders, HttpServletRequest request){
//ValidatorUtils.validateEntity(orders);
orders.setUserid((Long)request.getSession().getAttribute("userId"));
ordersService.insert(orders);
return R.ok();
}
/**
* 前台保存
*/
@RequestMapping("/add")
public R add(@RequestBody OrdersEntity orders, HttpServletRequest request){
//ValidatorUtils.validateEntity(orders);
ordersService.insert(orders);
return R.ok();
}
/**
* 获取用户密保
*/
@RequestMapping("/security")
@IgnoreAuth
public R security(@RequestParam String username){
OrdersEntity orders = ordersService.selectOne(new EntityWrapper<OrdersEntity>().eq("", username));
return R.ok().put("data", orders);
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
@IgnoreAuth
public R update(@RequestBody OrdersEntity orders, HttpServletRequest request){
//ValidatorUtils.validateEntity(orders);
ordersService.updateById(orders);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
ordersService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 前台智能排序
*/
@IgnoreAuth
@RequestMapping("/autoSort")
public R autoSort(@RequestParam Map<String, Object> params,OrdersEntity orders, HttpServletRequest request,String pre){
EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();
Map<String, Object> newMap = new HashMap<String, Object>();
Map<String, Object> param = new HashMap<String, Object>();
Iterator<Map.Entry<String, Object>> it = param.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next();
String key = entry.getKey();
String newKey = entry.getKey();
if (pre.endsWith(".")) {
newMap.put(pre + newKey, entry.getValue());
} else if (StringUtils.isEmpty(pre)) {
newMap.put(newKey, entry.getValue());
} else {
newMap.put(pre + "." + newKey, entry.getValue());
}
}
params.put("sort", "clicktime");
params.put("order", "desc");
PageUtils page = ordersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, orders), params), params));
return R.ok().put("data", page);
}
/**
* (按值统计)
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}")
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("shangjia")) {
ew.eq("dianpumingcheng", (String)request.getSession().getAttribute("username"));
}
ew.in("status", new String[]{"已支付","已发货","已完成"}).ne("type",2);
List<Map<String, Object>> result = ordersService.selectValue(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date
没有合适的资源?快使用搜索试试~ 我知道了~
【java毕业设计】餐饮连锁店管理系统的设计与实现(springboot+vue+mysql+说明文档).zip
共671个文件
java:188个
svg:159个
vue:97个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 51 浏览量
2024-11-08
16:33:05
上传
评论
收藏 32.8MB ZIP 举报
温馨提示
项目经过测试均可完美运行! 环境说明: 开发语言:java 框架:springboot jdk版本:jdk1.8 数据库:mysql 5.7+ 数据库工具:Navicat11+ 管理工具:maven 开发工具:idea/eclipse 部署容器:tomcat7+
资源推荐
资源详情
资源评论
收起资源包目录
【java毕业设计】餐饮连锁店管理系统的设计与实现(springboot+vue+mysql+说明文档).zip (671个子文件)
main.js.bak 2KB
3-build.bat 15B
2-run.bat 14B
build.bat 14B
run.bat 14B
1-install.bat 12B
install.bat 12B
.classpath 2KB
mvnw.cmd 7KB
app.6918e4f1.css 559KB
chunk-vendors.1622b503.css 312KB
app.10e6ea44.css 277KB
chunk-vendors.1f0a25b2.css 37KB
swiper.min.css 13KB
swiper.min.css 13KB
iconfont.css 622B
canvas-bg-1.css 391B
canvas-bg-2.css 83B
canvas-bg-3.css 61B
.factorypath 15KB
.gitignore 364B
index.html 1KB
index.html 1KB
index.html 1KB
index.html 976B
favicon.ico 4KB
favicon.ico 4KB
favicon.ico 4KB
favicon.ico 4KB
maven-wrapper.jar 50KB
OrdersController.java 13KB
MeishixinxiController.java 11KB
BaiduUtil.java 9KB
NewsController.java 9KB
EncryptUtil.java 8KB
YonghuController.java 8KB
AddressController.java 8KB
ShangjiaController.java 8KB
CommonController.java 7KB
OrdersEntity.java 7KB
DiscussmeishixinxiController.java 7KB
SystemintroController.java 7KB
StoreupController.java 7KB
MessagesController.java 7KB
NewstypeController.java 6KB
MPUtil.java 6KB
CartController.java 6KB
AboutusController.java 6KB
MeishixinxiEntity.java 6KB
OrdersModel.java 6KB
CailiaoxinxiController.java 6KB
OrdersVO.java 6KB
CailiaocaigouController.java 6KB
CailiaochukuController.java 6KB
UsersController.java 5KB
CailiaofenleiController.java 5KB
MeishifenleiController.java 5KB
NewsEntity.java 5KB
MavenWrapperDownloader.java 5KB
MeishixinxiModel.java 5KB
MeishixinxiVO.java 5KB
FileController.java 4KB
YonghuEntity.java 4KB
CommonUtil.java 4KB
CartEntity.java 4KB
CailiaoxinxiEntity.java 4KB
NewsModel.java 4KB
StoreupEntity.java 4KB
ShangjiaEntity.java 4KB
NewsVO.java 4KB
MessagesEntity.java 4KB
CailiaocaigouEntity.java 3KB
AuthorizationInterceptor.java 3KB
DiscussmeishixinxiEntity.java 3KB
SystemintroEntity.java 3KB
AboutusEntity.java 3KB
CailiaochukuEntity.java 3KB
ConfigController.java 3KB
YonghuModel.java 3KB
AddressEntity.java 3KB
CartModel.java 3KB
YonghuVO.java 3KB
CailiaoxinxiModel.java 3KB
HttpClientUtils.java 3KB
CartVO.java 3KB
CailiaoxinxiVO.java 3KB
Query.java 3KB
StoreupModel.java 2KB
TokenServiceImpl.java 2KB
OrdersServiceImpl.java 2KB
ShangjiaModel.java 2KB
MessagesModel.java 2KB
StoreupVO.java 2KB
CailiaocaigouModel.java 2KB
ShangjiaVO.java 2KB
MessagesVO.java 2KB
TokenEntity.java 2KB
DiscussmeishixinxiServiceImpl.java 2KB
CailiaofenleiEntity.java 2KB
CailiaocaigouVO.java 2KB
共 671 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
计算机学长阿伟
- 粉丝: 3192
- 资源: 698
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 中国光伏电站安装时间的多边形地理空间数据集(2010-2022年)-最新出炉.zip
- 几种常见简单滤波器用于二维图像降噪,包括均值、中值、高斯、低通、双边滤波器,语言是python
- 二手车管理系统,pc端,小程序端,java后端
- 2011-2022年中国光伏电站遥感识别面矢量数据-最新出炉.zip
- 基于深度学习的边缘计算网络的卸载优化及资源优化python源码+文档说明(高分项目)
- 基于yolov5+超声图像的钢轨缺陷检测python源码+数据集(高分毕设)
- 基于大语言模型的智能审计问答系统python源码+文档说明(高分项目)
- C++程序设计编程题库
- javase停车场管理系统答辩PPT(高级版)
- javase的停车场管理系统(高级版)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功