텍스트기존 방식
: request Dto를 받을 때 프론트에서 선택해오는 타입에 따라서 받아오는 member Id 의 갯수가 달라져서 memberId1, 2, 3... 이렇게 명명해서 받아왔었다.
@Transactional
public void create2(NewRouteCreateRequest2 req) {
NewRoute newRoute = newRouteRepository.save(NewRouteCreateRequest2.toEntity(
req,
itemRepository,
newRouteType
)
);
routeProductRepository.save(RouteProductCreateRequest2.toEntity(
req,
newRoute,
newRouteType,
memberRepository
));
}
@Transactional
public void create4(NewRouteCreateRequest4 req) {
NewRoute newRoute = newRouteRepository.save(NewRouteCreateRequest4.toEntity(
req,
itemRepository,
newRouteType
)
);
List<RouteProduct> routeProductList =
RouteProductCreateRequest4.toEntityList(
req,
newRoute,
newRouteType,
memberRepository
);
for(RouteProduct routeProduct : routeProductList ){
routeProductRepository.save(routeProduct);
}
}
=> 따라서 request member을 제외한(얘는 어차피 자동주입이라서..) member Id를 이중배열로 받는 방식으로 변경
=> ArrayList<ArrayList<String>>
의 형태로 memberIds 를 받아주었다.