错误如下文并附上mapper.xml中修改代码,不清楚哪里出了问题,先谢谢各位了
以下为报错信息: org.springframework.jdbc.BadSqlGrammarException:
Error updating database. Cause: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 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 'where file_id = null' at line 3
The error may involve com.arvato.cms.file.dao.mappers.FileMapper.updateByPrimary-Inline
The error occurred while setting parameters
SQL: update cms_files where file_id = ?
Cause: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 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 'where file_id = null' at line 3
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 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 'where file_id = null' at line 3
以下为功能xml代码:
update cms_files
<set >
<if test="file_name != null" >
file_name = #{file_name,jdbcType=VARCHAR},
</if>
<if test="file_type != null" >
file_type = #{file_type,jdbcType=CHAR},
</if>
<if test="file_url != null" >
file_url = #{file_url,jdbcType=VARCHAR},
</if>
<if test="file_remak != null" >
file_remak = #{file_remak,jdbcType=VARCHAR},
</if>
<if test="file_state != null" >
file_state = #{file_state,jdbcType=CHAR},
</if>
</set>
where file_id = #{file_id,jdbcType=CHAR}