The Midrashim are mostly derived from, and based upon, the teachings of the Tannaim:
AcharonimRishonimGeonimSavoraimAmoraimTannaimZugot