Search in sources :

Example 1 with PmsSkuAttrValue

use of com.xatu.gmall.entity.PmsSkuAttrValue in project GMall by 18391713434.

the class SkuServiceImpl method saveSkuInfo.

public void saveSkuInfo(PmsSkuInfo pmsSkuInfo) {
    // 插入SkuInfo
    skuInfoMapper.insert(pmsSkuInfo);
    // 插入平台属性关联
    List<PmsSkuAttrValue> pmsSkuAttrValueList = pmsSkuInfo.getSkuAttrValueList();
    for (PmsSkuAttrValue pmsSkuAttrValue : pmsSkuAttrValueList) {
        pmsSkuAttrValue.setSkuId(pmsSkuInfo.getId());
        skuAttrValueMapper.insert(pmsSkuAttrValue);
    }
    // 插入销售属性关联
    List<PmsSkuSaleAttrValue> pmsSkuSaleAttrValueList = pmsSkuInfo.getSkuSaleAttrValueList();
    for (PmsSkuSaleAttrValue pmsSkuSaleAttrValue : pmsSkuSaleAttrValueList) {
        pmsSkuSaleAttrValue.setSkuId(pmsSkuInfo.getId());
        skuSaleAttrValueMapper.insert(pmsSkuSaleAttrValue);
    }
    // 插入图片信息
    List<PmsSkuImage> pmsSkuImageList = pmsSkuInfo.getSkuImageList();
    for (PmsSkuImage pmsSkuImage : pmsSkuImageList) {
        pmsSkuImage.setSkuId(pmsSkuInfo.getId());
        skuImageMapper.insert(pmsSkuImage);
    }
}
Also used : PmsSkuAttrValue(com.xatu.gmall.entity.PmsSkuAttrValue) PmsSkuImage(com.xatu.gmall.entity.PmsSkuImage) PmsSkuSaleAttrValue(com.xatu.gmall.entity.PmsSkuSaleAttrValue)

Example 2 with PmsSkuAttrValue

use of com.xatu.gmall.entity.PmsSkuAttrValue in project GMall by 18391713434.

the class SkuServiceImpl method selectAllSku.

public List<PmsSkuInfo> selectAllSku(String catalog3Id) {
    List<PmsSkuInfo> pmsSkuInfos = skuInfoMapper.selectList(new QueryWrapper<PmsSkuInfo>());
    for (PmsSkuInfo pmsSkuInfo : pmsSkuInfos) {
        Long skuId = pmsSkuInfo.getId();
        List<PmsSkuAttrValue> pmsSkuAttrValueList = skuAttrValueMapper.selectList(new QueryWrapper<PmsSkuAttrValue>().eq("sku_id", skuId));
        pmsSkuInfo.setSkuAttrValueList(pmsSkuAttrValueList);
    }
    return pmsSkuInfos;
}
Also used : PmsSkuAttrValue(com.xatu.gmall.entity.PmsSkuAttrValue) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper) PmsSkuInfo(com.xatu.gmall.entity.PmsSkuInfo)

Aggregations

PmsSkuAttrValue (com.xatu.gmall.entity.PmsSkuAttrValue)2 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)1 PmsSkuImage (com.xatu.gmall.entity.PmsSkuImage)1 PmsSkuInfo (com.xatu.gmall.entity.PmsSkuInfo)1 PmsSkuSaleAttrValue (com.xatu.gmall.entity.PmsSkuSaleAttrValue)1