1. MyBatis的传入参数parameterType类型分两种
1. 1. 基本数据类型:int,string,long,Date;
1. 2. 复杂数据类型:类和Map
注:不同版本的MyBatis对基本类型传递过来的参数名称不能识别,要使用_parameter来代替。
- <select id="getWinLogByEventId" parameterType="java.lang.Long" resultMap="BaseResultMap">
- select <include refid="Base_Column_List"/> from win_log where eventId = #{_parameter,jdbcType=BIGINT}
- </select>
2. 如何获取参数中的值:
2.1 基本数据类型:#{参数} 获取参数中的值
2.2 复杂数据类型:#{属性名} ,map中则是#{key}
3.案例:
3.1 基本数据类型案例