@CachePut 会在方法完成后 将数据添加至缓存
@Update("UPDATE `user` SET `username` = #{username}, `real_name` = #{realName}, `password` = #{password}, `gender` =#{gender}, `user_type` = #{userType} WHERE `id` = #{id}")
int updateUser (User user);
@CachePut(cacheNames = "user",key = "#user.id")
public User updateUser(User user){
userMapper.updateUser(user);
return user;
}
@GetMapping("/updateUser")
public User updateUser(User user){
userService.updateUser(user);
return user;
}