标签:dao names bat map mes shm tis target and
https://blog.csdn.net/u011897392/article/details/46738747
使用mybatis传入参数,如果在mappin.xml中使用<if>标签判断该参数是否为空,通常会报以上异常,解决方法:?在接口中该方法的参数前加上@Param("参数名")注解,即可?
接口:
public interface UserMapper {
//根据名称查询用户
List<MAP> queryUserByName(@Param("name")String name);
}?
mapping.xml:?
<mapper namespace="com.mybatis.test.dao.UserMapper">
<select id="queryUserByName" parameterType="String" resultType="java.util.HashMap">
select
t_id as id,
t_name as name,
t_password as password
from mybatis_user
where 1=1
<if test="name != null">
and t_name=#{name}
</if>
order by t_id
</select>
</mapper>
There is no getter for property named 'id' in class 'java.lang.String'
标签:dao names bat map mes shm tis target and
原文地址:https://www.cnblogs.com/feifeicui/p/9341462.html