Detailed Description
The principles and features of the present invention are described below with reference to the drawings, the illustrated embodiments are provided for illustration only and are not intended to limit the scope of the present invention.
As shown in fig. 1, a flow chart provided for an embodiment of a method for implementing configuration of data query according to the present invention includes:
s1, determining query functions, configuring query conditions of each query function in a database, and generating associated conditional query services.
It should be understood that, for different application service fields, the query functions are different, for example, taking a telecom service field as an example, the query functions may include a call charge payment record query, a call record query, a package change condition query, and the like, taking a call charge payment record query as an example, the query conditions may be multiple, and taking a payment time and a payment amount as query conditions, which are specifically described below.
It should be understood that the two records should be configured in the database in advance, and the payment time query condition is configured as follows, wherein the query condition codes can be BEGIN_DATE and END_DATE, namely the start DATE and the END DATE of the payment time, the name of the query condition is the payment DATE, and the input box is a DATE control. After the user selects the DATE through the DATE control, the selected start DATE and END DATE are respectively assigned to the BEGIN_DATE and the END_DATE, and the two values are transmitted to the background SQL sentence through the service.
When the payment amount is queried similarly, the payment amount query conditions are configured as follows: the configuration query condition codes can be BEGIN_AMOUT and END_AMOUNT, the query condition name is payment AMOUNT, but the input box type is a text box, and when the user inputs BEGIN_AMOUT and END_AMOUNT, SQL sentences with the two values in the background can be used, so that the configuration of the query condition is realized.
S2, acquiring target query conditions selected by a user through a conditional query service.
It should be understood that the condition query service only needs to input one input parameter, namely one interface code agreed by the front end and the back end, and in order to reduce the interaction frequency of the front end and the back end and improve the system performance, the service can return the following query information:
1) Query condition codes and Chinese meanings. What the user sees on the interface is a chinese meaning, while the final foreground code is to invoke the conditional query service using the condition code as a service entry.
2) The input control type of the query condition. For example, it may be a text box, a drop down list, a multiple choice box, a date control, or a tab definition options list (datalist).
3) Width information of the text box is input. For the query condition that the user needs to input text, the input box is wider, and the input box is narrower when inputting numerical values.
4) The input data type of the text box is entered. For example, it may be text or numerical. For the case that a numerical value needs to be input, the foreground can prompt according to the information.
5) Date control type. For example, the year, month, day, month, or just the year of choice may be selected, and this information needs to be returned together.
6) Whether the input control is an interval or not. For example, querying for data for a period of time, the foreground may present two date entry boxes based on the information colleague.
7) The type of conditional value. Support enumeration values, execute SQL, and background call service values.
8) The enumeration value of the conditional access value encodes and enumerates the value meaning.
9) The foreground with dependent condition value is added with parameters.
S3, reading the configuration of the target query condition from the database and loading the configuration to enable the user to query the data.
For example, assuming that the target query condition selected by the user is a payment time, according to the above example, an input box of a date control may be loaded on an interface of a terminal used by the user, such as a mobile phone, a computer, and the like, and the name of the query condition is displayed as a payment date through text.
It should be understood that, each query function generally relates to three contents of a query interface, query conditions and data query service, in this embodiment, the contents of the query conditions are realized through configuration, and are pre-stored in a database, so that codes of the query conditions of different query functions can be multiplexed, and therefore, the differentiation of the query conditions requiring different functions needs to be realized through data configuration.
Optionally, in some possible embodiments, the configuration of the query condition includes: encoding of query conditions.
It should be understood that, a person skilled in the art may select the encoding mode according to actual requirements, for example, may select a direct english translation mode, and as the above example, the encoding of the payment time inquiry condition is begin_date and end_date.
Optionally, in some possible embodiments, the configuration and loading of the target query condition is read from the database, specifically including:
analyzing the target query condition to obtain the code of the target query condition;
and reading the configuration of the target query condition from the database according to the code of the target query condition and loading the configuration.
By using the code of the target query condition as an index, the configuration of the target query condition can be quickly and accurately found from the database.
Optionally, in some possible embodiments, the configuring of the query condition further includes: the control type, the width of the input text box, the input data type of the input text box and the condition value type; the control types include: an input control and a selection control; the input controls include: a text box and a date box; the selection controls include a list, a multi-box, and a datalist.
Optionally, in some possible embodiments, as shown in fig. 2, according to the encoding of the target query condition, the configuration and loading of the target query condition are read from the database, and specifically include:
the user selects a target query condition through the mobile phone, and the mobile phone acquires control width information;
reading the configuration of the target query condition from the database according to the code of the target query condition, and judging the control type of the target query condition;
if the control type is the input control, judging whether the control is a date control, and if so, displaying the date control type; judging whether the target query condition is an interval or not, if so, displaying two corresponding input controls, otherwise, displaying only one input control;
if the control type is a selection control, judging a condition value type, and if the condition value type is an enumeration value, directly displaying; if the condition value type is SQL input or a third party service is called, judging whether front-end parameter transmission is needed, if so, calling a preset condition value service after parameter assignment, otherwise, directly calling the preset condition value service;
and determining the width of the input text box and the input data type of the input text box according to the determined control type, and displaying.
It should be appreciated that some query condition values are dynamic, such as requiring different values to be presented according to different login numbers, or that the condition values depend on a third party service. For the case of dynamic changes in conditional values, SQL or service addresses may be configured to address this problem.
It will be appreciated that in some embodiments, some or all of the above embodiments may be included.
As shown in fig. 3, a structural framework diagram provided for an embodiment of a system for implementing the configuration of data queries of the present invention includes:
a configuration unit 1, configured to determine query functions, configure query conditions of each query function in a database, and generate associated conditional query services;
an acquisition unit 2 for acquiring a target query condition selected by a user through a conditional query service;
and the loading unit 3 is used for reading the configuration of the target query condition from the database and loading the configuration of the target query condition for the user to query the data.
It should be understood that each query function generally relates to three contents of a query interface, query conditions and data query service, the content of the query condition block is realized through configuration and is stored in a database in advance, codes of different query functions in the query condition block can be multiplexed, so that the differentiation of the query conditions requiring different functions is realized through data configuration, when a user queries through the condition query service, the corresponding query conditions can be directly called from the database to load, the workload of the development function aiming at the query condition display function is greatly reduced, when the subsequent query function relates to the new or deleted query conditions, only the configuration of the database is required to be modified, the code development and the code deployment are not required, and the usability of the system is higher.
Optionally, in some possible embodiments, the configuration of the query condition includes: encoding of query conditions.
Optionally, in some possible embodiments, the loading unit 3 is specifically configured to parse the target query condition to obtain a code of the target query condition; and reading the configuration of the target query condition from the database according to the code of the target query condition and loading the configuration.
Optionally, in some possible embodiments, the configuring of the query condition further includes: the control type, the width of the input text box, the input data type of the input text box and the condition value type; the control types include: an input control and a selection control; the input controls include: a text box and a date box; the selection controls include a list, a multi-box, and a datalist.
Optionally, in some possible embodiments, the loading unit 3 is specifically configured to read the configuration of the target query condition from the database according to the code of the target query condition, and determine the control type of the target query condition; if the control type is the input control, judging whether the control is a date control, and if so, displaying the date control type; judging whether the target query condition is an interval or not, if so, displaying two corresponding input controls, otherwise, displaying only one input control; if the control type is a selection control, judging a condition value type, and if the condition value type is an enumeration value, directly displaying; if the condition value type is SQL input or a third party service is called, judging whether front-end parameter transmission is needed, if so, calling a preset condition value service after parameter assignment, otherwise, directly calling the preset condition value service; and determining the width of the input text box and the input data type of the input text box according to the determined control type, and displaying.
It will be appreciated that in some embodiments, some or all of the above embodiments may be included.
It should be noted that, each of the foregoing embodiments is a product example corresponding to the previous method example, and for the description of the product embodiment, reference may be made to the corresponding description in each of the foregoing method embodiments, which is not repeated herein.
The reader will appreciate that in the description of this specification, a description of terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the method embodiments described above are merely illustrative, e.g., the division of steps is merely a logical function division, and there may be additional divisions of actual implementation, e.g., multiple steps may be combined or integrated into another step, or some features may be omitted or not performed.
The present invention is not limited to the above embodiments, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the present invention, and these modifications and substitutions are intended to be included in the scope of the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.