A compound represented by formula or a pharmaceutically acceptable salt thereof, ring Ar is an aryl group or a heteroaryl group; X is -NH-; n and m are each an integer of 0 to 3, and are not simultaneously 0; p is an integer of 0 to 5; q is an integer of 0 to 8; R 1 is independently selected from a C 1-6 alkyl group, a C 3-8 cycloalkyl group, a C 2-6 alkenyl group, a C 2-6 alkynyl group, a heterocycloalkyl group, a halogen atom, an amino group, a mono(C 1-6 alkyl) amino group, a di(C 1-6 alkyl) amino group, a hydroxy group, a C 1-6 alkoxy group, a mercapto group, a C 1-6 alkylthio group, a C 1-6 alkylcarbonyl group, an aryl group, a heteroaryl group, a cyano group, and a nitro group, wherein the C 1-6 alkyl group, C 1-6 alkoxy group, C 2-6 alkenyl group, and C 2-6 alkynyl group can be substituted by a halogen atom, a cyano group, a nitro group, a C 1-6 alkoxy group, an aryl group, a heteroaryl group, or a heterocycloalkyl group; and the aryl group, heteroaryl group and heterocycloalkyl group can further be substituted by a halogen atom, a cyano group, a nitro group, a C 1-6 alkyl group, a C 1-6 alkoxy group, or a C 1-6 alkylcarbonyl group; R 2 is selected from hydrogen, a hydroxy group, a C 1-6 alkoxy group, a heterocycloalkyloxy group, and a C 1-6 alkoxy group substituted by C 1-6 alkoxy or heterocycloalkyl group; R 3 is independently selected from a halogen atom, a cyano group, a mercapto group, a C 1-6 alkylthio group, a C 1-6 alkyl group, a C 3-8 cycloalkyl group, a heterocycloalkyl group, an amino group, a mono(C 1-6 alkyl)amino group, a di(C 1-6 alkyl)amino group, a hydroxy group, a C 1-6 alkoxy group, a C 1-6 alkoxycarbonyl group, a C 1-6 alkylamido group, a mono(C 1-6 alkyl)aminoacyl group, and a di(C 1-6 alkyl)aminoacyl group; R 4, R 5, and R 6 are each independently selected from hydrogen, a halogen atom, a C 1-6 alkyl group, a C 3-8 cycloalkyl group, a heterocycloalkyl group, an amino group, a mono(C 1-6 alkyl)amino group, a di(C 1-6 alkyl)amino group, a C 1-6 alkylamido group, a mono(C 1-6 alkyl)aminoacyl group, a di(C 1-6 alkyl)aminoacyl group, and a C 1-6 alkoxycarbonyl group; R 7 is hydrogen. ring Ar is an aryl group or a heteroaryl group; X is -NH-; n and m are each an integer of 0 to 3, and are not simultaneously 0; p is an integer of 0 to 5; q is an integer of 0 to 8; R 1 is independently selected from a C 1-6 alkyl group, a C 3-8 cycloalkyl group, a C 2-6 alkenyl group, a C 2-6 alkynyl group, a heterocycloalkyl group, a halogen atom, an amino group, a mono(C 1-6 alkyl) amino group, a di(C 1-6 alkyl) amino group, a hydroxy group, a C 1-6 alkoxy group, a mercapto group, a C 1-6 alkylthio group, a C 1-6 alkylcarbonyl group, an aryl group, a heteroaryl group, a cyano group, and a nitro group, wherein the C 1-6 alkyl group, C 1-6 alkoxy group, C 2-6 alkenyl group, and C 2-6 alkynyl group can be substituted by a halogen atom, a cyano group, a nitro group, a C 1-6 alkoxy group, an aryl group, a heteroaryl group, or a heterocycloalkyl group; and the aryl group, heteroaryl group and heterocycloalkyl group can further be substituted by a halogen atom, a cyano group, a nitro group, a C 1-6 alkyl group, a C 1-6 alkoxy group, or a C 1-6 alkylcarbonyl group; R 2 is selected from hydrogen, a hydroxy group, a C 1-6 alkoxy group, a heterocycloalkyloxy group, and a C 1-6 alkoxy group substituted by C 1-6 alkoxy or heterocycloalkyl group; R 3 is independently selected from a halogen atom, a cyano group, a mercapto group, a C 1-6 alkylthio group, a C 1-6 alkyl group, a C 3-8 cycloalkyl group, a heterocycloalkyl group, an amino group, a mono(C 1-6 alkyl)amino group, a di(C 1-6 alkyl)amino group, a hydroxy group, a C 1-6 alkoxy group, a C 1-6 alkoxycarbonyl group, a C 1-6 alkylamido group, a mono(C 1-6 alkyl)aminoacyl group, and a di(C 1-6 alkyl)aminoacyl group; R 4, R 5, and R 6 are each independently selected from hydrogen, a halogen atom, a C 1-6 alkyl group, a C 3-8 cycloalkyl group, a heterocycloalkyl group, an amino group, a mono(C 1-6 alkyl)amino group, a di(C 1-6 alkyl)amino group, a C 1-6 alkylamido group, a mono(C 1-6 alkyl)aminoacyl group, a di(C 1-6 alkyl)aminoacyl group, and a C 1-6 alkoxycarbonyl group; R 7 is hydrogen.