Provided herein are dihydropyrimidine compounds and their pharmaceutical applications, especially for use in treating and preventing HBV diseases. Specifically, provided herein are compounds having Formula (I) or (Ia), or an enantiomer, a diastereoisomer, a tautomer, a hydrate, a solvate, or a pharmaceutically acceptable salt thereof, wherein the variables of the formulas are as defined in the specification. Also provided herein is the use of the compounds having Formula (I) or (Ia), or an enantiomer, a diastereoisomer, a tautomer, a hydrate, a solvate, or a pharmaceutically acceptable salt thereof for treating and preventing HBV diseases.本發明涉及一種二氫嘧啶類化合物及其作為藥物的用途,尤其是作為用於治療和預防乙型肝炎的藥物的應用。具體地說,本發明涉及通式(I)或(Ia)所示的化合物或其對映異構體、非對映異構體、互變異構體、水合物、溶劑化物或藥學上可接受的鹽,其中各變數如說明書所定義。本發明還涉及通式(I)或(Ia)所示的化合物或其對映異構體、非對映異構體、互變異構體、水合物、溶劑化物或藥學上可接受的鹽作為藥物的用途,尤其是作為用於治療和預防乙型肝炎的藥物的用途。