wwl 4 жил өмнө
parent
commit
c3eb5d0963

+ 4 - 2
zzjs-admin/src/main/java/com/miaxis/pc/controller/carousel/CarouselChartInfoController.java

@@ -13,6 +13,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 【轮播图】Controller
@@ -52,8 +53,9 @@ public class CarouselChartInfoController extends BaseController{
     @Log(title = "轮播图", businessType = BusinessTypeEnum.INSERT)
     @PostMapping
     @ApiOperation("新增轮播图")
-    public Response<Integer> add(@RequestBody CarouselChartInfo carouselChartInfo){
-        return toResponse(carouselChartInfoService.save(carouselChartInfo) ? 1 : 0);
+    public Response<Integer> add(@RequestBody List<CarouselChartInfo> carouselChartInfo){
+        List<CarouselChartInfo> collect = carouselChartInfo.stream().filter(c -> c.getId() != null).collect(Collectors.toList());
+        return toResponse(carouselChartInfoService.saveBatch(collect) ? 1 : 0);
     }