作者:那时候的我和你_173 | 来源:互联网 | 2023-05-17 21:08
Nearlyeveryprojecthavesearchpanelandcustomfiltersinmycompany.Itishardtocreatewhenp
Nearly every project have search panel and custom filters in my company. It is hard to create when project has too much filter.
我公司几乎每个项目都有搜索面板和自定义过滤器。当项目有太多的过滤器时,很难创建。
Is there any good design pattern for creating custom sql queries for using with filters?
是否有好的设计模式来创建自定义sql查询,以便与过滤器一起使用?
I always write something like this:
我总是这样写:
commandText = "SELECT * FROM XXX "
innerJoinCommand = ""
whereCommand = ""
if (??.length > 0)
whereCommand += "AND ??? "
if (??.Count > 0)
innerJoinCommand += "??? "
//...
if (innerJoinCommand.length > 0)
commandText += innerJoinCommand
if (whereCommand.length > 0)
commandText += "WHERE " + whereCommand
3 个解决方案