Almost all crime in San Francisco is committed by repeat criminals. You add beat cops to arrest those criminals, and you elect a DA who will prosecute those criminals when they are arrested, and you elect legislators who make sure there are laws that allow convicted criminals, especially repeat offenders, to be sentenced to long prison sentences.
That process is called "fixing the underlying issues in society".