我的更新语句哪里有问题呢

为什么会报错不知道sql语句哪里出问题了,感觉写的是对的啊


    <update id="updatemoney">
update sys_money
<set>
    <if test="bsalary!=null">
        bsalary = #{bsalary}
    if>
    <if test="psalary!=null">
        psalary = #{psalary}
    if>
set>

        <where>
            id =#{id}
        where>
    update>

错误提示:

Error updating database. Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'psalary = '0'

     WHERE id =1' at line 5

The error may exist in file [D:\vuedemo\salaryManage\target\classes\mapper\UserMapper.xml]

The error may involve defaultParameterMap

The error occurred while setting parameters

SQL: update sys_money SET bsalary = ? psalary = ? WHERE id =?

Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'psalary = '0'

     WHERE id =1' at line 5

; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'psalary = '0'

     WHERE id =1' at line 5] with root cause

java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'psalary = '0'

     WHERE id =1' at line 5

更新多个字段的时候,字段中间要加个逗号

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^