A compound of formula: wherein, X is selected from CRx or NR X1; Y is selected from CR Y or NR Y1; m is selected from 0, 1, 2, 3 or 4; R 1, R X and R Y are independently selected from: 1) H, halogen, -CN, -OH, -NO 2 or -NH 2; 2) C 1 -C 6 alkyl, C 1 -C 6 haloalkyl, C 1 -C 6 alkoxy, C 1 -C 6 haloalkoxy, C 1 -C 6 alkylthio, C 1 -C 6 alkylamino, C 1 -C 6 alkanoyl, 3- to 7-membered carbocyclyl or 3- to 8-membered heterocyclyl; wherein the said group is optionally substituted by one or more R a; or 3) Rxi and R Y1 are absent; or two adjacent substituents selected from Rx, Rxi, R Y and R Y1, or two adjacent Ri groups, together with the atoms to which they are attached may form a fused 5- to 7-membered ring, which contains 0 to 4 heteroatoms selected from N, O and S and may be substituted by one or more R a; R P1 and R P2 are each independently H; R 2 is selected from C 1 -C 6 alkoxy, C 1 -C 6 haloalkoxy, C 2 -C 6 alkenyloxy or 3- to 7-membered cycloalkyloxy; wherein the said group is optionally substituted by one or more R a; W is selected from -R 3, or -NR 3 R 4, or T 1 is selected from N or CR 3; T 2 is selected from -NR 3, -CR 3 (NR 3 R 4), O or S; D 1 and D 2 are independently selected from -(CR 3 R 4) 1-3 -; each R 3 and R 4 is independently selected from H, C 1 -C 6 alkyl, C 1 -C 6 alkoxy, C 1 -C 6 alkylamino, 3- to 7-membered carbocyclyl or 5- to 8-membered heterocyclyl; or R 3 and R 4 together with the atom to which they are attached form a 3- to 7-membered ring, which contains 0 to 3 heteroatoms selected from N, O or S; wherein the said group is optionally substituted by one or more R a; each R a is independently selected from H, -R, -NRR, or -OR, as long as the chemistry permits; wherein each R is independently H, C 1-6 alkyl, C 1-6 haloalkyl, C 1-6 alkoxy, C 1-6 haloalkoxy, 3- to 10-membered carbocyclyl, 3- to 10-membered heterocyclyl; two adjacent R could be taken together to form optionally substituted 3- to 10-membered carbocyclyl or optionally substituted 5- to 8-membered heterocyclyl; or pharmaceutically acceptable salts, crystal forms, hydrates, solvates, stereoisomers or isotopic derivatives thereof. X is selected from CRx or NR X1; Y is selected from CR Y or NR Y1; m is selected from 0, 1, 2, 3 or 4; R 1, R X and R Y are independently selected from: 1) H, halogen, -CN, -OH, -NO 2 or -NH 2; 2) C 1 -C 6 alkyl, C 1 -C 6 haloalkyl, C 1 -C 6 alkoxy, C 1 -C 6 haloalkoxy, C 1 -C 6 alkylthio, C 1 -C 6 alkylamino, C 1 -C 6 alkanoyl, 3- to 7-membered carbocyclyl or 3- to 8-membered heterocyclyl; wherein the said group is optionally substituted by one or more R a; or 3) Rxi and R Y1 are absent; or two adjacent substituents selected from Rx, Rxi, R Y and R Y1, or two adjacent Ri groups, together with the atoms to which they are attached may form a fused 5- to 7-membered ring, which contains 0 to 4 heteroatoms selected from N, O and S and may be substituted by one or more R a; 1) H, halogen, -CN, -OH, -NO 2 or -NH 2; 2) C 1 -C 6 alkyl, C 1 -C 6 haloalkyl, C 1 -C 6 alkoxy, C 1 -C 6 haloalkoxy, C 1 -C 6 alkylthio, C 1 -C 6 alkylamino, C 1 -C 6 alkanoyl, 3- to 7-membered carbocyclyl or 3- to 8-membered heterocyclyl; wherein the said group is optionally substituted by one or more R a; or 3) Rxi and R Y1 are absent; or two adjacent substituents selected from Rx, Rxi, R Y and R Y1, or two adjacent Ri groups, together with the atoms to which they are attached may form a fused 5- to 7-membered ring, which contains 0 to 4 heteroatoms selected from N, O and S and may be substituted by one or more R a; R P1 and R P2 are each independently H; R 2 is selected from C 1 -C 6 alkoxy, C 1 -C 6 haloalkoxy, C 2 -C 6 alkenyloxy or 3- to 7-membered cycloalkyloxy; wherein the said group is optionally substituted by one or more R a; W is selected from -R 3, or -NR 3 R 4, or T 1 is selected from N or CR 3; T 2 is selected from -NR 3, -CR 3 (NR 3 R 4), O or S; D 1 and D 2 are independently selected from -(CR 3 R 4) 1-3 -; each R 3 and R 4 is independently selected from H, C 1 -C 6 alkyl, C 1 -C 6 alkoxy, C 1 -C 6 alkylamino, 3- to 7-membered carbocyclyl or 5- to 8-membered heterocyclyl; or R 3 and R 4 together with the atom to which they are attached form a 3- to 7-membered ring, which contains 0 to 3 heteroatoms selected from N, O or S; wherein the said group is optionally substituted by one or more R a; each R a is independently selected from H, -R, -NRR, or -OR, as long as the chemistry permits; wherein each R is independently H, C 1-6 alkyl, C 1-6 haloalkyl, C 1-6 alkoxy, C 1-6 haloalkoxy, 3- to 10-membered carbocyclyl, 3- to 10-membered heterocyclyl; two adjacent R could be taken together to form optionally substituted 3- to 10-membered carbocyclyl or optionally substituted 5- to 8-membered heterocyclyl; or pharmaceutically acceptable salts, crystal forms, hydrates, solvates, stereoisomers or isotopic derivatives thereof.