Browse Source

商品添加图片和简介返回

yuanliang 1 năm trước cách đây
mục cha
commit
0bd095e883

+ 4 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -201,7 +201,10 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public void addGoods(List<GoodsWrapper.Goods> goodsList, Integer operatorId) {
-		List<String> snList = goodsList.stream().map(GoodsWrapper.Goods::getSn).distinct().collect(Collectors.toList());
+		List<String> snList = goodsList.stream().map(GoodsWrapper.Goods::getSn).collect(Collectors.toList());
+		if (snList.size() != new HashSet<>(snList).size()) {
+			throw new BizException("商品货号重复");
+		}
 		List<Goods> bySns = goodsDao.findBySns(snList);
 		if (!CollectionUtils.isEmpty(bySns)) {
 			throw new BizException("商品货号重复");

+ 4 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/dto/PmsProductDto.java

@@ -38,6 +38,10 @@ public class PmsProductDto implements Serializable {
     private Long productCategoryId;
     //商品分类名称
     private String productCategoryName;
+    // 商品图片
+    private String pic;
+    // 商品详情
+    private String detailHtml;
 
 
     //"商品销售属性,json格式"

+ 2 - 0
mec-mall/mall-admin/src/main/resources/config/mybatis/PmsProductDao.xml

@@ -125,6 +125,8 @@
         t1.price as price,
         t.brand_id as brandId,
         t.product_category_id as productCategoryId,
+        t.pic as pic,
+        t.detail_html as detailHtml,
         t1.sp_data as spData
         from pms_product t
         left join pms_sku_stock t1 on t.id = t1.product_id