Project stepping on pit-mybatis failed to update database

For Xiaobai who is just starting to learn mybatis and write SQL, it may be very distressing to update the database failure, no matter how you look at SQL. Now record this pit, remind yourself, and help people who may encounter this problem.

Since the database is not set to the default value, the database is NULL when there is no data inserted. When updating, he will use the new data to perform calculations with NULL, which leads to NULLs for all updates. It has been found that the data in the database is not Changes, but records that are not NULL will change.

1. SQL before modification.

2. Modified SQL.

A judgment was made on the basis of the previous, so that when it is updated, there will be no operations with NULL values.

Guess you like

Origin blog.csdn.net/yyp0304Devin/article/details/109786571