Ver Fonte

代码优化

ldz há 3 meses atrás
pai
commit
8e14ae1dad

+ 1 - 1
alien-store/src/main/java/shop/alien/store/controller/StoreOfficialAlbumController.java

@@ -77,7 +77,7 @@ public class StoreOfficialAlbumController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "storeId", value = "门店ID", dataType = "Integer", paramType = "query", required = true),
             @ApiImplicitParam(name = "albumName", value = "相册名称,例如:酒水、餐食、环境、全部等。不传或传空字符串时查询全部", dataType = "String", paramType = "query"),
-            @ApiImplicitParam(name = "type", value = "1:视频,2:相册,3:环境", dataType = "Integer", paramType = "query", required = true),
+            @ApiImplicitParam(name = "type", value = "1:视频,2:相册,3:封面, 4:环境", dataType = "Integer", paramType = "query", required = true),
             @ApiImplicitParam(name = "pageNum", value = "页码,默认1", dataType = "Integer", paramType = "query"),
             @ApiImplicitParam(name = "pageSize", value = "每页数量,默认10", dataType = "Integer", paramType = "query")
     })

+ 12 - 3
alien-store/src/main/java/shop/alien/store/service/impl/StoreOfficialAlbumServiceImpl.java

@@ -145,7 +145,7 @@ public class StoreOfficialAlbumServiceImpl extends ServiceImpl<StoreOfficialAlbu
             log.warn("获取类型无效:{}", type);
             throw new IllegalArgumentException("类型不能为空且必须大于0");
         }
-
+        //视频
         if (type == 1) {
             // 查询视频
             LambdaQueryWrapper<StoreVideo> albumQueryWrapper = new LambdaQueryWrapper<>();
@@ -156,6 +156,7 @@ public class StoreOfficialAlbumServiceImpl extends ServiceImpl<StoreOfficialAlbu
             result.setVideoList(videoList);
             return result;
         }
+        //相册
         if (type == 2) {
             // 先查询符合条件的官方相册ID列表
             LambdaQueryWrapper<StoreOfficialAlbum> albumQueryWrapper = new LambdaQueryWrapper<>();
@@ -204,6 +205,7 @@ public class StoreOfficialAlbumServiceImpl extends ServiceImpl<StoreOfficialAlbu
 
             return result;
         }
+        //封面
         if (type == 3) {
             StoreInfo storeInfo = storeInfoMapper.getStoreInfo(storeId);
 
@@ -214,14 +216,14 @@ public class StoreOfficialAlbumServiceImpl extends ServiceImpl<StoreOfficialAlbu
                 result.setTotalCount(0);
                 return result;
             }
-            // 单图模式
+            // 单图模式 封面
             if (storeInfo.getImgMode() == 0) {
                 List<StoreImg> imgList = storeImgService.getByCover(storeId, 20);
                 StoreOfficialAlbumImgVo result = new StoreOfficialAlbumImgVo();
                 result.setImgList(imgList);
                 return result;
             }
-            // 多图模式
+            // 多图模式 封面
             if (storeInfo.getImgMode() == 1) {
                 List<StoreImg> imgList = storeImgService.getByCover(storeId, 21);
                 StoreOfficialAlbumImgVo result = new StoreOfficialAlbumImgVo();
@@ -229,6 +231,13 @@ public class StoreOfficialAlbumServiceImpl extends ServiceImpl<StoreOfficialAlbu
                 return result;
             }
         }
+        //环境
+        if (type == 4){
+            List<StoreImg> imgList = storeImgService.getByCover(storeId, 4);
+            StoreOfficialAlbumImgVo result = new StoreOfficialAlbumImgVo();
+            result.setImgList(imgList);
+        }
+
         // 默认返回空结果
         StoreOfficialAlbumImgVo result = new StoreOfficialAlbumImgVo();
         result.setImgList(Collections.emptyList());