Provided are a ß-lactamase inhibitor as shown in formula (I), or an ester, a stereoisomer, a pharmaceutically acceptable salt thereof and a preparation method therefor, and a pharmaceutical composition comprising the ß-lactamase inhibitor as shown in formula (I), or an ester, a stereoisomer and a pharmaceutically acceptable salt thereof; and a method for treating diseases caused by bacterial infection, which includes administering the ß-lactamase inhibitor as shown in formula (I), or an ester, a stereoisomer and a pharmaceutically acceptable salt thereof to patients or subjects in need.