Of course, the civil service examination has requirements for each job list and restrictions on majors. If you are a law major, you can apply for a position that requires a law major.
If in doubt, please consult the public education enterprises in China.