If you're making deals with a government that is undemocratic, you're making a deal with the government, but not with the people. At that point, the deal is probably going to be one that benefits the government, but not the people. Countries do that, when it is in their best interest to do so.
But the US (rightly) gets criticism for doing such things. If it's right to criticize the US for such actions, it's also right to criticize China for them.