Online Book Mall 6--order Module 1

Source: Internet
Author: User

1.sql

①t_orderitem a foreign key

Bname: Convenient late book deletion

CREATE TABLE ' T_orderitem ' (  ' Orderitemid ' char (+) NOT null,  ' quantity ' int (one) DEFAULT NULL,  ' subtotal ' Decimal (8,2) default NULL,  ' bid ' char (+) default null,  ' bname ' varchar ($) default null,  ' Currprice ' Decimal (8,2) default null,  ' image_b ' varchar (+) default NULL,  ' oid ' char (+) default NULL,  PRIMARY KEY (' Orderitemid '),  key ' Fk_t_orderitem_t_order ' (' oid '),  CONSTRAINT ' Fk_t_orderitem_t_order ' FOREIGN KEY (' oid ') ) REFERENCES ' T_order ' (' oid ')) Engine=innodb DEFAULT charset=utf8;insert into  ' T_orderitem ' (' Orderitemid ', ' Quantity ', ' Subtotal ', ' bid ', ' bname ', ' currprice ', ' image_b ', ' oid ') VALUES (' 01d2df3e5bb34e9f9d2477180c8d94d3 ', 1, ' 74.50 ', ' Ce01f15d435a4c51b0ad8202a318dca7 ', ' Java Programming Ideas (4th edition) ', ' 74.50 ', ' book_img/9317290-1_b.jpg ', ' C0841f4dfe7a43bfb183e4e82ae7914c ');

②t_order a foreign key

CREATE TABLE ' T_order ' (  ' oid ' char (+) NOT NULL,  ' Ordertime ' char (+) DEFAULT NULL,  ' Total ' decimal (10,2) DE FAULT null,  ' status ' int (one) default NULL,  ' address ' varchar (+) default NULL,  ' uid ' char (+) default null ,  PRIMARY key (' oid '),  key ' Fk_t_order_t_user ' (' uid '),  CONSTRAINT ' Fk_t_order_t_user ' FOREIGN KEY (' uid ') REFERENCES ' T_user ' (' uid ')) Engine=innodb DEFAULT charset=utf8;insert into  ' t_order ' (' oid ', ' ordertime ', ' total ', ' Status ', ' address ', ' uid ') VALUES (' 058f48da33694c6d8f5c2c13f3d26cea ', ' 2013-12-26 21:47:04 ', ' 95.30 ', 1, ' Ms. Li Jieyang, Guangdong province Jiedong County xxx xxx xxx ', ' 32DB3700D2564254982BC58B0E4D95BC ');

2.bean

①orderitem

public class OrderItem {private String orderitemid;//primary key private int quantity;//number private double subtotal;//Subtotal private book book;//the order to which bookprivate order order;//is associated

②order

public class Order {private string oid;//primary key private string ordertime;//order time private double total;//total private int status;// Single status: 1 unpaid, 2 paid but not shipped, 3 shipped unconfirmed receipt, 4 confirmed receipt of transaction succeeded, 5 canceled (only unpaid to cancel) private String address;//receipt address private User owner;// The owner of the order is private list<orderitem> orderitemlist;

  

  

Online Book Mall 6--order Module 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.