日期:2014-05-19 浏览次数:20935 次
public class GoodsBill {
private Goods goods;
private int income;
private float price;
}
public class Bill {
private int billId;
private List<GoodsBill>;
}
create table t_bill (
id bigint not null auto_increment,
income integer,
price integer,
good_id bigint,
primary key (id)
)
create table t_good (
id bigint not null auto_increment,
name varchar(255),
primary key (id)
)
alter table t_bill
add index FKCB5B04F2C812F5E7 (good_id),
add constraint FKCB5B04F2C812F5E7
foreign key (good_id)
references t_good (id)
------解决方案--------------------
商品类:id<主键>,gcode<商品编号>,name<商品名称>,price<单价>,model<商品型号>...
定单类:id<主键>,bcode<订单编号>,customer<客户名称>,bdate<订单日期>...
订单详单类<订单子类>:id<主键>,bocde<外键>,gcode<外键>,amout<数量>,total<总价>...
订单与详单是一对多的关系。
简单写一下,LZ可以自由发挥