A compound of formula I: wherein: Ring A is selected from a benzene ring or a 5- or 6-membered heteroaromatic ring containing 1 or 2 heteroatoms selected from the group consisting of N, O and S; each R 1 is independently selected from the group consisting of halogen, C 1-3 haloalkyl, carboxy, amino, C 1-6 alkyl, C 3-6 cycloalkyl and C 3-6 heteroalicyclyl; or two adjacent R 1 groups, together with the atoms of the Ring A to which they are attached, form a 5- to 7-membered cycloalkyl ring or a 5- to 7-membered heteroalicyclic ring, and a methylene of the 5- to 7-membered cycloalkyl ring or a methylene of the 5- to 7-membered heteroalicyclic ring may optionally further form one or two carbonyl groups; R 2 is selected from phenyl or 5- or 6-membered heteroaryl containing 1 or 2 heteroatoms selected from the group consisting of N, O and S, and may be optionally substituted with one or more Rs; each R 3 is independently selected from the group consisting of hydrogen, halogen, C 1-3 haloalkyl, hydroxy, amino and C 1-6 alkyl; each R 4 is independently selected from hydrogen or C 1-6 alkyl; R 5 and R 6 are each independently selected from the group consisting of hydrogen, halogen, hydroxy, amino, C 1-6 alkyl, C 2-6 alkenyl, C 3-6 cycloalkyl and C 3-6 heteroalicyclyl; or one of R 5 and R 6 is an oxygen atom of carbonyl, and the other is absent; or R 5 and R 6, together with the carbon atom to which they are attached, form a 3- to 7-membered cycloalkyl ring or a 3- to 7-membered heteroalicyclic ring, and the 3- to 7-membered cycloalkyl ring or the 3- to 7-membered heteroalicyclic ring may be further optionally substituted with C 1-6 alkyl, halogen, hydroxy or amino; L 1 and L 2 are each independently selected from the group consisting of -C -, -N(R 4)-, and -S 2 -, and L 1 is different from L 2; R 7 is selected from the group consisting of C 1-6 alkyl, C 3-6 cycloalkyl and C 3-6 heteroalicyclyl, and may be optionally substituted with one or more R 9; each R 5 and each R 9 are independently selected from the group consisting of halogen, hydroxy, amino, cyano, C 1-3 haloalkyl, C 1-6 alkyl and C 3-6 heteroalicyclyl; m and n are independently 1, 2 or 3; and o and p are each independently selected from 0 or 1, but cannot both be 0; or a pharmaceutically acceptable salt or hydrate thereof. Ring A is selected from a benzene ring or a 5- or 6-membered heteroaromatic ring containing 1 or 2 heteroatoms selected from the group consisting of N, O and S; each R 1 is independently selected from the group consisting of halogen, C 1-3 haloalkyl, carboxy, amino, C 1-6 alkyl, C 3-6 cycloalkyl and C 3-6 heteroalicyclyl; or two adjacent R 1 groups, together with the atoms of the Ring A to which they are attached, form a 5- to 7-membered cycloalkyl ring or a 5- to 7-membered heteroalicyclic ring, and a methylene of the 5- to 7-membered cycloalkyl ring or a methylene of the 5- to 7-membered heteroalicyclic ring may optionally further form one or two carbonyl groups; R 2 is selected from phenyl or 5- or 6-membered heteroaryl containing 1 or 2 heteroatoms selected from the group consisting of N, O and S, and may be optionally substituted with one or more Rs; each R 3 is independently selected from the group consisting of hydrogen, halogen, C 1-3 haloalkyl, hydroxy, amino and C 1-6 alkyl; each R 4 is independently selected from hydrogen or C 1-6 alkyl; R 5 and R 6 are each independently selected from the group consisting of hydrogen, halogen, hydroxy, amino, C 1-6 alkyl, C 2-6 alkenyl, C 3-6 cycloalkyl and C 3-6 heteroalicyclyl; or one of R 5 and R 6 is an oxygen atom of carbonyl, and the other is absent; or R 5 and R 6, together with the carbon atom to which they are attached, form a 3- to 7-membered cycloalkyl ring or a 3- to 7-membered heteroalicyclic ring, and the 3- to 7-membered cycloalkyl ring or the 3- to 7-membered heteroalicyclic ring may be further optionally substituted with C 1-6 alkyl, halogen, hydroxy or amino; L 1 and L 2 are each independently selected from the group consisting of -C -, -N(R 4)-, and -S 2 -, and L 1 is different from L 2; R 7 is selected from the group consisting of C 1-6 alkyl, C 3-6 cycloalkyl and C 3-6 heteroalicyclyl, and may be optionally substituted with one or more R 9; each R 5 and each R 9 are independently selected from the group consisting of halogen, hydroxy, amino, cyano, C 1-3 haloalkyl, C 1-6 alkyl and C 3-6 heteroalicyclyl; m and n are independently 1, 2 or 3; and o and p are each independently selected from 0 or 1, but cannot both be 0;