Dikes and irrigation in Ningxia trace to the beginning of dynastic rule , when the Qin rulers who unified China in 221 B.C . built irrigation for soldiers garrisoned on some of the earliest sections of the Great Wall .