China wants Ukraine to end like Afghanistan: an embarrassing and gradual defeat of the US/West - leaving behind billions in cutting edge military hardware - after a decade of being financially and militarily drained, while having nothing to show for it. Russia is the Taliban that can make that possible, and while you don't necessarily want them to be too powerful, you definitely don't want them to just collapse.
Not to mention the US will get even more ideas if they "win" in Ukraine. From the Chinese perspective (and the perspective of much of the world), Russia is currently the anchor on US imperialist aspirations.
The real big loss for China, is Germany, who has chosen to obliterate its purchasing power as part of this war. That's the loss of a huge trading partner and quite unfortunate.