package com.ruoyi.demo.entity.vo; import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.format.DateTimeFormat; import com.alibaba.excel.annotation.format.NumberFormat; import com.alibaba.excel.converters.bigdecimal.BigDecimalNumberConverter; import com.alibaba.excel.converters.date.DateStringConverter; import com.ruoyi.demo.entity.Order; import lombok.Data; import java.math.BigDecimal; import java.util.Date; @Data public class OrderVo { @ExcelProperty(value = "订单编码") private String orderId; @ExcelIgnore private String appName; @ExcelProperty(value = "商品名称") private String goodsName; @ExcelProperty(value = "规格") private String specs; @ExcelProperty(value = "单价", converter = BigDecimalNumberConverter.class) @NumberFormat("#.##") private BigDecimal goodsPrice; @ExcelProperty(value = "订单总额", converter = BigDecimalNumberConverter.class) @NumberFormat("#.##") private BigDecimal totalPrice; @ExcelProperty(value = "交易状态") private String state; @ExcelProperty(value = "买家") private String userName; @ExcelProperty(value = "卖家") private String vendorName; @ExcelProperty(value = "创建时间", converter = DateStringConverter.class) @DateTimeFormat("yyyy-MM-dd HH:mm:ss") private Date createTime; public OrderVo(){} public OrderVo(Order order){ this.orderId = order.getOrderId(); this.appName = order.getAppName(); this.goodsName = order.getGoodsName(); this.specs = order.getSpecs(); this.goodsPrice = order.getGoodsPrice(); this.totalPrice = order.getTotalPrice(); this.state = order.getState(); this.userName = order.getUserName(); this.vendorName = order.getVendorName(); this.createTime = order.getCreateTime(); } }