You can either let students affect you, or you can choose to not let them affect you.
If students don't like you, so what? You aren't there to be popular.
If your class is misbehaving, don't take it personally. Just react with the appropriate formal or informal discipline measures.
If students don't do well on the almighty standardized tests, don't let it affect your confidence. Make adjustments to your approach for the next time.
You will have a miserable life as a teacher if your happiness and emotional stability is tied to student affection, behavior, or performance. Keep your focus on serving students, do the best you can, and don't connect your entire life and self worth to what happens at school.