[AppleScript] 纯文本查看 复制代码
/**
* 增 加
*/ @Override
public void add(Goods goods) {
goods.getGoods().setAuditStatus("0"); goodsMapper.insert(goods.getGoods()); //插入商品表
goods.getGoodsDesc().setGoodsId(goods.getGoods().getId());
goodsDescMapper.insert(goods.getGoodsDesc());//插入商品扩展数据
for(TbItem item :goods.getItemList()){
//标题
String title= goods.getGoods().getGoodsName(); Map<String,Object> specMap = JSON.parseObject(item.getSpec()); for(String key:specMap.keySet()){
title+=" "+ specMap.get(key);
}
item.setTitle(title); item.setGoodsId(goods.getGoods().getId());//商品 SPU 编号
item.setSellerId(goods.getGoods().getSellerId());//商家编号
item.setCategoryid(goods.getGoods().getCategory3Id());//商品分类编号(3 级)
item.setCreateTime(new Date());//创建日期 item.setUpdateTime(new Date());//修改日期
//品牌名称TbBrand brand =
brandMapper.selectByPrimaryKey(goods.getGoods().getBrandId());
item.setBrand(brand.getName());
//分类名称
TbItemCat itemCat = itemCatMapper.selectByPrimaryKey(goods.getGoods().getCategory3Id());
item.setCategory(itemCat.getName());
//商家名称TbSeller seller =
sellerMapper.selectByPrimaryKey(goods.getGoods().getSellerId());
item.setSeller(seller.getNickName());
//图片地址(取 spu 的第一个图片)
List<Map> imageList = JSON.parseArray(goods.getGoodsDesc().getItemImages(), Map.class) ;
if(imageList.size()>0){
item.setImage ( (String)imageList.get(0).get("url"));
}