diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderGoodsController.java b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderGoodsController.java new file mode 100644 index 00000000..cd10ac02 --- /dev/null +++ b/ghy-admin/src/main/java/com/ghy/web/controller/order/OrderGoodsController.java @@ -0,0 +1,88 @@ +package com.ghy.web.controller.order; + +import com.ghy.common.annotation.Log; +import com.ghy.common.core.controller.BaseController; +import com.ghy.common.core.domain.AjaxResult; +import com.ghy.common.core.page.TableDataInfo; +import com.ghy.common.core.text.Convert; +import com.ghy.common.enums.BusinessType; +import com.ghy.common.utils.poi.ExcelUtil; +import com.ghy.order.domain.OrderGoods; +import com.ghy.order.domain.OrderMaster; +import com.ghy.order.service.OrderGoodsService; +import com.ghy.order.service.OrderMasterService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 订单商品API + * + * @author HH 2022/4/25 + */ +@Controller +@RequestMapping("/order/goods") +public class OrderGoodsController extends BaseController { + + private final String prefix = "order/goods"; + + @Resource + private OrderGoodsService orderGoodsService; + @Resource + private OrderMasterService orderMasterService; + + @RequiresPermissions("order:goods:view") + @GetMapping() + public String orderGoods(Long orderId, ModelMap mmap) { + OrderMaster orderMaster = orderMasterService.selectById(orderId); + mmap.put("orderMaster", orderMaster); + return prefix; + } + + @RequiresPermissions("order:goods:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(OrderGoods orderGoods) { + startPage(); + List list = orderGoodsService.selectOrderGoodsList(orderGoods); + return getDataTable(list); + } + + @Log(title = "主订单管理", businessType = BusinessType.EXPORT) + @RequiresPermissions("order:goods:export") + @PostMapping("/export") + @ResponseBody + public AjaxResult export(OrderGoods orderGoods) { + List list = orderGoodsService.selectOrderGoodsList(orderGoods); + ExcelUtil util = new ExcelUtil<>(OrderGoods.class); + return util.exportExcel(list, "主订单数据"); + } + + @RequiresPermissions("order:goods:remove") + @Log(title = "主订单管理", businessType = BusinessType.DELETE) + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) { + try { + Long[] idArray = Convert.toLongArray(ids); + return toAjax(orderGoodsService.deleteOrderGoodsByIds(idArray)); + } catch (Exception e) { + return error(e.getMessage()); + } + } + + /** + * 修改主订单 + */ + @RequiresPermissions("order:goods:edit") + @GetMapping("/edit/{orderGoodsId}") + public String edit(@PathVariable("orderGoodsId") Long orderGoodsId, ModelMap mmap) { + mmap.put("orderGoods", orderGoodsService.selectById(orderGoodsId)); + return prefix + "/edit"; + } + +} diff --git a/ghy-admin/src/main/resources/templates/order/goods.html b/ghy-admin/src/main/resources/templates/order/goods.html new file mode 100644 index 00000000..375afb01 --- /dev/null +++ b/ghy-admin/src/main/resources/templates/order/goods.html @@ -0,0 +1,91 @@ + + + + + + + + + + +
+
+
+
+
+ +
+
+
+
+
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/ghy-admin/src/main/resources/templates/order/master.html b/ghy-admin/src/main/resources/templates/order/master.html index 1a0cd8e4..844c0eea 100644 --- a/ghy-admin/src/main/resources/templates/order/master.html +++ b/ghy-admin/src/main/resources/templates/order/master.html @@ -1,10 +1,12 @@ + +
@@ -99,7 +101,7 @@ field: 'orderType', title: '订单类型', align: 'center', - formatter: function(value, row, index) { + formatter: function (value, row, index) { return $.table.selectDictLabel(orderTypes, value); } }, @@ -111,7 +113,7 @@ field: 'payType', title: '付款类型', align: 'center', - formatter: function(value, row, index) { + formatter: function (value, row, index) { return $.table.selectDictLabel(payTypes, value); } }, @@ -140,7 +142,7 @@ align: 'left', formatter: function (value, row, index) { var actions = []; - actions.push('详情 '); + actions.push('详情 '); return actions.join(''); } }] @@ -149,8 +151,8 @@ } function detail(id) { - var url = prefix ; - $.modal.open("字典数据", url); + var url = "order/goods?orderId=" + id; + $.modal.open("商品信息", url); }