1. 程式人生 > 其它 >商品詳情頁

商品詳情頁

實體類分析

首先在商品詳情頁要獲取的資料有如下被框住的部分:
首先是商品詳情 分為商品商品名稱 商品價格 預設圖片
其次是商品圖片
在然後是商品規格屬性如顏色和版本
最後還有商品是否有貨

還有商品介紹圖以及規格

最後的實體類如下所示

public class ItemVO {
    // 商品資訊
    private PmsSkuInfo skuInfo;
    // 商品圖片
    private List<PmsSkuImages> skuImages;
    // 商品介紹圖
    private PmsSpuInfoDesc spuInfoDesc;
    // 銷售屬性
    private List<skuItemSaleAttrVO> saleAttr;
    // 商品規格
    private List<SpuItemAttrVO> spuItemAttrs;

    private Boolean hasStock = true;

    public Boolean getHasStock() {
        return hasStock;
    }

    public void setHasStock(Boolean hasStock) {
        this.hasStock = hasStock;
    }

    public static class SpuItemAttrVO {
        // 屬性組名稱 如主體
        private String groupName;
        // 組下的不同屬性 如品牌 型號等
        private List<SpuItemBaseAttr> spuItemBaseAttrs;

        public String getGroupName() {
            return groupName;
        }

        public void setGroupName(String groupName) {
            this.groupName = groupName;
        }

        public List<SpuItemBaseAttr> getSpuItemBaseAttrs() {
            return spuItemBaseAttrs;
        }

        public void setSpuItemBaseAttrs(List<SpuItemBaseAttr> spuItemBaseAttrs) {
            this.spuItemBaseAttrs = spuItemBaseAttrs;
        }
    }

    public static class SpuItemBaseAttr {
        // 屬性名稱
        private String attrName;
        // 屬性值
        private String attrValue;

        public String getAttrName() {
            return attrName;
        }

        public void setAttrName(String attrName) {
            this.attrName = attrName;
        }

        public String getAttrValue() {
            return attrValue;
        }

        public void setAttrValue(String attrValue) {
            this.attrValue = attrValue;
        }
    }

    public static class skuItemSaleAttrVO {
        //銷售屬性id
        private Long attrId;
        // 銷售屬性名稱
        private String attrName;
        // 銷售屬性值 因為銷售屬性是一對多的 比如一個顏色分類下有多個不同的顏色, 比如銷售版本有128GB 64GB
        private List<String> attrValue;

        public Long getAttrId() {
            return attrId;
        }

        public void setAttrId(Long attrId) {
            this.attrId = attrId;
        }

        public String getAttrName() {
            return attrName;
        }

        public void setAttrName(String attrName) {
            this.attrName = attrName;
        }

        public List<String> getAttrValue() {
            return attrValue;
        }

        public void setAttrValue(List<String> attrValue) {
            this.attrValue = attrValue;
        }
    }

    public PmsSkuInfo getSkuInfo() {
        return skuInfo;
    }

    public void setSkuInfo(PmsSkuInfo skuInfo) {
        this.skuInfo = skuInfo;
    }

    public List<PmsSkuImages> getSkuImages() {
        return skuImages;
    }

    public void setSkuImages(List<PmsSkuImages> skuImages) {
        this.skuImages = skuImages;
    }

    public PmsSpuInfoDesc getSpuInfoDesc() {
        return spuInfoDesc;
    }

    public void setSpuInfoDesc(PmsSpuInfoDesc spuInfoDesc) {
        this.spuInfoDesc = spuInfoDesc;
    }

    public List<skuItemSaleAttrVO> getSaleAttr() {
        return saleAttr;
    }

    public void setSaleAttr(List<skuItemSaleAttrVO> saleAttr) {
        this.saleAttr = saleAttr;
    }

    public List<SpuItemAttrVO> getSpuItemAttrs() {
        return spuItemAttrs;
    }

    public void setSpuItemAttrs(List<SpuItemAttrVO> spuItemAttrs) {
        this.spuItemAttrs = spuItemAttrs;
    }
}