In many projects, especially information systems, query functions account for a large part of the project, and the combination of query conditions is rich, so it becomes complex to achieve. In general, we will only implement a limited condition query, such as a table of some important fields or even all of the fields; Of course, in the case of a regular customer is sufficient, but some advanced applications such as ((field 1>10) or (field 2=5)) and field 3 is not null) This complex combination of conditions is not necessarily appropriate, usually if it is fixed several combinations of patterns, so we can also be in the background in the language (Java, C #, etc.) to achieve, if the combination of conditions is dynamic, then the implementation is quite troublesome.
So in order to achieve dynamic conditional combination, summed up some previous project experience, wrote an advanced combination query control prototype, as follows:
Of course, the generated conditions are not all the database can pass, such as Oracle, their date query requirements with to_date () conversion, but as long as the extension can be achieved, hehe;
SOURCE download