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>
相关推荐
鬼手点金2 天前
Harness 工程:模型之外的竞争力
服务器·人工智能·深度学习·机器学习·bug
巴巴媛6663 天前
【Debug1】程序死机,while(1)循环,怎么办?
c语言·笔记·stm32·嵌入式硬件·bug
JosieBook5 天前
【多线程】两台机器同时抢一个字典:一次并发 Bug 的排查
java·网络·bug
鬼手点金5 天前
nanoGPT/nanochat 能做出 DeepSeek/Qwen 这样的大模型吗?
服务器·前端·javascript·bug·openclaw
小玮看世界6 天前
【Bug 报告】腾讯元宝 Windows 客户端 v2.88.1 新建对话卡死、界面残留与输入框乱码
bug
衣舞晨风7 天前
一次升级引出两个BUG:API7 AI 网关流式 500 与低流量 CPU 打满排查
网关·ai·bug·异常排查
小此方11 天前
「插曲:Git」企业规范篇:DevOps开发模型、Git Flow五类分支设计与测试/预发布/生产环境Bug修复及Hotfix紧急发布流程
git·bug·devops
中文英文-我选中文13 天前
FreeRTOS 玄学Bug:调换任务创建顺序,程序时而正常、时而死机(栈溢出内存踩踏深度复盘)
bug
Keven_1113 天前
BUG:UVA116
算法·bug·图论
鬼手点金13 天前
opencode-隐私优先配置
服务器·前端·javascript·bug·openclaw