-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#42 MainController와 PetRestController에 있는 session에 담는 코드 util화 시키기 완료
- Loading branch information
Showing
5 changed files
with
41 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
package com.petpular.common; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import com.petpular.pet.model.Pet; | ||
|
||
public class SessionUtils { | ||
public static String petArr(int userId, List<Pet> petList) { | ||
return ""; | ||
public static List<String> petArr(Integer userId, List<Pet> petList) { | ||
List<String> arr = new ArrayList<>(); | ||
|
||
String petNameArr = petList.get(0).getName(); | ||
String petIdArr = Integer.toString(petList.get(0).getId()); | ||
|
||
if (petList.size() > 0) { | ||
for (int i = 1; i < petList.size(); i++) { | ||
|
||
petIdArr = petIdArr + "," + petList.get(i).getId(); | ||
arr.add(petIdArr); | ||
petNameArr = petNameArr + "," + petList.get(i).getName(); | ||
arr.add(petNameArr); | ||
} | ||
} | ||
return arr; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters