购物车数据

1.向购物车添加商品,(首先,应该判断该商品是否在购物车中已经存在,若存在,该商品数量+1,若不存在,则将该商品加入购物车并数量设置为1)
2.修改商品的数量(请求一个servlet,并根据该商品的某个唯一属性修改其数量)
3.删除商品(通过请求servlet并根据要删除商品的唯一属性将其删除)
4.清空购物车(请求servlet将购物车清空)
5.获得商品的初始价格
6.获得商品的会员价格
7.获得优惠价格
8.获得购物车中的所有商品
public class Gwc {
private int gwcId;
private int custId;
private int bookId;
private String bookName;
private String smallImg;
private float price;
private float hyPrice;
private int num;

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

	public Gwc(int gwcId, int custId, int bookId, String bookName,
			String smallImg, float price, float hyPrice, int num) {
		super();
		this.gwcId = gwcId;
		this.custId = custId;
		this.bookId = bookId;
		this.bookName = bookName;
		this.smallImg = smallImg;
		this.price = price;
		this.hyPrice = hyPrice;
		this.num = num;
	}

	public Gwc(int custId, int bookId, String bookName, String smallImg,
			float price, float hyPrice, int num) {
		super();
		this.custId = custId;
		this.bookId = bookId;
		this.bookName = bookName;
		this.smallImg = smallImg;
		this.price = price;
		this.hyPrice = hyPrice;
		this.num = num;
	}

	public int getGwcId() {
		return gwcId;
	}

	public void setGwcId(int gwcId) {
		this.gwcId = gwcId;
	}

	public int getCustId() {
		return custId;
	}

	public void setCustId(int custId) {
		this.custId = custId;
	}

	public int getBookId() {
		return bookId;
	}

	public void setBookId(int bookId) {
		this.bookId = bookId;
	}

	public String getBookName() {
		return bookName;
	}

	public void setBookName(String bookName) {
		this.bookName = bookName;
	}

	public String getSmallImg() {
		return smallImg;
	}

	public void setSmallImg(String smallImg) {
		this.smallImg = smallImg;
	}

	public float getPrice() {
		return price;
	}

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

	public float getHyPrice() {
		return hyPrice;
	}

	public void setHyPrice(float hyPrice) {
		this.hyPrice = hyPrice;
	}

	public int getNum() {
		return num;
	}

	public void setNum(int num) {
		this.num = num;
	}
}

购物车接口:
import java.util.List;

import com.jinzhi.entity.Gwc;

public interface IGwcDAO {

public int add(int custId, Gwc gwc);

public int updateNum(int custId, int bookId, int num);

public int delete(int custId, int bookId);

public int clear(int custId);

public Gwc findById(int custId, int bookId);

public float getOldPrices(int custId);

public float getHyPrices(int custId);

public float getYhPrice(int custId);

public List<Gwc> getAllItems(int custId);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值