Vietnam's regulars were deployed to Cambodia at that time, and Chinese used this opportunity to "teach" Vietnamese a lesson. Didn't work out. Vietnamese "territorial defense" units began to conduct guerrilla campaign and inflicted very heavy losses on invading conventional military. Furthermore, the prospect of a full blown war between China and the Soviet Union became very real, so the Chinese declared a victory, conducted a scorched earth policy, and withdrew.