为什么会报错不知道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