Is it against the principle of single responsibility to write this in the project?

there are several functions in the project, such as asset query, asset acquisition, asset return, my assets and so on, because the functions are similar (all are checked based on the asset location selected by the user, my assets will be more than a filter condition of the current user id), so I am now writing in the same method, url will take a parameter, the backend will distinguish which function is based on this parameter, and perform different functions through if judgment. I would like to ask whether writing several queries in one method violates the principle of a single duty, whether they should all be written separately, or whether they should be written together, such as asset inquiry, asset acquisition, and asset return. I would like to ask the gods to write a separate method for my assets.

Apr.08,2021

hey? Is not backstage how happy how to come?

as long as your company does not pay too much attention to design principles and no module requirements, there should be no need to deal with the data of a small module.

if you want to add other functions to this module, it would be better to divide it into multiple methods, considering later maintenance.


distinguish which function is based on this parameter , and then use a large switch in the background to distinguish different business logic code?
according to the literal description of the function, "Asset query, my Asset" is a query, "Asset acquisition, Asset return" seems to require post,. If that's the case, isn't it a bit too much to write in a method?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9a851-475c3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9a851-475c3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?