|
@@ -0,0 +1,68 @@
|
|
|
+package com.ruoyi.app.controller.shop;
|
|
|
+
|
|
|
+import com.ruoyi.app.annotation.PassToken;
|
|
|
+import com.ruoyi.app.shop.goods.domain.TbGoods;
|
|
|
+import com.ruoyi.app.shop.goods.service.ITbGoodsService;
|
|
|
+import com.ruoyi.app.shop.orders.domain.TbOrders;
|
|
|
+import com.ruoyi.app.shop.orders.service.ITbOrdersService;
|
|
|
+import com.ruoyi.app.shop.type.domain.TbGoodsType;
|
|
|
+import com.ruoyi.app.shop.type.service.ITbGoodsTypeService;
|
|
|
+import com.ruoyi.common.core.controller.BaseController;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 商品
|
|
|
+ *
|
|
|
+ * @author lishuwen
|
|
|
+ * @date 2020-10-02
|
|
|
+ */
|
|
|
+@Api(value = "订单", tags = "订单")
|
|
|
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
|
+@RestController
|
|
|
+@RequestMapping("/app/shop/orders")
|
|
|
+public class TbOrdersController extends BaseController {
|
|
|
+
|
|
|
+ private final ITbOrdersService service;
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "用户订单列表", notes = "用户订单列表")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo list(TbOrders orders) {
|
|
|
+ startPage();
|
|
|
+ List<TbOrders> list = service.selectTbOrdersListByUser(orders);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "订单详细信息", notes = "订单详细信息")
|
|
|
+ @GetMapping(value = "/detail/{id}")
|
|
|
+ public AjaxResult detail(@PathVariable("id") Long id) {
|
|
|
+ TbOrders orders = service.getById(id);
|
|
|
+ return AjaxResult.success(orders);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "取消订单", notes = "取消订单")
|
|
|
+ @GetMapping(value = "/cancel/{id}")
|
|
|
+ public AjaxResult cancel(@PathVariable("id") Long id) {
|
|
|
+ TbOrders orders = service.getById(id);
|
|
|
+ if (orders != null && orders.getState() == 0) {
|
|
|
+ orders.setState(-1);
|
|
|
+ service.updateById(orders);
|
|
|
+ return AjaxResult.success(orders);
|
|
|
+ }
|
|
|
+ return AjaxResult.error("订单不允许操作");
|
|
|
+
|
|
|
+ }
|
|
|
+}
|