[update]创建订单修改

master
NH-LHG 2 years ago
parent 7a63cdc02f
commit 438f1f1d8f

@ -9,6 +9,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ExportParams;
@ -90,6 +91,11 @@ public class OrderController {
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<String> add(@RequestBody OrderPage orderPage) { public Result<String> add(@RequestBody OrderPage orderPage) {
Order order = new Order(); Order order = new Order();
Long orderId = IdWorker.getId();
order.setId(orderId);
orderPage.getOrderDetailList().forEach(e ->{
e.setOrderId(orderId);
});
BeanUtils.copyProperties(orderPage, order); BeanUtils.copyProperties(orderPage, order);
orderService.saveMain(order, orderPage.getOrderDetailList()); orderService.saveMain(order, orderPage.getOrderDetailList());
return Result.OK("添加成功!"); return Result.OK("添加成功!");

@ -1,15 +1,12 @@
package org.jeecg.modules.demo.erp.vo; package org.jeecg.modules.demo.erp.vo;
import java.util.List; import java.util.List;
import org.jeecg.modules.demo.erp.entity.Order;
import org.jeecg.modules.demo.erp.entity.OrderDetail; import org.jeecg.modules.demo.erp.entity.OrderDetail;
import lombok.Data; import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecgframework.poi.excel.annotation.ExcelEntity;
import org.jeecgframework.poi.excel.annotation.ExcelCollection; import org.jeecgframework.poi.excel.annotation.ExcelCollection;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import org.jeecg.common.aspect.annotation.Dict; import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -26,7 +23,7 @@ public class OrderPage {
/**id*/ /**id*/
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private java.lang.Integer id; private java.lang.Long id;
/**收件人*/ /**收件人*/
@Excel(name = "收件人", width = 15) @Excel(name = "收件人", width = 15)
@ApiModelProperty(value = "收件人") @ApiModelProperty(value = "收件人")

Loading…
Cancel
Save