Data query method and device and edge computing system
By introducing custom query pages and advanced syntax configuration groups into the edge computing system, users can flexibly configure query conditions and generate advanced query statements, solving the problem of limited existing data query methods and improving the flexibility and accuracy of data query.
Patent Information
- Application Number
- CN202510119085.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-24
- Publication Date
- 2025-05-06
AI Technical Summary
The existing data query methods are limited by query statements written in the development stage, and users cannot flexibly query data based on their own needs.
By returning to the custom query page after the advanced query component is triggered, users can select the target dataset and configure query conditions through the advanced syntax configuration group to generate advanced query statements for data query.
This enables users to flexibly configure query conditions according to their own needs and generate advanced query statements, thereby improving the flexibility and accuracy of data query.
Smart Images

Figure CN119938716A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of Internet of Things, and more specifically, to a data query method and device, and an edge computing system. Background Art
[0002] In the industrial field where Power Line Communication (PLC) technology is combined with the Internet of Things (IoT), edge computing has become an important trend because edge computing allows data close to the sensor to be analyzed and filtered, so only relevant data is sent to the cloud, reducing network bandwidth costs and cloud data storage costs.
[0003] For edge computing software systems, the existing data query method is limited to the query statements written during the development phase, that is, users can only use the query statements written in the background code to query data. If they want to modify the query statement, the developer needs to modify the background code, and it is impossible to flexibly query data according to the user's own needs. Summary of the invention
[0004] The main purpose of this application is to provide a data query method and device, and an edge computing system to solve the problem that the existing data query method is limited to the query statements written in the development stage and users cannot query data flexibly.
[0005] In order to achieve the above-mentioned purpose, according to the first aspect of the present application, a method for data query is provided. The method for data query according to the present application includes: returning a custom query page corresponding to the advanced query component after the advanced query component is triggered; monitoring the changes in the option information in the data set drop-down box in the data custom query page, and obtaining the identification information of the target data set selected by the user; adding an advanced grammar configuration group to the custom query page according to the add button in the custom query page; obtaining the target grammar type according to the advanced grammar type drop-down box in the advanced grammar configuration group; displaying the configuration items corresponding to the target grammar type in the form of a table or input box according to the target grammar type; obtaining the configuration data corresponding to the configuration items; sending the target grammar types and configuration data corresponding to all advanced grammar configuration groups to the background, so that the background generates an advanced query statement according to a preset splicing algorithm, and performs a query according to the advanced query statement to obtain the query result; receiving the query result returned by the background and displaying it.
[0006] Optionally, adding an advanced grammar configuration group in the custom query page according to an add button in the custom query page also includes: the add button is triggered once, corresponding to adding an advanced grammar configuration item group downward in the custom query page, and all advanced grammar configuration item groups are constructed as ordered sets.
[0007] Optionally, before displaying the configuration items corresponding to the target grammar type in the form of a table or input box according to the target grammar type, the method further includes: obtaining database table information from the background according to the identification information of the target data set; and constructing the configuration items according to the database table information.
[0008] Optionally, the configuration items corresponding to the target syntax type are displayed in the form of a table or an input box according to the target syntax type, including: if the target syntax type is conditional query, at least four configuration items, namely data field, field unique identifier, operator, and comparison value, are displayed in the form of a table; if the target syntax type is return field, at least two configuration items, namely data field and field unique identifier, are displayed in the form of a table; if the target syntax type is grouping, at least two configuration items, namely field type and data field, are displayed in the form of a table; if the target syntax type is aggregation, at least two configuration items, namely data field and function type, are displayed in the form of a table; if the target syntax type is sorting, at least three configuration items, namely data field, field unique identifier, and sorting method, are displayed in the form of a table; if the target syntax type is paging, two configuration items, namely the number of pages to be queried and the number per page, are displayed in the form of an input box; if the target syntax type is the maximum number of query items, one configuration item, namely the maximum number of items to be queried, is displayed in the form of an input box.
[0009] Optionally, after the advanced query component is triggered, the method also includes: starting an initialization event; determining an application scenario of the advanced query component through the upper menu of the advanced query component, the application scenario including at least data set management, device management, and alarm management; generating a query request according to the application scenario of the advanced query component; sending the query request to the background, so that the background initializes the data table contained in the application scenario corresponding to the advanced query component according to the query request.
[0010] In order to achieve the above-mentioned purpose, according to the second aspect of the present application, another method for data query is provided. The method for data query according to the present application includes: receiving the target grammar type and configuration data corresponding to all advanced grammar configuration groups sent by the web front end, wherein the advanced grammar configuration group is added to the custom query page corresponding to the advanced query component of the web front end after the add button is triggered; traversing all the configuration data in each advanced grammar configuration group, and splicing them with the corresponding target grammar type to obtain the query statement group corresponding to each target grammar type; traversing the target grammar types of all advanced grammar configuration groups, splicing each query statement group corresponding to each target grammar type to obtain the advanced query statement; querying the target data set according to the advanced query statement to obtain the query result; and returning the query result to the web front end.
[0011] In order to achieve the above-mentioned purpose, according to the third aspect of the present application, a data query device is provided. The data query device according to the present application includes: the device includes: a return module, which is used to return a custom query page corresponding to the advanced query component after the advanced query component is triggered; a monitoring module, which is used to monitor the changes in the option information in the data set drop-down box in the data custom query page, and obtain the identification information of the target data set selected by the user; an adding module, which is used to add an advanced grammar configuration group in the custom query page according to the add button in the custom query page; a first acquisition module, which is used to obtain the target grammar type according to the advanced grammar type drop-down box in the advanced grammar configuration group; a display module, which is used to display the configuration items corresponding to the target grammar type in the form of a table or input box according to the target grammar type; a second acquisition module, which is used to obtain the configuration data corresponding to the configuration items; a sending module, which is used to send the target grammar types and configuration data corresponding to all advanced grammar configuration groups to the background, so that the background generates an advanced query statement according to a preset splicing algorithm, and queries according to the advanced query statement to obtain the query result; a receiving module, which is used to receive and display the query result returned by the background.
[0012] Optionally, the adding module is further used for: when the adding button is triggered once, one advanced grammar configuration item group is added downward in the custom query page, and all the advanced grammar configuration item groups are constructed as ordered sets.
[0013] Optionally, the device also includes a construction module, which is used to obtain database table information from the background according to the identification information of the target data set before displaying the configuration items corresponding to the target grammar type in the form of a table or input box according to the target grammar type; and construct the configuration items according to the database table information.
[0014] Optionally, the display module is used for: if the target syntax type is conditional query, then at least four configuration items, namely data field, field unique identifier, operator, and comparison value, are displayed in the form of a table; if the target syntax type is return field, then at least two configuration items, namely data field and field unique identifier, are displayed in the form of a table; if the target syntax type is grouping, then at least two configuration items, namely field type and data field, are displayed in the form of a table; if the target syntax type is aggregation, then at least two configuration items, namely data field and function type, are displayed in the form of a table; if the target syntax type is sorting, then at least three configuration items, namely data field, field unique identifier, and sorting method, are displayed in the form of a table; if the target syntax type is paging, then two configuration items, namely the number of pages to be queried and the number per page, are displayed in the form of an input box; if the target syntax type is the maximum number of query items, then one configuration item, namely the maximum number of items to be queried, is displayed in the form of an input box.
[0015] Optionally, the device also includes: an initialization module, used to start an initialization event after the advanced query component is triggered; determine the application scenario of the advanced query component through the upper menu of the advanced query component, and the application scenario includes at least data set management, equipment management, and alarm management; generate a query request according to the application scenario of the advanced query component; send the query request to the background, so that the background initializes the data table contained in the application scenario corresponding to the advanced query component according to the query request.
[0016] In order to achieve the above-mentioned purpose, according to the fourth aspect of the present application, another data query device is provided, which includes: a receiving module, which is used to receive the target grammar type and configuration data corresponding to all advanced grammar configuration groups sent by the web front end, and the advanced grammar configuration group is added to the custom query page corresponding to the advanced query component of the web front end after the add button in the custom query page is triggered; a first splicing module, which is used to traverse all the configuration data in each advanced grammar configuration group, and splice them with the corresponding target grammar type to obtain the query statement group corresponding to each target grammar type; a second splicing module, which is used to traverse the target grammar types of all advanced grammar configuration groups, and splice each query statement group corresponding to each target grammar type to obtain the advanced query statement; a query module, which is used to query the target data set according to the advanced query statement to obtain the query result; and a return module, which is used to return the query result to the web front end.
[0017] In order to achieve the above-mentioned purpose, according to the fifth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the data query method described in any one of the first aspect or the data query method described in the second aspect.
[0018] In order to achieve the above-mentioned purpose, according to the sixth aspect of the present application, an edge computing system is provided, the system comprising: an edge computing front end and an edge computing back end, the edge computing front end is used to execute the data query method described in any one of the aforementioned first aspects; the edge computing back end is used to execute the data query method described in the aforementioned second aspect.
[0019] In the method and device for data query in the embodiment of the present application, the database advanced query statement is encapsulated into a customized advanced query component, which is used by users on the web front end. Specifically, through the advanced syntax configuration group in the customized query page, users can configure the target data set, target syntax type and configuration items corresponding to the target type according to their needs, and then automatically generate advanced query statements for data query, which is very simple and convenient. Compared with the data query method in the prior art, it is not limited to the query statements that have been edited in the background, and is more flexible. Applying the data query method in the embodiment of the present application to the edge computing system allows users to directly design an advanced query statement through configuration items in the system software according to their needs to query the data they want, making the control of the Internet of Things part in the field of industrial automation combining PLC and IOT more humane, and making the query of data more accurate and controllable. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings constituting a part of this application are used to provide a further understanding of this application, so that other features, purposes and advantages of this application become more obvious. The schematic embodiment drawings and their descriptions of this application are used to explain this application and do not constitute an improper limitation on this application. In the drawings:
[0021] Figure 1 is a flow chart of a method for data query provided according to an embodiment of the present application;
[0022] Figure 2-3 is a schematic diagram of two customized query pages provided according to an embodiment of the present application;
[0023] Figure 4 is a flow chart of another method for data query provided according to an embodiment of the present application;
[0024] Figure 5 It is a block diagram of a data query device provided according to an embodiment of the present application;
[0025] Figure 6 It is a block diagram of another data query device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0029] According to an embodiment of the present application, a method for data query is provided, such as Figure 1 As shown, the execution subject of the method is a web front end, and specifically the method includes the following steps S101-S108: S101. After the advanced query component is triggered, the custom query page corresponding to the advanced query component is returned; S102. The option information changes in the data set drop-down box in the data custom query page are monitored, and the identification information of the target data set selected by the user is obtained; S103. An advanced grammar configuration group is added to the custom query page according to the add button in the custom query page; S104. The target grammar type is obtained according to the advanced grammar type drop-down box in the advanced grammar configuration group; S105. The configuration items corresponding to the target grammar type are displayed in the form of a table or input box according to the target grammar type; S106. The configuration data corresponding to the configuration items are obtained; S107. The target grammar types and configuration data corresponding to all advanced grammar configuration groups are sent to the background, so that the background generates an advanced query statement according to a preset splicing algorithm, and queries according to the advanced query statement to obtain the query result; S108. The query result returned by the background is received and displayed.
[0030] In step S101, the advanced query component is triggered by the user through the action of clicking on the advanced query component in the web front end to open or enable it. After the advanced query component is triggered, the web front end will generate a custom query page corresponding to the advanced query component and display it to the user. Figure 2 The figure shows a schematic diagram of the custom query page, which includes three major areas. The first area is the basic configuration area, which is used to display or configure the basic information of the advanced query component, including the name, whether it is enabled, etc.; the second area is the data set selection area, through the data set drop-down box, the user can select the target data set; and the third area is the data query configuration area.
[0031] In step S102, the web front end monitors the option information in the dataset drop-down box through the watch monitoring event. The dataset drop-down box includes the identification information of all database tables included in the application scenario to which the triggered advanced query component belongs. When the option information in the dataset drop-down box is monitored to change, the identification information selected by the user in the current drop-down box is determined as the identification information of the target dataset. In addition, the web front end is also triggered to obtain the database table information of the target dataset from the back end, including data fields, data types, etc., for constructing the configuration items in the advanced syntax configuration group in the subsequent steps, specifically the drop-down box options that constitute the configuration items.
[0032] In step S103, "adding an advanced grammar configuration group to the custom query page according to the add button in the custom query page" means adding an advanced grammar configuration group to the custom query page returned in step S101 by using the add button. Figure 2 The "Add Configuration Group" in the above is the "Add Button" in this step. When the user triggers (clicks or performs other operations) the Add button, the web front end will add an advanced syntax configuration group to the custom query page. The specific adding rule is: when the Add button is triggered once, an advanced syntax configuration item group will be added to the custom query page. All advanced syntax configuration item groups are constructed as ordered sets (list sets). Each advanced syntax configuration group contains an advanced syntax type drop-down box, an input box or selection box corresponding to the configuration item, etc. It should be noted that Figure 2 This is an exemplary diagram, and there is no limitation on the specific name of the "add button" in actual applications.
[0033] In addition, each advanced syntax configuration group can be deleted, but when saving, make sure there is at least one advanced syntax configuration group, otherwise data query will not be possible.
[0034] In step S104, "obtaining the target grammar type according to the advanced grammar type drop-down box in the advanced grammar configuration group" includes: after the advanced grammar type drop-down box is triggered, all advanced grammar types are displayed; when a certain advanced grammar type is selected, the selected advanced grammar type is added to the advanced grammar type drop-down box and used as the target grammar type. The advanced grammar type is selected first because different advanced grammar types correspond to different configuration items, and the web front end needs to display different configuration items to the user according to the selected advanced grammar type.
[0035] For step S105, in the embodiment of the present application, the advanced syntax type includes at least one of conditional query, return field, grouping, aggregation, sorting, paging, and maximum number of query items. For conditional query, return field, grouping, aggregation, and sorting, the corresponding configuration items are displayed in the form of a table; for paging and maximum number of query items, the corresponding configuration items are displayed in the form of an input box.
[0036] Furthermore, if the target syntax type is a conditional query (conditional query refers to the filter condition set for querying data), at least four configuration items, namely, data field, field unique identifier, operator, and comparison value, are displayed in a table. One row is displayed by default, and rows can also be added or deleted as needed. The data field corresponds to the alias of the field in the target data set. The data field is displayed in the form of a drop-down box for the user to select the alias of the field in the target data set. The alias of the field available for selection in the data field drop-down box is obtained when the web front end obtains the database table information of the target data set from the back end in the aforementioned step S102. The field unique identifier corresponds to the field name in the target data set, and the field name and the field alias are corresponding. Therefore, after selecting the field alias, the user does not need to select the field name again, but the web front end automatically fills in the corresponding field name based on the database table information of the target data set obtained. Operators are displayed in the form of drop-down boxes for users to select operators corresponding to different fields. Operators are standards used for data comparison, including equal to, not equal to, less than, less than or equal to, greater than, greater than or equal to, between, contain, belong to, regular expression, is empty, not empty, starts with, ends with, etc. The comparison value is the reference value corresponding to the comparison standard. Users can enter the comparison value into the corresponding comparison value input box. Figure 3 The figure shows a schematic diagram of the corresponding custom query page after adding three advanced syntax configuration groups. The target syntax type corresponding to the first advanced syntax configuration group is conditional query ($match), and the corresponding configuration items include data fields, field unique identifiers, operators, and comparison values. In addition, the corresponding "Delete" under the operation item is used to delete each row of configuration data after being triggered, and "Add Row" is used to add a row of data after being triggered; the "Delete" on the right side of "Add Row" is used to delete the advanced syntax configuration group.
[0037] If the target syntax type is return field, at least two configuration items, data field and field unique identifier, will be displayed in a table format. One row will be displayed by default, and rows can be added or deleted. Return field refers to the field that is retained for each data item when it is finally returned from the data table (target data set). If the configuration items are not configured, all fields will be returned by default. Among them, the two configuration items, data field and field unique identifier, have the same meaning as the data field and field unique identifier in the aforementioned conditional query. For example, Figure 3 The target syntax type corresponding to the second advanced syntax configuration group shown in the figure is the return field ($project), and the corresponding configuration items include data field and field unique identifier. In addition, the corresponding "Delete" under the operation item is used to delete a row, and "Add Row" is used to add a row. The "Delete" on the right side of "Add Row" is used to delete the advanced syntax configuration group.
[0038] If the target syntax type is grouping, at least two configuration items, field type and data field, will be displayed in a table format. One row will be displayed by default, and rows can be added or deleted. Grouping refers to grouping the fields in the target data set for the query. The data field also corresponds to the field alias. The field types include grouping fields and statistical fields. The grouping field is grouped by field, and the statistical field is used to count the amount of data in the field. When configuring, users need to select the field type first, and then select the field alias through the data field.
[0039] If the target syntax type is aggregation, at least two configuration items, data field and function type, will be displayed in a table. One row is displayed by default, and rows can be added or deleted. Aggregation refers to the aggregation function, and the function type refers to the specific type of aggregation function, including total, maximum, minimum, sum, average, etc. The data field also corresponds to the field alias. When configuring, first select the field alias through the data field drop-down box, and then select the function type through the function type drop-down box.
[0040] If the target syntax type is sorting, at least three configuration items, data field, field unique identifier, and sorting method, are displayed in the form of a table. One row is displayed by default, and rows can also be added or deleted. Sorting refers to sorting the result data obtained after the query. The sorting methods include positive order and reverse order, which are displayed in the form of a switch. The default is closed, that is, positive order. The data field also corresponds to the field alias, and the field unique identifier also corresponds to the field name. When configuring, the user first selects the field alias, and then selects the sorting method.
[0041] If the target syntax type is pagination, two configuration items, the number of pages to be queried and the number of pages per page, are displayed in the form of an input box. Pagination refers to pagination query, and users can enter the number of pages to be queried and the number of pages per page through the input box.
[0042] If the target syntax type is the maximum number of queries, a configuration item for the maximum number of queries is displayed in the form of an input box. The maximum number of queries is used to control the amount of query data. The maximum number of queries can be entered through the input box. If the user does not configure it, a default number can be set, such as one thousand. Figure 3 The target syntax type corresponding to the third advanced syntax configuration group shown in is the maximum number of queries ($limit), which includes a configuration item of the maximum number of queries. In addition, the "delete" is used to delete the advanced syntax configuration group.
[0043] Figure 3 Only three high-level grammar configuration groups are shown as examples. For other high-level grammar configuration groups, reference may be made to the display of the high-level grammar configuration groups already shown, and no further description will be given.
[0044] In step S106, obtaining configuration data corresponding to the configuration items means that after the user enters or selects configuration data in the input box or selection box corresponding to the configuration item in each advanced grammar configuration group in step S105, the web front end can obtain all configuration data through the input box or selection box corresponding to these configuration items.
[0045] In step S107, after the web front end receives the confirmation indication that the custom query page configuration is completed (such as Figure 2 , 3 As shown, that is, after the user clicks "OK", the web front end sends the target grammar type and configuration data corresponding to all advanced grammar configuration groups to the back end. After receiving the data, the back end generates an advanced query statement according to the preset splicing algorithm, and performs a query based on the advanced query statement to obtain the query result.
[0046] Furthermore, the implementation principle of generating advanced query statements according to the preset splicing algorithm is as follows: traverse all configuration data in each advanced grammar configuration group, and splice them with the corresponding target grammar type to obtain the query statement group corresponding to each target grammar type; traverse the target grammar types of all advanced grammar configuration groups, and splice each query statement group corresponding to each target grammar type to obtain the advanced query statement. When implementing the code, you can use for loop statements and switch-case statements to nest each other. The following shows an example of the structure of the advanced query statement obtained by splicing:
[0047] db.getCollection("target dataset").target syntax type 1("configuration data").target syntax type 2("configuration data")...
[0048] From the example of the advanced query statement structure, we can see that we also need to add the scope of the data query, that is, the target data set.
[0049] In step S108, when the backend obtains the query result according to the advanced query statement, the query result will be returned to the web frontend, so the web frontend can receive and display the query result returned by the backend.
[0050] Regarding the aforementioned data query method, it should be emphasized that this method is to flexibly match advanced query syntax configuration items in computer system software to form advanced query statements, which is different from professional database software. The embodiment of the present application is equivalent to encapsulating database advanced query statements into customized advanced query components through the front-end framework for users to use on the web front end. Among them, the front-end framework can be a VUE front-end framework or other types of front-end frameworks.
[0051] From the above description, it can be seen that in the data query method of the embodiment of the present application, through the advanced syntax configuration group in the custom query page, the user can configure the target data set, the target syntax type and the configuration items corresponding to the target type according to their own needs, and then automatically generate advanced query statements for data query, which is very simple and convenient. The data query method of the embodiment of the present application is equivalent to encapsulating the database advanced query statement into a custom query component for user use on the web front end. Compared with the data query method in the prior art, it is not limited to the query statement that has been edited in the background, and is more flexible.
[0052] Furthermore, after the advanced query component is triggered, the method also includes: starting an initialization event; determining the application scenario of the advanced query component through the upper menu of the advanced query component, the application scenario at least including data set management, device management, and alarm management; generating a query request according to the application scenario of the advanced query component; sending the query request to the background, so that the background initializes the data table contained in the application scenario corresponding to the advanced query component according to the query request. Before querying the data, it is usually necessary to initialize the data table. In the embodiment of the present application, the advanced query component can be added in different upper menus, that is, applied in different application scenarios. The data tables contained in different application scenarios are usually different. Therefore, it is necessary to initialize the data table under the application scenario according to the application scenario, so as to further improve the efficiency of data query.
[0053] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0054] According to the embodiment of the present application, a method for data query is also provided. The execution subject of the method is a backend, which is a data server that provides data support for the web front end in the aforementioned method embodiment. Figure 4As shown, the method includes the following steps S201-S205: S201. Receive the target grammar types and configuration data corresponding to all advanced grammar configuration groups sent by the web front end; the advanced grammar configuration group is added to the custom query page corresponding to the advanced query component of the web front end after the add button is triggered; S202. Traverse all the configuration data in each advanced grammar configuration group, and splice them with the corresponding target grammar type to obtain the query statement group corresponding to each target grammar type; S203. Traverse the target grammar types of all advanced grammar configuration groups, and splice each query statement group corresponding to each target grammar type to obtain an advanced query statement; S204. Query the target data set according to the advanced query statement to obtain the query result; S205. Return the query result to the web front end.
[0055] Furthermore, before step S201, it also includes receiving a query request generated according to the application scenario of the advanced query component and sent by the web front end; and then initializing the data table included in the application scenario corresponding to the advanced query component according to the query request. It also includes: obtaining the database table information of the target data set according to the identification information of the target data set obtained by the web front end, and returning the database table information to the web front end so that it constructs the configuration item.
[0056] The implementation of the specific steps in the data query method in the embodiment of the present application and the method steps involved in the web front end can refer to the relevant description in the aforementioned method embodiment, and will not be repeated here.
[0057] According to an embodiment of the present application, there is also provided a method for implementing the above Figure 1 The data query device 300 of the method, as Figure 5As shown, the device includes: the device includes: a return module 301, which is used to return the custom query page corresponding to the advanced query component after the advanced query component is triggered; a monitoring module 302, which is used to monitor the changes in the option information in the data set drop-down box in the data custom query page, and obtain the identification information of the target data set selected by the user; an adding module 303, which is used to add an advanced grammar configuration group in the custom query page according to the add button in the custom query page; a first acquisition module 304, which is used to obtain the target grammar type according to the advanced grammar type drop-down box in the advanced grammar configuration group; a display module 305, which is used to display the configuration items corresponding to the target grammar type in the form of a table or input box according to the target grammar type; a second acquisition module 306, which is used to obtain the configuration data corresponding to the configuration item; a sending module 307, which is used to send the target grammar types and configuration data corresponding to all advanced grammar configuration groups to the background, so that the background generates an advanced query statement according to a preset splicing algorithm, and queries according to the advanced query statement to obtain the query result; a receiving module 308, which is used to receive and display the query result returned by the background.
[0058] Specifically, the specific process of each unit and module in the device of the embodiment of the present application to realize its function can be found in the relevant description in the method embodiment, which will not be repeated here.
[0059] From the above description, it can be seen that in the data query device of the embodiment of the present application, through the advanced syntax configuration group in the custom query page, the user can configure the target data set, the target syntax type and the configuration items corresponding to the target type according to their own needs, and then automatically generate advanced query statements for data query, which is very simple and convenient. The data query device of the embodiment of the present application is equivalent to encapsulating the database advanced query statement into a custom query component for user use on the web front end. Compared with the data query method in the prior art, it is not limited to the query statement that has been edited in the background, and is more flexible.
[0060] Furthermore, the adding module 303 is also used for: when the add button is triggered once, a corresponding advanced grammar configuration item group is added downward in the custom query page, and all advanced grammar configuration item groups are constructed as ordered sets.
[0061] Further, such as Figure 6 As shown, the device also includes a construction module 308, which is used to obtain database table information from the background according to the identification information of the target data set before displaying the configuration items corresponding to the target grammar type in the form of a table or input box according to the target grammar type; and construct the configuration items according to the database table information.
[0062] Furthermore, the display module 305 is used for: if the target syntax type is conditional query, then at least four configuration items, namely data field, field unique identifier, operator, and comparison value, are displayed in the form of a table; if the target syntax type is return field, then at least two configuration items, namely data field and field unique identifier, are displayed in the form of a table; if the target syntax type is grouping, then at least two configuration items, namely field type and data field, are displayed in the form of a table; if the target syntax type is aggregation, then at least two configuration items, namely data field and function type, are displayed in the form of a table; if the target syntax type is sorting, then at least three configuration items, namely data field, field unique identifier, and sorting method, are displayed in the form of a table; if the target syntax type is paging, then two configuration items, namely the number of pages to be queried and the number of items per page, are displayed in the form of an input box; if the target syntax type is the maximum number of query items, then one configuration item, namely the maximum number of items to be queried, is displayed in the form of an input box.
[0063] Further, such as Figure 6 As shown, the device also includes: an initialization module 310, which is used to start an initialization event after the advanced query component is triggered; determine the application scenario of the advanced query component through the upper menu of the advanced query component, and the application scenario includes at least data set management, equipment management, and alarm management; generate a query request according to the application scenario of the advanced query component; send the query request to the background, so that the background initializes the data table contained in the application scenario corresponding to the advanced query component according to the query request.
[0064] Specifically, the specific process of each unit and module in the device of the embodiment of the present application to realize its function can be found in the relevant description in the method embodiment, which will not be repeated here.
[0065] According to an embodiment of the present application, a computer-readable storage medium is further provided, characterized in that the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the data query method in the above method embodiment.
[0066] According to an embodiment of the present application, an edge computing system is also provided, the system comprising: an edge computing front end, an edge computing back end, and an edge computing front end for performing the aforementioned Figure 1 The data query method in the embodiment, that is, the edge front end is the web front end in the aforementioned embodiment; the edge computing backend is used to execute the aforementioned Figure 4 The data query method in the embodiment, that is, the edge computing background is the background in the aforementioned embodiment.
[0067] Specifically, the specific process of each end in the device of the embodiment of the present application realizing its function can be referred to the relevant description in the method embodiment, which will not be repeated here.
[0068] According to the above description, it can be seen that applying the data query method in the embodiment of the present application to the edge computing system allows users to directly design an advanced query statement through configuration items in the system software according to their own needs to query the data they want, making the control of the Internet of Things part in the industrial automation field combining PLC and IOT more user-friendly and the query of data more accurate and controllable.
[0069] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts not described in detail in one embodiment, please refer to the relevant description of other embodiments.
[0070] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the present application is not limited to any specific combination of hardware and software.
[0071] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A data query method, characterized in that: The method comprises: After the advanced query component is triggered, a custom query page corresponding to the advanced query component is returned; Monitor changes in option information in the data set drop-down box in the data custom query page, and obtain identification information of the target data set selected by the user; Adding an advanced syntax configuration group in the custom query page according to an add button in the custom query page; Obtaining a target grammar type according to an advanced grammar type drop-down box in the advanced grammar configuration group; Displaying configuration items corresponding to the target grammar type in the form of a table or an input box according to the target grammar type; Obtaining configuration data corresponding to the configuration item; Sending the target grammar types and configuration data corresponding to all advanced grammar configuration groups to the backend, so that the backend generates advanced query statements according to a preset concatenation algorithm, and performs a query according to the advanced query statements to obtain query results; Receive and display the query results returned by the background.
2. The data query method according to claim 1, characterized in that: The adding of the advanced grammar configuration group in the custom query page according to the add button in the custom query page also includes: The add button is triggered once, corresponding to adding one advanced grammar configuration item group downward in the custom query page, and all advanced grammar configuration item groups are constructed as ordered sets.
3. The data query method according to claim 1, characterized in that: Before displaying the configuration items corresponding to the target grammar type in the form of a table or an input box according to the target grammar type, the method further includes: Obtaining database table information from the backend according to the identification information of the target data set; The configuration item is constructed according to the database table information.
4. The data query method according to claim 3, characterized in that: The configuration items corresponding to the target grammar type are displayed in the form of a table or an input box according to the target grammar type, including: If the target syntax type is a conditional query, at least four configuration items, namely, data field, field unique identifier, operator, and comparison value, are displayed in a table format; If the target syntax type is a return field, at least two configuration items, data field and field unique identifier, are displayed in a table format; If the target syntax type is grouping, at least two configuration items, field type and data field, are displayed in a table format; If the target syntax type is aggregation, at least two configuration items, data field and function type, are displayed in a table format; If the target syntax type is sorting, at least three configuration items, namely, data field, field unique identifier, and sorting method, are displayed in a table format; If the target syntax type is paging, two configuration items, the number of pages to be queried and the number of pages per page, are displayed in the form of an input box; If the target syntax type is the maximum number of query items, a configuration item for the maximum number of items to be queried is displayed in the form of an input box.
5. The data query method according to claim 1, characterized in that: After the advanced query component is triggered, the method further includes: Start the initialization event; Determining the application scenario of the advanced query component through the upper menu of the advanced query component, the application scenario at least including data set management, device management, and alarm management; Generate a query request according to the application scenario of the advanced query component; The query request is sent to a background so that the background initializes the data table included in the application scenario corresponding to the advanced query component according to the query request.
6. A method for data query, characterized in that: The method comprises: Receive target grammar types and configuration data corresponding to all advanced grammar configuration groups sent by the web front end, wherein the advanced grammar configuration group is added to the custom query page corresponding to the advanced query component of the web front end after an add button is triggered in the custom query page; Traverse all configuration data in each advanced syntax configuration group, and concatenate them with the corresponding target syntax type to obtain a query statement group corresponding to each target syntax type; Traversing the target grammar types of all advanced grammar configuration groups, and concatenating each query statement group corresponding to each target grammar type to obtain the advanced query statement; Query the target data set according to the advanced query statement to obtain a query result; The query result is returned to the web front end.
7. A data query device, characterized in that: The device comprises: A return module, used to return a custom query page corresponding to the advanced query component after the advanced query component is triggered; A monitoring module, used to monitor changes in option information in the data set drop-down box in the data custom query page, and obtain identification information of the target data set selected by the user; An adding module, used for adding an advanced syntax configuration group in the custom query page according to an add button in the custom query page; A first acquisition module, configured to acquire a target grammar type according to an advanced grammar type drop-down box in the advanced grammar configuration group; A display module, used to display configuration items corresponding to the target grammar type in the form of a table or an input box according to the target grammar type; A second acquisition module, used to acquire configuration data corresponding to the configuration item; A sending module, used to send the target grammar types and configuration data corresponding to all advanced grammar configuration groups to the background, so that the background generates advanced query statements according to a preset splicing algorithm, and performs a query according to the advanced query statements to obtain query results; The receiving module is used to receive and display the query results returned by the background.
8. A data query device, characterized in that: The device comprises: A receiving module, used to receive target grammar types and configuration data corresponding to all advanced grammar configuration groups sent by the web front end, wherein the advanced grammar configuration group is added to the custom query page corresponding to the advanced query component of the web front end after an add button is triggered in the custom query page; A first concatenation module is used to traverse all configuration data in each high-level grammar configuration group, and concatenate them with the corresponding target grammar type to obtain a query statement group corresponding to each target grammar type; A second concatenation module is used to traverse the target grammar types of all high-level grammar configuration groups, and concatenate each query statement group corresponding to each target grammar type to obtain the high-level query statement; A query module, used to query the target data set according to the advanced query statement to obtain a query result; The return module is used to return the query result to the web front end.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the data query method described in any one of claims 1 to 5 or the data query method described in claim 6.
10. An edge computing system, characterized in that: The system includes: an edge computing front end, an edge computing back end, The edge computing front end is used to execute the data query method described in any one of claims 1 to 5; The edge computing backend is used to execute the data query method described in claim 6 above.