A fused pyrimidine compound represented by formula I or IA, a pharmaceutically acceptable salt, hydrate, or solvate thereof, an optical isomer thereof, wherein: X is S or O; R 1 is hydrogen, deuterium or a C 1-20 alkyl; R 2 is hydrogen, deuterium -(CR 8 R 9) m NR 5 R 6, -(CR 8 R 9) m NR 7 C(=Y)R 5, or a C 2-20 heterocyclyl, wherein the heterocyclyl is optionally substituted by a substituent selected from the group consisting of: -C(=Y)OR 5; wherein heterocyclyl refers to a 5 to 10 membered aromatic or non-aromatic heterocyclic ring having 1 to 4 heteroatoms selected from the group consisting of O, N, and S, bicyclic groups are also included; L is a C 1-3 alkylene or absent; Q is a C 2-20 heterocyclyl, and is optionally substituted by a substituent selected from the group consisting of: -C(=Y)R 5, -C(=Y)OR 5,-C(=Y)NR 5 R 6, -S 2 R 5, and C 1-12 alkyl; wherein heterocyclyl refers to a 5 to 10 membered aromatic or non-aromatic heterocyclic ring having 1 to 4 heteroatoms selected from the group consisting of O, N, and S, bicyclic groups are also included; or Q is -NR 7 C(=Y)R 5; (R 3) k represents that the hydrogens attached to the morpholine ring are substituted by k occurrences of R 3, at each occurrence the R 3 is the same or different from each other, and independently selected from the group consisting of deuterium, C 1-6 alkyl, or any two of the R 3 may be linked by a single bond, C 1-6 alkylene or C 1-6 alkylene substituted by one or more heteroatoms, the heteroatom is O, N, or S; A is N or CR 4a; D is N or CR 4b; E is N or CR 4d; G is N or CR 4e; A, D, E and G are not N at the same time; Each of R 4, R 4a, R 4b, R 4d and R 4e is independently hydrogen, halogen, -CN, a C 1-20 alkyl, a C 1-20 alkoxy, -NR 5 R 6 or -OR 5; Each of R 5, R 5', R 6, R 7 and R 7' is independently hydrogen, or a C 1-12 alkyl, or R 5, R 6 together with the nitrogen to which they are attached form a 5-10 membered heterocycle optionally substituted by a substituent selected from the group consisting of: -(CH 2) m OR 7, -SO 2 R 7, -C(=O)R 7, -C(=Y)NR 7 R 7' and C 1-12 alkyl; wherein heterocycle refers to a 5 to 10 membered aromatic or non-aromatic heterocyclic ring having 1 to 4 heteroatoms selected from the group consisting of O, N, and S, bicyclic groups are also included; -(CR 8 R 9) m represents that m (CR 8 R 9) is connected, wherein each of R 8 and R 9 is the same or different from each other, and independently selected from hydrogen or deuterium; Wherein the alkyl is optionally substituted by a substituent selected from the group consisting of: halogen, OH or C 6-20 aryl; Y is O or S; m and k are independently 0, 1 or 2. X is S or O; R 1 is hydrogen, deuterium or a C 1-20 alkyl; R 2 is hydrogen, deuterium -(CR 8 R 9) m NR 5 R 6, -(CR 8 R 9) m NR 7 C(=Y)R 5, or a C 2-20 heterocyclyl, wherein the heterocyclyl is optionally substituted by a substituent selected from the group consisting of: -C(=Y)OR 5; wherein heterocyclyl refers to a 5 to 10 membered aromatic or non-aromatic heterocyclic ring having 1 to 4 heteroatoms selected from the group consisting of O, N, and S, bicyclic groups are also included; L is a C 1-3 alkylene or absent; Q is a C 2-20 heterocyclyl, and is optionally substituted by a substituent selected from the group consisting of: -C(=Y)R 5, -C(=Y)OR 5,-C(=Y)NR 5 R 6, -S 2 R 5, and C 1-12 alkyl; wherein heterocyclyl refers to a 5 to 10 membered aromatic or non-aromatic heterocyclic ring having 1 to 4 heteroatoms selected from the group consisting of O, N, and S, bicyclic groups are also included; or Q is -NR 7 C(=Y)R 5; (R 3) k represents that the hydrogens attached to the morpholine ring are substituted by k occurrences of R 3, at each occurrence the R 3 is the same or different from each other, and independently selected from the group consisting of deuterium, C 1-6 alkyl, or any two of the R 3 may be linked by a single bond, C 1-6 alkylene or C 1-6 alkylene substituted by one or more heteroatoms, the heteroatom is O, N, or S; A is N or CR 4a; D is N or CR 4b; E is N or CR 4d; G is N or CR 4e; A, D, E and G are not N at the same time; Each of R 4, R 4a, R 4b, R 4d and R 4e is independently hydrogen, halogen, -CN, a C 1-20 alkyl, a C 1-20 alkoxy, -NR 5 R 6 or -OR 5; Each of R 5, R 5', R 6, R 7 and R 7' is independently hydrogen, or a C 1-12 alkyl, or R 5, R 6 together with the nitrogen to which they are attached form a 5-10 membered heterocycle optionally substituted by a substituent selected from the group consisting of: -(CH 2) m OR 7, -SO 2 R 7, -C(=O)R 7, -C(=Y)NR 7 R 7' and C 1-12 alkyl; wherein heterocycle refers to a 5 to 10 membered aromatic or non-aromatic heterocyclic ring having 1 to 4 heteroatoms selected from the group consisting of O, N, and S, bicyclic groups are also included; -(CR 8 R 9) m represents that m (CR 8 R 9) is connected, wherein each of R 8 and R 9 is the same or different from each other, and independently selected from hydrogen or deuterium; Wherein the alkyl is optionally substituted by a substituent selected from the group consisting of: halogen, OH or C 6-20 aryl; Y is O or S; m and k are independently 0, 1 or 2.