1、创建数据库 CREATE TABLE tb_books( id INT unsigned NOT NULL AUTO_INCREMENT, name VARCHAR(45) NOT NULL, price DOUBLE NOT NULL, bookCount INT unsigned NOT NULL, author VARCHAR(45) NOT NULL, PRIMARY KEY(id) ); 2、创建Book类 package Library.info; public class Book implements Comparable<Object>{ private String name; public int id; private int bookCount;//数量 private Double price; private String author; public Book(){} //空参构造函数 public Book(int id, String name, Double price, String author) { this.id = id; this.name = name; this.price = price; this.author = author; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public int getBookCount() { return bookCount; } public void setBookCount(int bookCount) { this.bookCount = bookCount; } } 3、创建包com.lyq.bean
|
|
来自: weixiaofeng01 > 《图书管理系统》