The present invention relates to N-Substituted thiomorpholine compounds of formula I, the possible isomers, the pharmaceutically acceptable salts, the solvates, the hydrates or the prodrugs thereof as inhibitors of dipeptidyl peptidase IV (DPP-IV); and to a method for preparing the compounds of formula I, pharmaceutical compositions comprising the compounds of formula I and use of the compounds of formula II in medical field, particularly in the preparation of medicaments for treating and preventing diabetes (in particular type II diabetes), hyperglycemia, X syndrome, hyperinsulinemia, obesity, atherosclerosis and all kinds of diseases modulated by immune system.