A compound represented by Formula I, or a pharmaceutically acceptable salt, tautomer, or stereoisomer thereof, wherein R 1 is selected from the group consisting of H, C 1-6 alkyl, and RsC -, where R 5 is independently selected from the group consisting of C 1-6 alkyl and C 1-6 alkoxy; Ar is selected from heteroaryl or heteroaryl substituted with a substituent selected from the group consisting of halogen, cyano, C 1-6 alkyl, C 1-6 alkyl substituted with halogen, C 1-6 alkoxy, C 6 or C 10 aryl, and C 6 or C 10 aryl substituted with a substituent selected from the group consisting of halogen, cyano, C 1-6 alkyl optionally substituted with halogen, hydroxyl or C 1-6 alkoxy; n is an integer selected from 0 and 1; X is a 4-8 membered nitrogen-containing heterocyclyl where the heterocyclyl is substituted on the nitrogen with Y; or a nitrogen-containing spiral heterocyclyl where the said nitrogen is substituted with Y; Y is selected from the group consisting of -CN, -C(=O)P, -S(=O)P and -S(=O) 2 P; where P is selected from,and Rx is selected from the group consisting of H, halogen, cyano, C 1-6 alkyl, C 1-6 alkyl substituted with halogen, C 1-6 alkoxy, C 3-6 cycloalkyl, phenyl and -(CH 2) m NR 6 R 7; R 2 is selected from the group consisting of hydrogen, halogen, cyano, C 1-6 alkyl, C 1-6 alkyl substituted by substituents selected from the group consisting of F, hydroxyl and C 1-6 alkoxy; C 3-6 cycloalkyl and C 3-6 cycloalkyl substituted with F; R 3 and R 4 are independently selected from the group consisting of hydrogen; halogen; cyano; C 6 or C 10 aryl; heteroaryl; C 1-6 alkyl; C 1-6 alkylsubstituted with a substituent selected from the group consisting of C 1-6 alkoxy, NR 6 R 7, halogen, hydroxyl, C 6 or C 10 aryl, and heteroaryl; C 3-6 cycloalkyl; C 3-6 cycloalkyl substituted with halogen; C 2-6 alkenyl; and C 2-6 alkenyl substituted with a subtituent selected from the group consisiting of C 1-6 alkoxy, NR 6 R 7, halogen, hydroxyl, C 6 or C 10 aryl and heteroaryl; R 6 and R 7 are each independently selected from hydrogen, C 1-6 alkyl or together with the nitrogen they substitute form a 4-6 membered heterocyclyl; m is an integer selected from 1 to 3. R 1 is selected from the group consisting of H, C 1-6 alkyl, and RsC -, where R 5 is independently selected from the group consisting of C 1-6 alkyl and C 1-6 alkoxy; Ar is selected from heteroaryl or heteroaryl substituted with a substituent selected from the group consisting of halogen, cyano, C 1-6 alkyl, C 1-6 alkyl substituted with halogen, C 1-6 alkoxy, C 6 or C 10 aryl, and C 6 or C 10 aryl substituted with a substituent selected from the group consisting of halogen, cyano, C 1-6 alkyl optionally substituted with halogen, hydroxyl or C 1-6 alkoxy; n is an integer selected from 0 and 1; X is a 4-8 membered nitrogen-containing heterocyclyl where the heterocyclyl is substituted on the nitrogen with Y; or a nitrogen-containing spiral heterocyclyl where the said nitrogen is substituted with Y; Y is selected from the group consisting of -CN, -C(=O)P, -S(=O)P and -S(=O) 2 P; where P is selected from,and Rx is selected from the group consisting of H, halogen, cyano, C 1-6 alkyl, C 1-6 alkyl substituted with halogen, C 1-6 alkoxy, C 3-6 cycloalkyl, phenyl and -(CH 2) m NR 6 R 7; R 2 is selected from the group consisting of hydrogen, halogen, cyano, C 1-6 alkyl, C 1-6 alkyl substituted by substituents selected from the group consisting of F, hydroxyl and C 1-6 alkoxy; C 3-6 cycloalkyl and C 3-6 cycloalkyl substituted with F; R 3 and R 4 are independently selected from the group consisting of hydrogen; halogen; cyano; C 6 or C 10 aryl; heteroaryl; C 1-6 alkyl; C 1-6 alkylsubstituted with a substituent selected from the group consisting of C 1-6 alkoxy, NR 6 R 7, halogen, hydroxyl, C 6 or C 10 aryl, and heteroaryl; C 3-6 cycloalkyl; C 3-6 cycloalkyl substituted with halogen; C 2-6 alkenyl; and C 2-6 alkenyl substituted with a subtituent selected from the group consisiting of C 1-6 alkoxy, NR 6 R 7, halogen, hydroxyl, C 6 or C 10 aryl and heteroaryl; R 6 and R 7 are each independently selected from hydrogen, C 1-6 alkyl or together with the nitrogen they substitute form a 4-6 membered heterocyclyl; m is an integer selected from 1 to 3. Rx is selected from the group consisting of H, halogen, cyano, C 1-6 alkyl, C 1-6 alkyl substituted with halogen, C 1-6 alkoxy, C 3-6 cycloalkyl, phenyl and -(CH 2) m NR 6 R 7; R 2 is selected from the group consisting of hydrogen, halogen, cyano, C 1-6 alkyl, C 1-6 alkyl substituted by substituents selected from the group consisting of F, hydroxyl and C 1-6 alkoxy; C 3-6 cycloalkyl and C 3-6 cycloalkyl substituted with F; R 3 and R 4 are independently selected from the group consisting of hydrogen; halogen; cyano; C 6 or C 10 aryl; heteroaryl; C 1-6 alkyl; C 1-6 alkylsubstituted with a substituent selected from the group consisting of C 1-6 alkoxy, NR 6 R 7, halogen, hydroxyl, C 6 or C 10 aryl, and heteroaryl; C 3-6 cycloalkyl; C 3-6 cycloalkyl substituted with halogen; C 2-6 alkenyl; and C 2-6 alkenyl substituted with a subtituent selected from the group consisiting of C 1-6 alkoxy, NR 6 R 7, halogen, hydroxyl, C 6 or C 10 aryl and heteroaryl; R 6 and R 7 are each independently selected from hydrogen, C 1-6 alkyl or together with the nitrogen they substitute form a 4-6 membered heterocyclyl; m is an integer selected from 1 to 3. R 6 and R 7 are each independently selected from hydrogen, C 1-6 alkyl or together with the nitrogen they substitute form a 4-6 membered heterocyclyl; m is an integer selected from 1 to 3.