참고 : 데이터베이스로 스프링 프레임 워크 + MS-SQL을 사용하고 있습니다. 1 쿼리 - - 나는 두 개의 정수를 사용하여 검색에 대한 쿼리가있는 경우스프링을 사용하여 쿼리에서 여러 유형 매개 변수 보내기 또는 변환
은/ID는 다음 나는이
mybatis.xml 같은 것을 할 것 매개 변수>Integer
+ Integer
로
<select id="listProctorLogs" parameterType="java.util.Map" resultMap="logResultMap">
select SchoolId, ProctorId, DateLog, LogType, ImageRecognized from ProctorLog where
SchoolId=#{schoolId} and ProctorId=#{proctorId}
</select>
자바 - 자바 1
HashMap<String, Integer> inputMap = new HashMap<>();
inputMap.put("proctorId", proctorId);
inputMap.put("schoolId", schoolId);
sqlSession.selectList("listProctorLogs", inputMap);
하지만 내가 한 Integer
내가 쿼리 매개 변수, 다음 어떻게 JAVA에서 매개 변수를 전달하고 내가 mybatis.xml에서 그 방법을 얻을 수있는 전달하려는 하나 String
이 있다면?
mybatis.xml - 쿼리 2 -
<select id="listProctorLogs" parameterType="java.util.Map" resultMap="logResultMap">
select SchoolId, ProctorId, DateLog, LogType, ImageRecognized from ProctorLog where
SchoolName=#{schoolName} and ProctorId=#{proctorId}
</select>
JAVA 매개 변수>Integer
+ String
로 - JAVA 2
// What should I put here ?? HashMap<String,String>
// or HashMap<String,Object> ... and how can I get
// these parameters in mybatis.xml if parameters are either
// String or Object (convert to Interger) ??
"Map','Map