43.bug:mapper接口参数使用@param重命名导致的错误

错误信息:Nested exception is org.apache.ibatis.binding.bindingException:parameter inVo not found

java 复制代码
public interface UserMapper{
//查询用户列表

User queryUserList(@Param ("inVo") UserInVo userInVo);
}

对应的UserMapper如下:

sql 复制代码
<select id="queryUserList" returnType="User">
    selelct id,name,age,phone,createtime from tb_user A
    <where>
        <if test="inVo.name!='' and inVo.name!=null">
            A.name=#{inVo.name}
        </if>
        <if test=" userInVo.age!=null">
            A.age=#{userInVo.age}
        </if>
    </where>
    order by A.createtime desc
</select>

原因 :mappper 的接口方法中,因为使用@Param注解,重命名入参,但是SQL中没有使用重命名的参数名导致

改正:SQL使用重命名后的参数名

sql 复制代码
<select id="queryUserList" returnType="User">
    selelct id,name,age,phone,createtime from tb_user A
    <where>
        <if test="inVo.name!='' and inVo.name!=null">
            A.name=#{inVo.name}
        </if>
//错误改正:userInVo改正为:inVo
        <if test=" inVo.age!=null">
            A.age=#{inVo.age}
        </if>
    </where>
    order by A.createtime desc
</select>
相关推荐
^Rocky2 天前
IT 疑难杂症诊疗室:复杂技术问题解决实录
运维·bug
Keven_114 天前
Bug:UVA816
bug
Keven_115 天前
Bug:UVA1103
bug
钱栈up5 天前
坯料管理导入功能bug修复:只改前端一个文件就解决问题
前端·bug
项目管理实用笔记6 天前
Bug跟踪管理系统有哪些?2026 推荐清单与选型指南
bug·研发管理·研发管理工具·项目管理软件选型
iNeuOS工业互联网9 天前
iNeuOS工业互联网操作系统,重要更新:性能优化、安全漏洞与BUG修复,远程控制响应效率大幅提升
性能优化·bug
嵌入式学习菌10 天前
Modbus‑RTU 数据类型分析
开发语言·单片机·bug
缘友一世10 天前
dsh(0.1.5-rc.1)接入官方模型deepseek-flash图像输入不支持修复
bug·图片输入·deepseek-flash·dsh 0.1.5-rc.1
lovingsoft10 天前
AI测试中的对抗测试:从“找Bug”到“预演战争”
人工智能·bug
golang学习记12 天前
VS Code 新UI被曝重大bug:菜单栏消失了
vscode·bug