Airlines are required to return a passenger to their point of departure if the passenger is refused entry at a transit point (or a destination), and they must do so at the airline's expense. Therefore, they're very careful to check whether a passenger has the correct travel documents.
The database at Timatic (here's an article about Timatic on Wikipedia) is the common reference. Here's a Timatic portal; there are others as well.
Entering your information (citizen of Sri Lanka, flying via Bangkok to Shanghai), returns this data:
Visa required, except for Passengers transiting through
Bangkok (BKK) with a confirmed onward ticket for a flight to a
third country within 12 hours. They must stay in the
international transit area of the airport and have documents
required for the next destination.
- This TWOV facility does not apply to passengers traveling
on Angkor Air (K6), Beijing Capital Airlines (JD), Business
Air (8B), Cebu Pacific (5J), Eaststar Jet (ZE), Golden
Myanmar Airlines (Y5), Indigo (6E), Jeju Air (7C), Jet Asia
Airways (JF), Jetstar (JQ), Jetstar Pacific (BL), Jin Air
(LJ), JuneYao Airlines (HO)...
While Transfer Without Visa (TWOV) is available for some travelers on this routing, June Yao Airlines appears on the list of carriers whose passengers are not entitled to TWOV.
Thus, you will need to apply for and secure a transit visa to allow you to enter and remain in Thailand while you wait for your Bangkok > Shanghai flight.
Because you are not traveling on the same airline for both legs, your hold luggage will most likely not be checked through from Colombo to Shanghai. You will have to retrieve your hold luggage from the luggage carousel in Bangkok, and then transfer the hold luggage to June Yao Airlines for the Bangkok > Shanghai flight.