📄 torder.java
字号:
package com.bsw.order.base;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 记录订单的详细信息
*
* @version 1.1
* @author 蜗牛
*
*/
public class Torder {
/**
* 订单id
*/
private int orderid;
/**
* 订单的名字
*/
private String ordercode;
/**
* 订单的发起者
*/
private String buyer;
/**
* 商品的总额
*/
private double sum;
/**
* 购买方式
*/
private String deliverymethod;
/**
* 最后一次修改时间
*/
private String lastmodifydate;
/**
* 创造订单的时间
*/
private String createddate;
/**
* 默认构造函数
*/
Date date = new Date();
DateFormat sdf=new SimpleDateFormat("yyyy-MM-dd-hh:mm:ss aa");
String time = sdf.format(date);
public Torder() {
this.ordercode = "";
this.buyer = "";
this.sum = 0;
this.deliverymethod = "自取";
this.lastmodifydate = time;
this.createddate = time;
}
/**
* 构造器 将赋初值分别给属性ordercode,buyer,sum,
* deliverymethod,lastmodifydate,createdate
*/
public Torder(String ordercode, String buyer, double sum,
String deliverymethod, Date lastmodifydate, Date createddate) {
super();
this.ordercode = ordercode;
this.buyer = buyer;
this.sum = sum;
this.deliverymethod = deliverymethod;
this.lastmodifydate = time;
this.createddate = time;
}
/**
* 构造器 将赋初值分别给属性orderid,ordercode,buyer,sum,
* deliverymethod,lastmodifyString,createString
*/
public Torder(int orderid, String ordercode, String buyer, double sum,
String deliverymethod, String lastmodifydate, String createddate) {
super();
this.orderid = orderid;
this.ordercode = ordercode;
this.buyer = buyer;
this.sum = sum;
this.deliverymethod = deliverymethod;
this.lastmodifydate =lastmodifydate;
this.createddate = createddate;
}
/**
* 返回购买者
*/
public String getBuyer() {
return buyer;
}
/**
* 设置购买者
*/
public void setBuyer(String buyer) {
this.buyer = buyer;
}
/**
* 返回创造日期
*/
public String getCreateddate() {
return createddate;
}
/**
* 设置创造日期
*/
public void setCreateddate(String createdString) {
this.createddate = createdString;
}
/**
* 返回购买方式
*/
public String getDeliverymethod() {
return deliverymethod;
}
/**
* 设置购买方式
*/
public void setDeliverymethod(String deliverymethod) {
this.deliverymethod = deliverymethod;
}
/**
* 返回上次的修改日期
*/
public String getLastmodifydate() {
return lastmodifydate;
}
/**
* 设置上次的修改日期
*/
public void setLastmodifydate(String lastmodifydate) {
this.lastmodifydate=lastmodifydate;
}
/**
* 返回订单的名字
*/
public String getOrdercode() {
return ordercode;
}
/**
* 设置订单的名字
*/
public void setOrdercode(String ordercode) {
this.ordercode = ordercode;
}
/**
* 返回订单的ID
*/
public int getOrderid() {
return orderid;
}
/**
* 设置订单的ID
*/
public void setOrderid(int orderid) {
this.orderid = orderid;
}
/**
* 取得总额
*/
public double getSum() {
return sum;
}
/**
* 设置总额
*/
public void setSum(double sum) {
this.sum = sum;
}
/**
* 用来测试并打印order的详细信息
*/
public String toString() {
return this.getBuyer() + "买了" + this.getSum() + "个"
+ this.getOrdercode();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -