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.图书模块功能介绍及相关类创建的更多相关文章

  1. JavaWeb网上图书商城完整项目--day02-28.查询所有分类功能之left页面使用Q6MenuBar组件显示手风琴式下拉菜单

    首先页面去加载的时候,会去加载main.js文件,我们在加载left.jsp.top.jsp body.jsp,现在我们修改main.jsp的代码,让它去请求的时候去访问的是不在直接去访问left.j ...

  2. JavaWeb网上图书商城完整项目--day02-25.查询所有分类功能之流程分析

    分类模块的业务流程入下面所示:

  3. JavaWeb网上图书商城完整项目--day02-27.查询所有分类功能之Servlet和Service层

    我们在上面实现了数据库层的代码,现在我们来实现业务层和Servlet层的代码:业务层的代码如下: package com.weiyuan.goods.category.service; import ...

  4. JavaWeb网上图书商城完整项目--day02-26.查询所有分类功能之DAO层实现

    我们按照表示的设计 以及: package com.weiyuan.goods.category.domain; import java.util.List; public class Categor ...

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

    1.现在我们要将table表中的输入的参数全部提交到后台进行校验,我们提交我们是按照表单的形式提交,所以我们首先需要在table表外面添加一个表单 <%@ page language=" ...

  6. JavaWeb网上图书商城完整项目--24.注册页面的css样式实现

    现在框架已经做好了,即下来我们要对页面进行装饰了,第一步给每一个元素添加id 1.最外面的div添加id为divMain 2.第二个div添加id为divTitle,里面的span对应的id为span ...

  7. JavaWeb网上图书商城完整项目--过滤器解决中文乱码

    我们知道,如果是POST请求,我们需要调用request.setCharacterEncoding(“utf-8”)方法来设计编码:如果是GET请求,我们需要自己手动来处理编码问题.如果我们使用了En ...

  8. JavaWeb网上图书商城完整项目--13.项目所需环境的搭建

    1.首先安装mysql 创建项目所需的数据库,直接运行项目提供的goods.sql文库 2.myeclipse创建一个web project ,项目的名称是goods 把视频中提供的项目原型下的提供的 ...

  9. JavaWeb网上图书商城完整项目--BaseServlet

    1.以前进行操作的时候,例如我们进行登陆操作我们使用LoginServlet进行处理,进行注册操作我们使用RegisterServlet,很多业务的操作的时候我们就要定义很多个Servlet 有了Ba ...

随机推荐

  1. python winreg总结

    注册表 结构 注册表由键(key,或称“项”).子键(subkey,子项)和值项(value)构成.一个键就是树状数据结构中的一个节点,而子键就是这个节点的子节点,子键也是键.一个值项则是一个键的一条 ...

  2. Beta冲刺 —— 总结随笔

    这个作业属于哪个课程 软件工程 这个作业要求在哪里 Beta冲刺 这个作业的目标 Beta冲刺 作业正文 正文 github链接 项目地址 其他参考文献 无 一.项目预期计划: 1.对于初版小程序的现 ...

  3. CPU-如何开始在新的CPU上编程

    https://mp.weixin.qq.com/s/rNXDPR53m--XuvJLE1CDvA   新在哪里?从未接触过.比如之前一直在x86.ARM上写程序,C比较多,汇编也调过.MIPS可能零 ...

  4. Java实现 LeetCode 241 为运算表达式设计优先级

    241. 为运算表达式设计优先级 给定一个含有数字和运算符的字符串,为表达式添加括号,改变其运算优先级以求出不同的结果.你需要给出所有可能的组合的结果.有效的运算符号包含 +, - 以及 * . 示例 ...

  5. Java实现 蓝桥杯VIP 算法提高 产生数

    算法提高 产生数 时间限制:1.0s 内存限制:256.0MB 问题描述 给出一个整数 n(n<10^30) 和 k 个变换规则(k<=15). 规则: 一位数可变换成另一个一位数: 规则 ...

  6. Java实现 LeetCode 43 字符串相乘

    43. 字符串相乘 给定两个以字符串形式表示的非负整数 num1 和 num2,返回 num1 和 num2 的乘积,它们的乘积也表示为字符串形式. 示例 1: 输入: num1 = "2& ...

  7. java实现第五届蓝桥杯海盗分金币

    海盗分金币 有5个海盗,相约进行一次帆船比赛. 比赛中天气发生突变,他们被冲散了. 恰巧,他们都先后经过途中的一个无名的荒岛,并且每个人都信心满满,觉得自己是第一个经过该岛的人. 第一个人在沙滩上发现 ...

  8. java实现第七届蓝桥杯愤怒小鸟

    愤怒小鸟 题目描述 X星球愤怒的小鸟喜欢撞火车! 一根平直的铁轨上两火车间相距 1000 米 两火车 (不妨称A和B) 以时速 10米/秒 相对行驶. 愤怒的小鸟从A车出发,时速50米/秒,撞向B车, ...

  9. 优雅的敲JS代码的几个原则

    一.条件语句        1,使用 Array.includes 来处理多重 || 条件          // ----- 一般 ------ if (fruit == 'apple' || fr ...

  10. WSO2 - MI

    简介 WSO2MI(Micro Integrator)是一个事件驱动的企业服务总线(Enterprise Service Bus),支持消息路由.数据格式转换.通信协议转换,支持连接SAP.KAFKA ...