OrderForm orderForm = new OrderForm();
orderForm.setAddIp((String) map.get("ip"));// ip
orderForm.setAddTime(new Date());// 日期
orderForm.setOrderStatus(10);// 订单状态
orderForm.setAddUserId((long) map.get("addUserId"));
orderForm.setOrderType((byte) 0);// 下单方式
orderForm.setInvoiceType(0);
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); // 时间格式精确到毫秒
String code = sdf.format(System.currentTimeMillis()); // 获得时间戳(毫秒)
orderForm.setOrderCode(map.get("userId") + code);// 订单号
orderForm.setMsg(storeAndGoodsVos.get(i).getMsg());
orderForm.setUserId((Long) map.get("userId"));
orderForm.setStoreId(storeAndGoodsVos.get(i).getStoreId());
orderForm.setTotalPrice((BigDecimal) map.get("totalPrice"));
orderForm.setOriginalPrice((BigDecimal) map.get("originalPrice"));
Address address = addressDao.findById((Long) map.get("addrId"));
Area area = new Area();
if (null != address) {
if (null != address.getArea()) {
area = address.getArea().getAreaByParentId();
}
}
orderForm.setAddress(address);
orderForm.setShopEvaluate(0);
orderForm.setIsDelete(false);
orderFormDao.save(orderForm);
if (orderForm.getOrderId() > 0) {
保存后报错 Field 'select TABLE_NAME
from information_schema.COLUMNS
is_delete' doesn't have a default value 但是我数据库表有is_delete字段 默认为0 实体类注解配置好了@Column(name = "is_delete")
public Boolean getIsDelete() {
return this.isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
之前好用 突然不好用了