Micro aerial vehicles, such as multirotors, are particularly well suited for autonomous monitoring, inspection, and surveillance, e.g., for doing inventory in large warehouses. Key prerequisites for efficient MAV inventory missions is time- and energy-efficient flight. Generated trajectories must assure the visiting of certain waypoints while preventing large deviations or overshoot, as these can cause crashes in narrow corridors. In this paper, we propose a novel trajectory generation method that is able to analytically compute time- and energy-optimal trajectories, incorporating system dynamics, based on a first-principles model. Due to the fast runtime of the method, it is not only used to generate trajectories on a higher level, but to control the MAV in real-time, substituting state-of-the-art cascaded control loops for position, velocity, and attitude.