본문 바로가기
SpringBoot

[Spring] Map타입에서 List빼서 for문 적용

by Yeoseungwon 2024. 11. 4.
728x90

 

public Map<String, Object> selectLessonMemberList(LessonVO vo) throws Exception {
		Map<String, Object> selectLessonMemberList =  lessonDAO.selectLessonMemberList(vo);
		List<Map<String, Object>> resultList = (List<Map<String, Object>>) selectLessonMemberList.get("resultList");

		 for (Map<String, Object> map : resultList) {
			 String lessonId = SF_StringUtil.getMapToKey(map, "lesson_id");
			 String membershipNo = SF_StringUtil.getMapToKey(map, "membership_no");

	        LessonReservationVO rvo = new LessonReservationVO();
	        rvo.setGroupId(vo.getGroupId());
	        rvo.setLessonId(lessonId);
	        rvo.setMembershipNo(membershipNo);
	        
	       
	        long lessonReservationCnt = lessonReservationDAO.selectMemberLessonReservation(rvo);
	        
	        map.put("reservationCnt", lessonReservationCnt);
		 }
		return selectLessonMemberList;
	}
728x90

'SpringBoot' 카테고리의 다른 글

[HttpServletRequest] request 출력  (0) 2024.07.25
[Spring Boot] 엑셀 다운로드  (1) 2024.02.29
[Spring Boot] Cubrid insert  (1) 2023.11.20
[JSTL] 날짜사용  (0) 2023.11.09
[Spring Boot] select 검색조건유지 jstl  (0) 2023.11.06