The dao layer does not need to throw exceptions. It should throw exceptions at the service layer, which can be custom exceptions or wrapping exceptions, and then define exception handlers in the controller for unified processing or separate processing.
refer to:
https://segmentfault.com/q/1010000006653269