소스 검색

商家pc端-酒水管理

qrs 1 주 전
부모
커밋
77c551c4e5

+ 3 - 3
alien-store-platform/src/main/java/shop/alien/storeplatform/controller/StorePlatformBarMenuController.java

@@ -83,7 +83,7 @@ public class StorePlatformBarMenuController {
     @ApiOperation("新增菜单")
     @ApiOperationSupport(order = 4)
     @PostMapping("/save")
-    public R<String> save(@RequestBody StorePlatformStoreMenu storeMenu) {
+    public R<StorePlatformStoreMenu> save(@RequestBody StorePlatformStoreMenu storeMenu) {
         log.info("StorePlatformBarMenuController.save storeMenu={}", storeMenu);
         return barMenuService.saveMenu(storeMenu);
     }
@@ -91,7 +91,7 @@ public class StorePlatformBarMenuController {
     @ApiOperation("修改菜单")
     @ApiOperationSupport(order = 5)
     @PostMapping("/update")
-    public R<String> update(@RequestBody StorePlatformStoreMenu storeMenu) {
+    public R<StorePlatformStoreMenu> update(@RequestBody StorePlatformStoreMenu storeMenu) {
         log.info("StorePlatformBarMenuController.update storeMenu={}", storeMenu);
         return barMenuService.updateMenu(storeMenu);
     }
@@ -99,7 +99,7 @@ public class StorePlatformBarMenuController {
     @ApiOperation("新增或修改菜单")
     @ApiOperationSupport(order = 6)
     @PostMapping("/saveOrUpdate")
-    public R<String> saveOrUpdate(@RequestBody StorePlatformStoreMenu storeMenu) {
+    public R<StorePlatformStoreMenu> saveOrUpdate(@RequestBody StorePlatformStoreMenu storeMenu) {
         log.info("StorePlatformBarMenuController.saveOrUpdate storeMenu={}", storeMenu);
         return barMenuService.saveOrUpdateMenu(storeMenu);
     }

+ 3 - 3
alien-store-platform/src/main/java/shop/alien/storeplatform/service/StorePlatformBarMenuService.java

@@ -46,7 +46,7 @@ public interface StorePlatformBarMenuService extends IService<StorePlatformStore
      * @param storeMenu 菜单信息
      * @return 操作结果
      */
-    R<String> saveMenu(StorePlatformStoreMenu storeMenu);
+    R<StorePlatformStoreMenu> saveMenu(StorePlatformStoreMenu storeMenu);
 
     /**
      * 修改菜单
@@ -54,7 +54,7 @@ public interface StorePlatformBarMenuService extends IService<StorePlatformStore
      * @param storeMenu 菜单信息
      * @return 操作结果
      */
-    R<String> updateMenu(StorePlatformStoreMenu storeMenu);
+    R<StorePlatformStoreMenu> updateMenu(StorePlatformStoreMenu storeMenu);
 
     /**
      * 新增或修改菜单
@@ -62,7 +62,7 @@ public interface StorePlatformBarMenuService extends IService<StorePlatformStore
      * @param storeMenu 菜单信息
      * @return 操作结果
      */
-    R<String> saveOrUpdateMenu(StorePlatformStoreMenu storeMenu);
+    R<StorePlatformStoreMenu> saveOrUpdateMenu(StorePlatformStoreMenu storeMenu);
 
     /**
      * 删除菜单(逻辑删除)

+ 23 - 8
alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/StorePlatformBarMenuServiceImpl.java

@@ -15,6 +15,7 @@ import shop.alien.entity.result.R;
 import shop.alien.entity.store.StoreImg;
 import shop.alien.entity.store.excelVo.util.ExcelImage;
 import shop.alien.mapper.StoreImgMapper;
+import shop.alien.storeplatform.entity.StorePlatformBathFacility;
 import shop.alien.storeplatform.entity.StorePlatformStoreMenu;
 import shop.alien.storeplatform.feign.AlienStoreFeign;
 import shop.alien.storeplatform.mapper.StorePlatformStoreMenuMapper;
@@ -94,26 +95,40 @@ public class StorePlatformBarMenuServiceImpl extends ServiceImpl<StorePlatformSt
         List<StorePlatformStoreMenu> list = this.list(queryWrapper);
 
         // 查询图片
-        List<Integer> ids = list.stream().map(StorePlatformStoreMenu::getImgId).collect(Collectors.toList());
+        List<Integer> ids = list.stream().map(StorePlatformStoreMenu::getId).collect(Collectors.toList());
         List<StoreImg> imgList = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>()
-                .eq(StoreImg::getStoreId, storeId).eq(StoreImg::getImgType, 7).in(StoreImg::getId, ids));
+                .eq(StoreImg::getStoreId, storeId).eq(StoreImg::getImgType, 7).in(StoreImg::getBusinessId, ids));
 
         if (CollectionUtil.isNotEmpty(imgList)) {
             list.forEach(menu -> {
                 imgList.stream()
-                        .filter(img -> img.getId().equals(menu.getImgId()))
+                        .filter(img -> img.getBusinessId().equals(menu.getId()))
                         .findFirst()
                         .ifPresent(img -> menu.setImgUrl(img.getImgUrl()));
             });
         }
 
+//        // 查询图片
+//        List<Integer> ids = list.stream().map(StorePlatformStoreMenu::getImgId).collect(Collectors.toList());
+//        List<StoreImg> imgList = storeImgMapper.selectList(new LambdaQueryWrapper<StoreImg>()
+//                .eq(StoreImg::getStoreId, storeId).eq(StoreImg::getImgType, 7).in(StoreImg::getId, ids));
+//
+//        if (CollectionUtil.isNotEmpty(imgList)) {
+//            list.forEach(menu -> {
+//                imgList.stream()
+//                        .filter(img -> img.getId().equals(menu.getImgId()))
+//                        .findFirst()
+//                        .ifPresent(img -> menu.setImgUrl(img.getImgUrl()));
+//            });
+//        }
+
         return list.stream()
                 .sorted(Comparator.comparing(StorePlatformStoreMenu::getSort))
                 .collect(Collectors.toList());
     }
 
     @Override
-    public R<String> saveMenu(StorePlatformStoreMenu storeMenu) {
+    public R<StorePlatformStoreMenu> saveMenu(StorePlatformStoreMenu storeMenu) {
         log.info("StorePlatformBarMenuServiceImpl.saveMenu storeMenu={}", storeMenu);
         if (storeMenu == null) {
             return R.fail("菜单信息不能为空");
@@ -144,11 +159,11 @@ public class StorePlatformBarMenuServiceImpl extends ServiceImpl<StorePlatformSt
         if (!flag) {
             return R.fail("新增菜单失败");
         }
-        return R.success("新增菜单成功");
+        return R.data(storeMenu);
     }
 
     @Override
-    public R<String> updateMenu(StorePlatformStoreMenu storeMenu) {
+    public R<StorePlatformStoreMenu> updateMenu(StorePlatformStoreMenu storeMenu) {
         log.info("StorePlatformBarMenuServiceImpl.updateMenu storeMenu={}", storeMenu);
         if (storeMenu == null || storeMenu.getId() == null) {
             return R.fail("菜单信息或菜单ID不能为空");
@@ -161,11 +176,11 @@ public class StorePlatformBarMenuServiceImpl extends ServiceImpl<StorePlatformSt
         if (!flag) {
             return R.fail("修改菜单失败");
         }
-        return R.success("修改菜单成功");
+        return R.data(storeMenu);
     }
 
     @Override
-    public R<String> saveOrUpdateMenu(StorePlatformStoreMenu storeMenu) {
+    public R<StorePlatformStoreMenu> saveOrUpdateMenu(StorePlatformStoreMenu storeMenu) {
         log.info("StorePlatformBarMenuServiceImpl.saveOrUpdateMenu storeMenu={}", storeMenu);
         if (storeMenu == null) {
             return R.fail("菜单信息不能为空");