Java Online Book Mall (6) Order module 1_java

Source: Internet
Author: User

First look at the effect chart:

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 (m) 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 Idea (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 (1000) 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 Guangdong province Jieyang Jiedong County 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 the book
 private orders order;//belong

②order

public class Order {
 private string oid;//primary key
 private string ordertime;//single time
 private double total;//total
 private int status;

Order Status: 1 unpaid, 2 paid but not shipped, 3 shipped unconfirmed receipt, 4 confirmed receipt transaction successful, 5 canceled (only unpaid to cancel)
 private String address;//receipt address
 private User owner ;//The owner of the order
  
 private list<orderitem> orderitemlist;

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.