第一种:
Dao层的方法
Public User selectUser(String name,String password);
<select id="selectUser" resultMap="BaseResultMap">
select * from user_user_t where user_name = #{0} and user_password=#{1}
</select>
第二种:
该方法采用Map传多参数
Dao层的方法
Public User selectUser(Map paramMap);
<select id=" selectUser" resultMap="BaseResultMap">
select * from user_user_t where user_name = #{userName,jdbcType=VARCHAR} and user_password=#{userPassword,jdbcType=VARCHAR}
</select>
Service层调用
public User xxxSelectUser(){
Map paramMap=new hashMap();
paramMap.put(“userName”,”对应具体的参数值”);
paramMap.put(“userPassword”,”对应具体的参数值”);
User user=xxx. selectUser(paramMap);}
第三种:
Dao层的方法
Public User selectUser(@param(“userName”)Stringname,@param(“userpassword”)String password);
<select id=" selectUser" resultMap="BaseResultMap">
select * from user_user_t where user_name = #{userName,jdbcType=VARCHAR} and user_password=#{userPassword,jdbcType=VARCHAR}
</select>Public User selectUser(@param(“userName”)Stringname,@param(“userpassword”)String password);
<select id=" selectUser" resultMap="BaseResultMap">
select * from user_user_t where user_name = #{userName,jdbcType=VARCHAR} and user_password=#{userPassword,jdbcType=VARCHAR}
</select>
Ps:如果要传对象请参考---》http://blog.youkuaiyun.com/shasiqq/article/details/51222077
转载地址:http://blog.youkuaiyun.com/shasiqq/article/details/51305666