From 438f1f1d8f736fb2b97ba0ac46fa6fcb440cf4e7 Mon Sep 17 00:00:00 2001 From: NH-LHG Date: Mon, 5 Jun 2023 23:12:53 +0800 Subject: [PATCH] =?UTF-8?q?[update]=E5=88=9B=E5=BB=BA=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jeecg/modules/demo/erp/controller/OrderController.java | 6 ++++++ .../main/java/org/jeecg/modules/demo/erp/vo/OrderPage.java | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/controller/OrderController.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/controller/OrderController.java index 7bbe646..0207774 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/controller/OrderController.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/controller/OrderController.java @@ -9,6 +9,7 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -90,6 +91,11 @@ public class OrderController { @PostMapping(value = "/add") public Result add(@RequestBody OrderPage orderPage) { Order order = new Order(); + Long orderId = IdWorker.getId(); + order.setId(orderId); + orderPage.getOrderDetailList().forEach(e ->{ + e.setOrderId(orderId); + }); BeanUtils.copyProperties(orderPage, order); orderService.saveMain(order, orderPage.getOrderDetailList()); return Result.OK("添加成功!"); diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/vo/OrderPage.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/vo/OrderPage.java index a281d6b..b4e5277 100644 --- a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/vo/OrderPage.java +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/erp/vo/OrderPage.java @@ -1,15 +1,12 @@ package org.jeecg.modules.demo.erp.vo; import java.util.List; -import org.jeecg.modules.demo.erp.entity.Order; import org.jeecg.modules.demo.erp.entity.OrderDetail; import lombok.Data; import org.jeecgframework.poi.excel.annotation.Excel; -import org.jeecgframework.poi.excel.annotation.ExcelEntity; import org.jeecgframework.poi.excel.annotation.ExcelCollection; import com.fasterxml.jackson.annotation.JsonFormat; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; import org.jeecg.common.aspect.annotation.Dict; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -26,7 +23,7 @@ public class OrderPage { /**id*/ @ApiModelProperty(value = "id") - private java.lang.Integer id; + private java.lang.Long id; /**收件人*/ @Excel(name = "收件人", width = 15) @ApiModelProperty(value = "收件人")