java網上圖書商城(6)訂單模組1_java

來源:互聯網
上載者:User

先看看效果圖:

1.sql

①t_orderitem一個外鍵

bname:方便後期book刪除

CREATE TABLE `t_orderitem` ( `orderItemId` char(32) NOT NULL, `quantity` int(11) DEFAULT NULL, `subtotal` decimal(8,2) DEFAULT NULL, `bid` char(32) DEFAULT NULL, `bname` varchar(200) DEFAULT NULL, `currPrice` decimal(8,2) DEFAULT NULL, `image_b` varchar(100) DEFAULT NULL, `oid` char(32) 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編程思想(第4版)','74.50','book_img/9317290-1_b.jpg','C0841F4DFE7A43BFB183E4E82AE7914C');

②t_order一個外鍵

CREATE TABLE `t_order` ( `oid` char(32) NOT NULL, `ordertime` char(19) DEFAULT NULL, `total` decimal(10,2) DEFAULT NULL, `status` int(11) DEFAULT NULL, `address` varchar(1000) DEFAULT NULL, `uid` char(32) 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,'李女士 廣東省 揭陽市 揭東縣 xxx xxx xxx','32DB3700D2564254982BC58B0E4D95BC');

 2.bean

①OrderItem

public class OrderItem { private String orderItemId;//主鍵 private int quantity;//數量 private double subtotal;//小計 private Book book;//所關聯的Book private Order order;//所屬的訂單

②Order

public class Order { private String oid;//主鍵 private String ordertime;//下單時間 private double total;//總計 private int status;//訂單狀態:1未付款, 2已付款但未發貨, 3已發貨未確認收貨, 4確認收貨了交易成功, 5已取消(只有未付款才能取消) private String address;//收貨地址 private User owner;//訂單的所有者   private List<OrderItem> orderItemList;

以上就是本文的全部內容,希望對大家的學習有所協助,也希望大家多多支援雲棲社區。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.