A motor controller, including: a box body, a capacitor module, and an inverse module. The box body includes a chamber, and a radiator is disposed in the chamber. The radiator divides the chamber to yield a first chamber and a second chamber. The inverse module is disposed on an upper surface of the radiator in the first chamber. The capacitor module is disposed on a lower surface of the radiator in the second chamber. The radiator includes a cooling waterway, and a water inlet and a water outlet that communicate with the cooling waterway. The cooling waterway is adapted to cool the capacitor module and the inverse module.