开通产品,修改订单状态
This commit is contained in:
@@ -133,8 +133,6 @@ public class OrderController extends BaseController {
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("修改订单")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody Order order) {
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.system.entity.Order;
|
||||
import com.gxwebsoft.common.system.entity.OrderGoods;
|
||||
import com.gxwebsoft.common.system.entity.User;
|
||||
import com.gxwebsoft.common.system.param.OrderGoodsParam;
|
||||
import com.gxwebsoft.common.system.service.OrderGoodsService;
|
||||
import com.gxwebsoft.common.system.service.OrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -28,6 +32,8 @@ import java.util.List;
|
||||
public class OrderGoodsController extends BaseController {
|
||||
@Resource
|
||||
private OrderGoodsService orderGoodsService;
|
||||
@Resource
|
||||
private OrderService orderService;
|
||||
|
||||
@ApiOperation("分页查询订单商品")
|
||||
@GetMapping("/page")
|
||||
@@ -85,6 +91,22 @@ public class OrderGoodsController extends BaseController {
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@ApiOperation("修改订单商品状态")
|
||||
@PutMapping("/updateOrderStatus")
|
||||
public ApiResult<?> updateOrderStatus(@RequestBody OrderGoods orderGoods) {
|
||||
final User loginUser = getLoginUser();
|
||||
if (loginUser == null) {
|
||||
return fail("请先登录");
|
||||
}
|
||||
if (orderGoodsService.updateById(orderGoods)) {
|
||||
if (orderGoodsService.count(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderStatus,0).eq(OrderGoods::getOrderId,orderGoods.getOrderId())) == 0) {
|
||||
orderService.update(new LambdaUpdateWrapper<Order>().eq(Order::getOrderId,orderGoods.getOrderId()).set(Order::getOrderStatus,1));
|
||||
}
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:order:remove')")
|
||||
@ApiOperation("删除订单商品")
|
||||
@DeleteMapping("/{id}")
|
||||
|
||||
Reference in New Issue
Block a user