Parameter 'id' not found. Available parameters are [0, 1, 2, param3, param1, param2]

来源:互联网 发布:战舰世界 战列舰 知乎 编辑:程序博客网 时间:2024/06/08 13:27

解决的方法很简单

先说第一种

DAO层的函数方法   

PublicUserselectUser(String imgURL,String id);
对应的Mapper.xml
<sql id="updateByPo1">
        <trim prefix="set" suffixOverrides=",">
            <if test="_parameter!= null">
                imgURL = #{imgURL},
            </if>
            </trim>
            </sql>

 <update id="savePhoto" parameterType="String">
        update customer_account_info//表名
        <include refid="updateByPo1"/>
        where id = #{id}
    </update>


修改后

<sql id="updateByPo1">
        <trim prefix="set" suffixOverrides=",">
            <if test="_parameter!= null">
                imgURL = #{0},
            </if>
            </trim>
            </sql>

 <update id="savePhoto" parameterType="String">
        update customer_account_info//表名
        <include refid="updateByPo1"/>
        where id = #{1}
    </update>

其中,#{0}代表接收的是dao层中的第一个参数,#{1}代表dao层中第二参数,更多参数一致往后加即可。






阅读全文
0 0
原创粉丝点击