瀏覽代碼

Merge branch 'master' of http://git.ds-bay.com/project/kmall-pt-general

zcb 4 年之前
父節點
當前提交
8250ab6f98

+ 1 - 1
kmall-admin/src/main/java/com/kmall/admin/dao/BrandDao.java

@@ -14,7 +14,7 @@ import java.util.List;
  * @date 2017-08-19 17:59:15
  */
 public interface BrandDao extends BaseDao<BrandEntity> {
-    BrandEntity queryObjectByName(@Param("brandName")String brandName,@Param("merchSn")String merchSn);
+    BrandEntity queryObjectByName(@Param("brandName")String brandName,@Param("merchSn")String merchSn,@Param("categoryId")Integer categoryId);
     List<BrandEntity> queryObjectByStoreId(@Param("storeId") Long storeId);
     BrandEntity queryBrandByBrandNameAndStoreId(@Param("brandName")String brandName,@Param("storeId") Long storeId);
 

+ 1 - 1
kmall-admin/src/main/java/com/kmall/admin/dao/CategoryDao.java

@@ -14,7 +14,7 @@ import java.util.List;
  * @date 2017-08-21 15:32:31
  */
 public interface CategoryDao extends BaseDao<CategoryEntity> {
-    CategoryEntity queryObjectByName(@Param("cateGoryName") String cateGoryName,@Param("merchSn")String merchSn);
+    CategoryEntity queryObjectByName(@Param("categoryName") String categoryName,@Param("merchSn")String merchSn,@Param("parentId") Integer parentId);
     List<CategoryEntity> queryObjectByStoreId(@Param("storeId") Long storeId);
 
 }

+ 14 - 13
kmall-admin/src/main/java/com/kmall/admin/service/impl/ProductStoreRelaServiceImpl.java

@@ -155,10 +155,10 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
             if(!StringUtils.isNotEmpty(goodsEntity.getPrimaryPicUrl())){
                 throw new RRException("该商品主图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品主图信息,再来操作门店商品数据");
             }
-            List<GoodsGalleryEntity> galleryEntityList = goodsGalleryDao.queryObjectByGoodId(goodsEntity.getId());
-            if (galleryEntityList == null || galleryEntityList.size() <= 0) {
-                throw new RRException("该商品轮播图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品详情轮播图信息,再来操作门店商品数据");
-            }
+//            List<GoodsGalleryEntity> galleryEntityList = goodsGalleryDao.queryObjectByGoodId(goodsEntity.getId());
+//            if (galleryEntityList == null || galleryEntityList.size() <= 0) {
+//                throw new RRException("该商品轮播图不能为空!请先在商品管理》所有商品中维护商品编号为【"+goodsEntity.getGoodsSn()+"】的商品详情轮播图信息,再来操作门店商品数据");
+//            }
         }
         if (productStoreRela.getStoreId() != null) {
             StoreEntity store = storeDao.queryObject(productStoreRela.getStoreId().intValue());
@@ -850,19 +850,20 @@ public class ProductStoreRelaServiceImpl implements ProductStoreRelaService {
                 }else{
                     throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]未录入系统");
                 }
-                CategoryEntity categoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getAttributeCategory(), store.getMerchSn());
-                if (categoryEntity != null) {
-                    storeRelaEntity.setAttributeCategory(categoryEntity.getId());
-                }else{
-                    throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的二级类别输入有误");
-                }
-                CategoryEntity parentCategoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getCategoryName(), store.getMerchSn());
-                if (parentCategoryEntity != null && categoryEntity.getParentId().intValue()==parentCategoryEntity.getId().intValue()) {
+                CategoryEntity parentCategoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getCategoryName(), store.getMerchSn(),0);
+                if (parentCategoryEntity != null) {
                     storeRelaEntity.setCategoryId(parentCategoryEntity.getId());
+                    CategoryEntity categoryEntity = categoryDao.queryObjectByName(storeGoodsDto.getAttributeCategory(), store.getMerchSn(),parentCategoryEntity.getId());
+                    if (categoryEntity != null) {
+                        storeRelaEntity.setAttributeCategory(categoryEntity.getId());
+                    }else{
+                        throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的二级类别输入有误");
+                    }
                 }else{
                     throw new RRException("商品[" + storeGoodsDto.getGoodsSn() + "]的一级类别输入有误");
                 }
-                BrandEntity brandEntity = brandDao.queryObjectByName(storeGoodsDto.getBrandName(), store.getMerchSn());
+
+                BrandEntity brandEntity = brandDao.queryObjectByName(storeGoodsDto.getBrandName(), store.getMerchSn(),storeRelaEntity.getAttributeCategory());
                 if (brandEntity != null) {
                     storeRelaEntity.setBrandId(brandEntity.getId());
                 }else{

+ 1 - 0
kmall-admin/src/main/resources/mybatis/mapper/BrandDao.xml

@@ -68,6 +68,7 @@
         left join mall_store s on b.store_id = s.id
         left join mall_merch m on b.merch_sn = m.merch_sn
         where `name` = #{brandName}
+        and category_id=#{categoryId}
         <if test="merchSn != null and merchSn.trim() != ''">
             AND b.merch_sn = #{merchSn}
         </if>

+ 2 - 1
kmall-admin/src/main/resources/mybatis/mapper/CategoryDao.xml

@@ -69,7 +69,8 @@
 		`front_name`,
 		`is_show` as `show`
 		from mall_category
-		where name = #{cateGoryName}
+		where name = #{categoryName}
+		and parent_id=#{parentId}
 		<if test="merchSn != null and merchSn.trim() != ''">
 			AND merch_sn = #{merchSn}
 		</if> and is_show = 1