Java 使用spring发送或转换查询中的多个类型参数

Java 使用spring发送或转换查询中的多个类型参数,java,sql-server,xml,spring,mybatis,Java,Sql Server,Xml,Spring,Mybatis,注意:我使用Spring框架+MS-SQL作为数据库 如果我有一个使用两个整数/ID进行搜索的查询,那么我将执行以下操作 mybatis.xml-查询1->整数+整数作为参数 <select id="listProctorLogs" parameterType="java.util.Map" resultMap="logResultMap"> select SchoolId, ProctorId, DateLog, LogType, ImageRecognized from

注意:我使用Spring框架+MS-SQL作为数据库

如果我有一个使用两个整数/ID进行搜索的查询,那么我将执行以下操作

mybatis.xml-查询1->整数+整数作为参数

<select id="listProctorLogs" parameterType="java.util.Map" resultMap="logResultMap">
    select SchoolId, ProctorId, DateLog, LogType, ImageRecognized from ProctorLog where
    SchoolId=#{schoolId} and ProctorId=#{proctorId}
</select>
<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-Java2

您将使用地图版本


但是,这只是为了让您的代码能够正确编译。在运行时,由于类型擦除,此泛型信息不存在。因此,对于MyBatis,它与使用Map、Map甚至非泛型Map本身没有什么不同,因为它在运行时检查参数类型,并为您使用适当的TypeHandler。

您能给我一份文档或文章的参考资料吗,其中说明Map、Map、,甚至是非泛型映射本身,因为它在运行时检查参数类型并为您使用适当的TypeHandler。谢谢
<select id="listProctorLogs" parameterType="java.util.Map" resultMap="logResultMap">
    select SchoolId, ProctorId, DateLog, LogType, ImageRecognized from ProctorLog where
    SchoolName=#{schoolName} and ProctorId=#{proctorId}
</select>
// 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<String, Object> inputMap = new HashMap<>();
inputMap.put("proctorId", proctorId);
inputMap.put("schoolName", schoolName);
sqlSession.selectList("listProctorLogs", inputMap);