You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to construct a dynamic SQL query to update the balance field in the user table. The goal is to increment the balance field by a certain value for a specific uid. However, I'm facing difficulties in getting the query to execute correctly.
I am looking to achieve an effect similar to the following code snippet:
@Update("UPDATE user SET balance = balance + #{balance} WHERE uid = #{uid}")
void addUserBalance(@Param("uid") Integer uid, @Param("balance") Integer balance);
Attempted Solutions:
I tried using .set(balance).equalToWhenPresent(...) but it didn't work as expected.
Could you please provide some guidance on how to correctly construct this query using MyBatis Dynamic SQL? Any help would be greatly appreciated.