A compound as shown in formula or a pharmaceutically acceptable salt thereof, wherein, X is O or N(R 2); R 2 is H, F, Cl, Br, I, OH, NH 2 or R 3 -L 1 -, or selected from the group consisting of C 1-6 alkyl, C 1-6 heteroalkyl, C 3-6 cycloalkyl, 3-6 membered heterocycloalkyl, phenyl and 5-6 membered heteroaryl, each of which is optionally substituted by 1, 2 or 3 R; R 3 is selected from the group consisting of C 3-6 cycloalkyl, 3-6 membered heterocycloalkyl, phenyl and 5-6 membered heteroaryl, each of which is optionally substituted by 1, 2 or 3 R; L 1 is selected from the group consisting of -CH 2 -, -CH 2 CH 2 -, O, S, NH and -C(=O)-; n is selected from the group consisting of 1, 2 and 3; R 1 is H, F, Cl, Br, I, OH, NH 2, COOH, R 4 -L 2 -, or selected from the group consisting of C 1-6 alkyl, C 1-6 heteroalkyl, C 2-6 alkenyl, C 3-6 cycloalkenyl, 3-6 membered heterocycloalkenyl, C 3-6 cycloalkyl, 3-6 membered heterocycloalkyl, phenyl and 5-6 membered heteroaryl, each of which is optionally substituted by 1, 2 or 3 R; R 4 is selected from the group consisting of C 3-6 cycloalkyl, 3-6 membered heterocycloalkyl, 3-6 membered heterocycloalkenyl, phenyl and 5-6 membered heteroaryl, each of which is optionally substituted by 1, 2 or 3 R; L 2 is selected from the group consisting of -CH 2 -, -CH 2 CH 2 -, O, S, NH, -C(=O)NH-, - C(=O)O- and -C(=O)-; R is H, halogen, OH, NH 2, CN, or selected from the group consisting of C 1-6 alkyl, C 1-6 heteroalkyl, C 3-6 cycloalkyl, 3-6 membered heterocycloalkyl, each of which is optionally substituted by 1, 2 or 3 R; R' is selected from the group consisting of H, F, Cl, Br, I, OH, CN, NH 2, Me, Et, CF 3, CHF 2, CH 2 F, NHCH 3, N(CH 3) 2; the "hetero" in the C 1-6 heteroalkyl, 3-6 membered heterocycloalkyl, 5-6 membered heteroaryl and 3-6 membered heterocycloalkenyl is selected from -C(=O)NH-, -NH-, - C(=NH)-, -S(=O) 2 NH-, -S(=O)NH-, -O-, -S-, =O, =S, -O-N=, -C(=O)O-, -C(=O)-, - C(=S)-, -S(=O)-, -S(=O) 2 - and -NHC(=O)NH-; in any of the above cases, the number of the heteroatom or the heteroatom group is independently selected from 1, 2 or 3. X is O or N(R 2); R 2 is H, F, Cl, Br, I, OH, NH 2 or R 3 -L 1 -, or selected from the group consisting of C 1-6 alkyl, C 1-6 heteroalkyl, C 3-6 cycloalkyl, 3-6 membered heterocycloalkyl, phenyl and 5-6 membered heteroaryl, each of which is optionally substituted by 1, 2 or 3 R; R 3 is selected from the group consisting of C 3-6 cycloalkyl, 3-6 membered heterocycloalkyl, phenyl and 5-6 membered heteroaryl, each of which is optionally substituted by 1, 2 or 3 R; L 1 is selected from the group consisting of -CH 2 -, -CH 2 CH 2 -, O, S, NH and -C(=O)-; n is selected from the group consisting of 1, 2 and 3; R 1 is H, F, Cl, Br, I, OH, NH 2, COOH, R 4 -L 2 -, or selected from the group consisting of C 1-6 alkyl, C 1-6 heteroalkyl, C 2-6 alkenyl, C 3-6 cycloalkenyl, 3-6 membered heterocycloalkenyl, C 3-6 cycloalkyl, 3-6 membered heterocycloalkyl, phenyl and 5-6 membered heteroaryl, each of which is optionally substituted by 1, 2 or 3 R; R 4 is selected from the group consisting of C 3-6 cycloalkyl, 3-6 membered heterocycloalkyl, 3-6 membered heterocycloalkenyl, phenyl and 5-6 membered heteroaryl, each of which is optionally substituted by 1, 2 or 3 R; L 2 is selected from the group consisting of -CH 2 -, -CH 2 CH 2 -, O, S, NH, -C(=O)NH-, - C(=O)O- and -C(=O)-; R is H, halogen, OH, NH 2, CN, or selected from the group consisting of C 1-6 alkyl, C 1-6 heteroalkyl, C 3-6 cycloalkyl, 3-6 membered heterocycloalkyl, each of which is optionally substituted by 1, 2 or 3 R; R' is selected from the group consisting of H, F, Cl, Br, I, OH, CN, NH 2, Me, Et, CF 3, CHF 2, CH 2 F, NHCH 3, N(CH 3) 2; the "hetero" in the C 1-6 heteroalkyl, 3-6 membered heterocycloalkyl, 5-6 membered heteroaryl and 3-6 membered heterocycloalkenyl is selected from -C(=O)NH-, -NH-, - C(=NH)-, -S(=O) 2 NH-, -S(=O)NH-, -O-, -S-, =O, =S, -O-N=, -C(=O)O-, -C(=O)-, - C(=S)-, -S(=O)-, -S(=O) 2 - and -NHC(=O)NH-; in any of the above cases, the number of the heteroatom or the heteroatom group is independently selected from 1, 2 or 3.