一 首页展示之特价商品信息、热卖商品信息、公告、新闻

1.1学习目标

[外链图片转存失败(img-gVt39HaC-1563411829375)(img\firstPage.png)]

1.2 index需求分析

1): 展示特价商品的信息

2): 展示热卖商品的信息

3): 显示当前最新的的公告列表

4): 显示当前最新的的新闻列表

1.3 页面原型

[外链图片转存失败(img-FVlK4yoP-1563411829378)(img\图片1.png)]

1.4 流程图

[外链图片转存失败(img-nWnuhalX-1563411829379)(img\ebuy_news_product_notices.png)]

1.5 数据库信息

(t_notice)

列名 数据类型(精度范围) 允许空 约束条件
主键列 id int 主键,自动增长
标题 title varchar(50)
内容 content text
创建时间 createTime datetime

(t_news)

列名 数据类型(精度范围) 允许空 约束条件
主键列 id int 主键,自动增长
标题 title varchar(50)
内容 content text
创建时间 createTime datetime

(t_product)

列名 数据类型(精度范围) 允许空 约束条件
主键列 id int 主键,自动增长
商品描述 description varchar(2000)
是否热门 hot int 1=是,0=否
热门时间 hotTime datetime
商品名称 name varchar(50)
商品价格 price int
商品图片 proPic varchar(255)
是否特价 specialPrice int 1=是,0=否
特价时间 specialPriceTime datetime
商品库存 stock int
商品大分类ID bigTypeId int 外键,t_bigtype表的主键
商品小分类ID smalltypeId int 外键,t_smalltype表的主键

二 实现特价商品信息

2.1 Web.xml 配置
<servlet>
    <servlet-name>index</servlet-name>
    <servlet-class>com.xxx.controller.InitController</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>index</servlet-name>
    <url-pattern>/index</url-pattern>
  </servlet-mapping>

想要更多资料可以加本人微信mageit

2.2 编写对应实体类
package com.xxx.vo;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.xxx.vo.OrderProduct;
//商品实体类
public class Product {
   
	private int id;     // id
	private String name;// 商品名称
	private int price;  // 价钱
	private int hot;   //商品热度
	private Date hotTime;//商品热度时间
	private int stock;  //库存
	private String proPic; //商品路劲
	private String description;//商品描述
	private int specialPrice;  //特价的
	private Date specialPriceTime;//特价时间
	private ProductBigType bigType;//所属大类型的
	private ProductSmallType smallType;//所属小类型的
	private List<OrderProduct> orderProductList=new ArrayList<OrderProduct>();//中间表
	
	public List<OrderProduct> getOrderProductList() {
   
		return orderProductList;
	}

	public void setOrderProductList(List<OrderProduct> orderProductList) {
   
		this.orderProductList = orderProductList;
	}

	public Product() {
   
		// TODO Auto-generated constructor stub
	}

	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 int getPrice() {
   
		return price;
	}

	public void setPrice(int price) {
   
		this.price = price;
	}

	public int getHot() {
   
		return hot;
	}

	public void setHot(int hot) {
   
		this.hot = hot;
	}

	public Date getHotTime() {
   
		return hotTime;
	}

	public void setHotTime(Date hotTime) {
   
		this.hotTime = hotTime;
	}

	public int getStock() {
   
		return stock;
	}

	public void setStock(int stock) {
   
		this.stock = stock;
	}

	public String getProPic() {
   
		return proPic;
	}

	public void setProPic(String proPic) {
   
		this.proPic = proPic;
	}

	public Date getSpecialPriceTime() {
   
		return specialPriceTime;
	}

	public void setSpecialPriceTime(Date specialPriceTime) {
   
		this.specialPriceTime = specialPriceTime;
	}

	public ProductBigType getBigType() {
   
		return bigType;
	}

	public void setBigType(ProductBigType bigType) {
   
		this.bigType = bigType;
	}

	public ProductSmallType getSmallType() {
   
		return smallType;
	}

	public void setSmallType(ProductSmallType smallType) {
   
		this.smallType = smallType;
	}

	public int getSpecialPrice() {
   
		return specialPrice;
	}

	public void setSpecialPrice(int specialPrice) {
   
		this.specialPrice = specialPrice;
	}

	public String getDescription() {
   
		return description;
	}

	public void setDescription(String description) {
   
		this.description = description;
	}
	
}

package com.xxx.vo;
import com.xxx.vo.Order;
import com
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值