복불복망
443
2020-10-12 14:33:33 작성 2020-10-12 15:16:01 수정됨
3
156

mvc mybatis 에서 resultType=


controller

@RequestMapping("/forecast/ldmSteps_sel.do")
public String ldmSteps_sel(HttpServletRequest request, Model model,@ModelAttribute("ldmSttmnLVO") ldmSttmnLVO vo) throws Exception{
	
	try{
		List<ldmSttmnLVO> statisticListss = forecastInfoService.selectLdmStepList(vo);
		/*HashMap<String, String> map = new HashMap<String, String>();*/
		
		System.out.println(ToStringBuilder.reflectionToString(statisticListss));
		log.debug(statisticListss);
		
	} catch (Exception e) { 
		request.setAttribute("errorMessage", "에러가 발생했습니다."); 
	}
	
	
	return "jsonView";
	
}


--

service

public List<ldmSttmnLVO> selectLdmStepList (ldmSttmnLVO vo) throws Exception;

--

serviceimpl

public List<ldmSttmnLVO> selectLdmStepList(ldmSttmnLVO vo) throws Exception
{
	
	return forecastInfoMapper.selectLdmStepList(vo);
}

--

mapper

@SuppressWarnings("unchecked")
	public List selectLdmStepList(ldmSttmnLVO vo) throws Exception
	{
		System.out.println("ttttttttttt");
		System.out.println(ToStringBuilder.reflectionToString(vo));
		return list("selectLdmStepList", vo);
	}

--

mapper.xml

<resultMap type="go.forest.mhms.cmm.model.ldmSttmnLVO" id="inselLdmStepsList">
		<result property="keyword01" 			 column="DANR_WARN"/>
		<result property="searchFrom" 			 column="DANR_DATE"/>
		<result property="keyword02" 		 column="DANR_AREA"/>
		<result property="keyword03" 		 column="DANR_MUZ"/>
		<result property="keyword04" 		 column="DANR_TIME"/>
</resultMap>

<select id="selectLdmStepList" parameterType="go.forest.mhms.cmm.model.ldmSttmnLVO" resultType="go.forest.mhms.cmm.model.ldmSttmnLVO">
	<![CDATA[
	  SELECT DANR_WARN as keyword01,
	  DANR_DATE as searchFrom, 
	  DANR_AREA as keyword02,
	  DANR_MUZ as keyword03,
	  DANR_TIME as keyword04
	  FROM TB_LDM_STEPLIST
	]]>
</select>

.----

vo



/** 키워드01 */
private String keyword01 = "";
/** 키워드02 */
private String keyword02 = "";
/** 키워드03 */
private String keyword03 = "";
/** 키워드04 */
private String keyword04 = "";
private String searchFrom = "";


select 한 결과를 vo에 담아서 (keyword01, keyword02, keyword03, keyword04, searchFrom)

list로 가져오고싶은데.. 실행은 제대로 되는데, 가져온 list를 보면 비어있네요..


xml에서 SELECT DANR_WARN as keyword01,

  DANR_DATE as searchFrom, 

  DANR_AREA as keyword02,

  DANR_MUZ as keyword03,

  DANR_TIME as keyword04

  FROM TB_LDM_STEPLIST


컬럼을 as로(vo 변수로)바꿔주고 가져오는게 틀린건지..

조언 부탁드립니다
 

 

 

0