You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<selectid="queryAllByLimit"resultMap="UserMap">
select
name, uid, age
from user
<where>
<iftest="name != null and user.name != ''">
and name = #{name}
</if>
<iftest="uid != null">
and uid = #{uid}
</if>
<iftest="age != null">
and age = #{age}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
启动报错org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available parameters are [pageable, user, param1, param2]
修改模版,List<User> queryAllByLimit(@Param("user") User user, @Param("pageable") Pageable pageable);
更改mapper时添加user.uid/user.name/user.age前缀 解决。
user表 name,uid,age
生成的Dao是
List<User> queryAllByLimit(User user, @Param("pageable") Pageable pageable);
,只有pageable 加了注解。mapper是这样的启动报错
org.apache.ibatis.binding.BindingException: Parameter 'name' not found. Available parameters are [pageable, user, param1, param2]
修改模版,
List<User> queryAllByLimit(@Param("user") User user, @Param("pageable") Pageable pageable);
更改mapper时添加
user.uid/user.name/user.age
前缀 解决。疑问,为什么模版中多参时不全加上@param注解呢?
jdk17 sringboot 3.0.6
The text was updated successfully, but these errors were encountered: