As we all know, there are several ways to organize scripts in a project.
All clear have positive and negative points to the need.
I'll cite below ways I've seen and what I think of each one, from MY experience.
Sort by Tables:
It's a straightforward and easy to understand way. However, this is for those who already know the context of the application. If it is something that the developer does not really know, it will get lost in the database and the source.
Organize by domain:
Today I work a lot with MVC and DDD.
I confess that I adapt better with DDD. It makes more sense for me to organize the system into domains.
However, sometimes we add too much complexity to the project structure if we do not follow this pattern correctly.
I recommend this.
Arrange by layers
Honestly, I've seen programmers lose themselves more in this model than others.
It is very easy for systems to be born with this pattern but over time they will be messed up just because each programmer understands functionality on a different layer. This way, in a short time, the system becomes a "monster".
With regard to DAO.
There is also another access pattern that is that of repositories.
Instead of creating objects that access data directly, you create repositories that query.
In this case, you can create repositories adhering to the business rule rather than abstractions of the created templates.
Example: When we are creating a report we make several queries in the same context.
It's easy to predict that the best thing to do is to bring in all the information at once and unravel the data on the screen. Right?
In this way, a repository could be created that would meet this need for this report, for example, using the templates as patterns, parse, only.
Important:
This is not a silver bullet response!
There are several standards out there and regardless of which choice, think about the life cycle of the software you are producing.
You will not be the one to work on it.
Knowing the company you are working with, and you can reasonably predict the profile of the people who will be in your place in the future. In this way, you can choose a standard that is easy to maintain and easy to scale.