You can do it with a mechanical interlock if you use a Jack with three-terminal connections, such as below:
The contact between pin 2 and 3 is normally closed, but is mechanically opened when a Plug it placed into the Jack.
The Jack's power supply circuit common is pin 2, and the Connector's power supply common is connected to pin 3.
Both power supplies 12V are connected to pin 1.
If a Plug is not connected, the common circuit is completed for the Connector power supply through the contacts.
But if the Jack's power supply is plugged in, the common for the Connector's power supply is open and it is disconnected from the circuit.
If you prefer to break the 12V instead of common, you can make pin 1 the common for both supplies, pin 2 the 12V circuit connection, and pin 3 the 12V connection from the connector.
Either way works the same from the circuit point-of-view.
Using that connector means you aren't buying two large diodes needing possible heat sinks, and avoid the voltage drop they subtract from the circuit voltage (which may or may not be a problem in the circuit).
