As far as I know, the same basic sanitary rules regarding the entrance of food via passengers' luggage that you can find anywhere else in the world apply in China. A reasonable amount of hermetically packaged food destined for personal consumption will normally find no trouble whatsoever upon entrance, albeit it will most likely be scanned just as any other personal items. I stress the "reasonable amount" part; it's not clear in your question how much you intend to bring. Needless to say that two suitcases full of cans will call attention and most likely be retained, as they may be interpreted as an attempt to circumvent customs and taxes of goods destined for sale.
Bringing fresh food is not advisable for sanitation reasons and will most likely be retained. Since this is not your case, however, you shouldn't be concerned at this possibility.
Be aware that certain products are restricted to enter in China, regardless of quantities and packaging. For more details on items prohibited and restricted by the chinese government, please consult with your closest consulate of the PRC.
Enjoy your stay in Shanghai! :)
Valoración del solicitante