It means that you do not want to impose bad things on yourself and do not impose them on others. You also hope that others can get what you want (good things).
From - "The Analects of Confucius·Ling Gong of Wei" by Confucius in the Spring and Autumn and Warring States Period.
Original text: Do not do to others what you do not want others to do to you, and do to others what you do not want others to do to you.
"Don't do to others what you don't want others to do to you" means: don't impose on others what you don't want. Confucius emphasized that people should treat others with forgiveness and should promote the way of "forgiveness". Only in this way can we show benevolence. The way of "forgiveness" is the negative expression of "benevolence", and its positive expression is "don't do to others what you don't want others to do to you, and do to others what you want to do to others."
Extended information:
The Analects of Confucius is one of the classic works of the Confucian school. It is a collection of quotation-style prose mainly composed of quotations and dialogue styles. The form records the words and deeds of Confucius and his disciples, and embodies Confucius' political, aesthetic, moral ethics and utilitarian values.
The content of "The Analects of Confucius" involves politics, education, literature, philosophy, and principles of conduct in life. As early as the period when Confucius set up a lecture forum in the late Spring and Autumn Period, its main content had been initially created.
After Confucius died, his disciples and re-disciples passed down his remarks from generation to generation, and gradually recorded these oral quotations, words and deeds, so they are called "Lun"; "The Analects" mainly records Confucius's words and deeds. The words and deeds of his disciples are therefore called "language".
Baidu Encyclopedia—The Analects of Confucius