Let’s take a look at the renderings first:
1.sql
①t_orderitem a foreign key
bname: Convenient to post-book deletion
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 Programming Ideas (4th Edition)','74.50','book_img/9317290-1_b.jpg','C0841F4DFE7A43BFB183E4E82AE7914C');②t_order a foreign key
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,'Ms. Li xxxx xxx xxx','32DB3700D2564254982BC58B0E4D95BC');2.bean
①OrderItem
public class OrderItem { private String orderItemId;//Primary key private int quantity;//Quantity private double subtotal;//Subtotal private Book book;//Associated Book private Order order;//Order to belong②Order
public class Order { private String oid;//primary key private String ordertime;//order time private double total;//total private int status;//Order status: 1 not paid, 2 not delivered but not shipped, 3 not shipped, received by shipped, received by shipped, received by shipped, received by 4 confirmed that the transaction was successful, 5 cancelled (only unpaid can be cancelled) private String address;//Receive address private User owner;//Order owner private List<OrderItem> orderItemList;The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.