Open yegetables opened 1 year ago
user表 name,uid,age 生成的Dao是List<User> queryAllByLimit(User user, @Param("pageable") Pageable pageable);,只有pageable 加了注解。mapper是这样的
List<User> queryAllByLimit(User user, @Param("pageable") Pageable pageable);
<select id="queryAllByLimit" resultMap="UserMap"> select name, uid, age from user <where> <if test="name != null and user.name != ''"> and name = #{name} </if> <if test="uid != null"> and uid = #{uid} </if> <if test="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]
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前缀 解决。
List<User> queryAllByLimit(@Param("user") User user, @Param("pageable") Pageable pageable);
user.uid/user.name/user.age
疑问,为什么模版中多参时不全加上@Param注解呢? jdk17 sringboot 3.0.6
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