that'll teach you

That'll teach you! — так тебе и надо; и поделом тебе

Example : That'll teach you not to flirt!

It is often followed by for doing sth or not to do sth:

Example : That'll teach you for eating so much. = That'll teach you not to eat so much. — И поделом тебе, чтобы столько не объедался.

You can also say Serves you right.

[serves you right]
[have it coming]
[teach a lesson]
[отольются кошке мышкины слёзки]