doesn't sound fair, but sometimes as a teacher it's difficult if the children messing about aren't easily identifiable and there's a general mess about going on. Sometimes keeping the whole class in or whatever can work by peer pressure - your DD is cross so next time the ones who are usually good and were cross might put pressure on the others to behave better.
I wouldn't advocate this as a regular method of discipline though, as it isn't fair fundamentally.