JavaWeb网上图书商城完整项目--day03-1.图书模块功能介绍及相关类创建

Posted luzhouxiaoshuai

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaWeb网上图书商城完整项目--day03-1.图书模块功能介绍及相关类创建相关的知识,希望对你有一定的参考价值。

1 前两天我们学习了user用户模块和图书的分类模块,接下来我们学习图书模块

图书模块的功能主要是下面的功能:

2 接下来我们创建对应的包

我们来看看对应的数据库表t_book

CREATE TABLE `t_book` (
`bid` char(32) NOT NULL,
`bname` varchar(200) default NULL,
`author` varchar(50) default NULL,
`price` decimal(8,2) default NULL,
`currPrice` decimal(8,2) default NULL,
`discount` decimal(3,1) default NULL,
`press` varchar(100) default NULL,
`publishtime` char(10) default NULL,
`edition` int(11) default NULL,
`pageNum` int(11) default NULL,
`wordNum` int(11) default NULL,
`printtime` char(10) default NULL,
`booksize` int(11) default NULL,
`paper` varchar(50) default NULL,
`cid` char(32) default NULL,
`image_w` varchar(100) default NULL,
`image_b` varchar(100) default NULL,
`orderBy` int(11) NOT NULL auto_increment,
PRIMARY KEY (`bid`),
KEY `orderBy` (`orderBy`),
KEY `FK_t_book_t_category` (`cid`),
CONSTRAINT `FK_t_book_t_category` FOREIGN KEY (`cid`) REFERENCES `t_category` (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

 book表中定义了一个外键cid,该值必须来自与t_category的cid,表示当前的书籍属于哪个分类。

有个数据库表的字段,我们就可以定义book类的实体类了。

package com.weiyuan.goods.book.domain;

import com.weiyuan.goods.category.domain.Category;

public class Book {
private String bid;//书的主键
private String bname;//书的名字
private String author;//书的作者
private Double price;//书的出厂定价
private Double currPrice;//书的当前的卖价
private Double discount ;//书的折扣
private String press ;//书    的出版社
private String publishtime ;//书的出厂时间
private int edition;//书的印刷版本次数、
private int pageNum;//书的页数
private int wordNum;//书的字数统计
private String printtime;//书的印刷时间
private int booksize;//书是16开、还是8开
private String paper;//书的纸质材料
private Category category;//书属于图书的那个分类
private String image_w;//书的大图路径
private String image_b;//书的小图路径
public String getBid() {
    return bid;
}
public void setBid(String bid) {
    this.bid = bid;
}
public String getBname() {
    return bname;
}
public void setBname(String bname) {
    this.bname = bname;
}
public String getAuthor() {
    return author;
}
public void setAuthor(String author) {
    this.author = author;
}
public Double getPrice() {
    return price;
}
public void setPrice(Double price) {
    this.price = price;
}
public Double getCurrPrice() {
    return currPrice;
}
public void setCurrPrice(Double currPrice) {
    this.currPrice = currPrice;
}
public Double getDiscount() {
    return discount;
}
public void setDiscount(Double discount) {
    this.discount = discount;
}
public String getPress() {
    return press;
}
public void setPress(String press) {
    this.press = press;
}
public String getPublishtime() {
    return publishtime;
}
public void setPublishtime(String publishtime) {
    this.publishtime = publishtime;
}
public int getEdition() {
    return edition;
}
public void setEdition(int edition) {
    this.edition = edition;
}
public int getPageNum() {
    return pageNum;
}
public void setPageNum(int pageNum) {
    this.pageNum = pageNum;
}
public int getWordNum() {
    return wordNum;
}
public void setWordNum(int wordNum) {
    this.wordNum = wordNum;
}
public String getPrinttime() {
    return printtime;
}
public void setPrinttime(String printtime) {
    this.printtime = printtime;
}
public int getBooksize() {
    return booksize;
}
public void setBooksize(int booksize) {
    this.booksize = booksize;
}
public String getPaper() {
    return paper;
}
public void setPaper(String paper) {
    this.paper = paper;
}
public Category getCategory() {
    return category;
}
public void setCategory(Category category) {
    this.category = category;
}
public String getImage_w() {
    return image_w;
}
public void setImage_w(String image_w) {
    this.image_w = image_w;
}
public String getImage_b() {
    return image_b;
}
public void setImage_b(String image_b) {
    this.image_b = image_b;
}






}

 

以上是关于JavaWeb网上图书商城完整项目--day03-1.图书模块功能介绍及相关类创建的主要内容,如果未能解决你的问题,请参考以下文章

JavaWeb网上图书商城完整项目--day02-18.修改密码页面处理

JavaWeb网上图书商城完整项目--day02-6.ajax校验功能之页面实现

JavaWeb网上图书商城完整项目--day02-14.登录功能的login页面处理

JavaWeb网上图书商城完整项目--day02-10.提交注册表单功能之页面实现

JavaWeb网上图书商城完整项目--day02-12.激活功能各层实现

JavaWeb网上图书商城完整项目--day02-4.regist页面提交表单时对所有输入框进行校验