CN115599818B - Data query method and device, electronic equipment and storage medium - Google Patents

Data query method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115599818B
CN115599818B CN202211286642.3A CN202211286642A CN115599818B CN 115599818 B CN115599818 B CN 115599818B CN 202211286642 A CN202211286642 A CN 202211286642A CN 115599818 B CN115599818 B CN 115599818B
Authority
CN
China
Prior art keywords
field
query
data
data table
queried
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202211286642.3A
Other languages
Chinese (zh)
Other versions
CN115599818A (en
Inventor
于建华
郭燕萍
杨晓龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongdian Jinxin Software Co Ltd
Original Assignee
Zhongdian Jinxin Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongdian Jinxin Software Co Ltd filed Critical Zhongdian Jinxin Software Co Ltd
Priority to CN202211286642.3A priority Critical patent/CN115599818B/en
Publication of CN115599818A publication Critical patent/CN115599818A/en
Application granted granted Critical
Publication of CN115599818B publication Critical patent/CN115599818B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/248Presentation of query results
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application provides a data query method, a data query device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a plurality of data tables from different channels, and setting a plurality of field attributes of each field in each data table; receiving a first data query request, and determining a data table to be queried indicated by the first data query request; generating a field basic attribute information list of the data table to be queried based on a plurality of field attributes of the data table to be queried, and sending the field basic attribute information list to the client so that the client displays a query table head according to the field basic attribute information list; and receiving a second data query request for querying the fields in the field basic attribute information list, acquiring a query result matched with the query condition in the second data query request from the database, and sending the query result to the client. By adopting the data query method, the data query device, the electronic equipment and the storage medium, the problem of poor adaptability of the data query function is solved.

Description

Data query method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a data query method, a data query device, an electronic device, and a storage medium.
Background
With the rapid development of information technology, the information volume is in explosive growth, and accordingly, the data stored in the database is exponentially increased, so that the application of the data query function is more and more extensive. The data query function can enable the user to conveniently and rapidly acquire the data wanted by the user. The data query function is typically performed for multiple data tables obtained from different channels, and the field names, field types, and field numbers may be different from one data table to another.
When two different data tables are respectively and independently queried, if the same query statement is used for data query, the query result can be normally obtained for one data table, but the query result can not be obtained for the other data table, even the condition of query error occurs, and the problem of poor adaptability of the data query function is caused.
Disclosure of Invention
In view of the above, the present application aims to provide a data query method, a data query device, an electronic device, and a storage medium, so as to solve the problem of poor adaptability of a data query function.
In a first aspect, an embodiment of the present application provides a data query method, including:
acquiring a plurality of data tables from different channels, and setting a plurality of field attributes of each field in each data table;
receiving a first data query request, and determining a data table to be queried indicated by the first data query request;
generating a field basic attribute information list of the data table to be queried based on a plurality of field attributes of the data table to be queried, and sending the field basic attribute information list to the client so that the client displays a query table head according to the field basic attribute information list;
and receiving a second data query request for querying the fields in the field basic attribute information list, acquiring a query result matched with the query condition in the second data query request from the database, and sending the query result to the client so as to display the query result under the query table head of the client.
Optionally, after setting a plurality of field attributes of each field in each data table, the method further includes: combining a plurality of field attributes together to obtain a field attribute group of the field; the table identification of the data table is used as a primary key, and is used as field mapping information of the data table together with field attribute groups of a plurality of fields.
Optionally, generating the field base attribute list of the data table to be queried based on the plurality of field attributes of the data table to be queried includes: acquiring the field basic attribute of each field in the data table to be queried from the field mapping information of the data table to be queried; splicing the plurality of field basic attributes according to a preset format to obtain single-field basic attribute information; and combining a plurality of single-field basic attribute information in the data table to be queried to obtain a field basic attribute information list.
Optionally, the query condition includes a plurality; obtaining a query result matched with the query condition in the second data query request from the database and sending the query result to the client, wherein the query result comprises the following steps: determining whether the query mode of the second data query request is a complex combined query mode; if the query mode is a complex combined query mode, acquiring an enhanced conditional expression from the second data query request; analyzing the enhanced condition expression to determine a plurality of query conditions and a logic relationship among the plurality of query conditions; for each query condition, determining a single query result of the query condition; and processing the plurality of single query results according to the enhanced conditional expression to obtain a combined query result, and sending the combined query result to the client.
Optionally, after the field base attribute information list is sent to the client, the method further includes: receiving a filter creation instruction aiming at a data table to be queried, wherein the filter creation instruction comprises a filter name and a plurality of query conditions; sequentially combining a plurality of query conditions to form a filter condition list; the filter is composed of a filter name, a list of filter conditions, and an enhanced conditional expression, and is saved in a database.
Optionally, determining the single query result for the query condition includes: acquiring the field English name of the query condition and the query rule; determining a field to be queried in a data table to be queried according to the English name of the field; and taking the data meeting the query rule in the field to be queried as a single query result of the query condition.
Optionally, the field basic attribute is used for displaying a field chinese name on the client and performing field type verification on query content input by the user, and the field basic attribute includes: field english name, field chinese name, and field type.
In a second aspect, an embodiment of the present application further provides a data query apparatus, where the apparatus includes:
a field attribute setting module, configured to obtain a plurality of data tables from different channels, and set a plurality of field attributes of each field in each data table;
the data table determining module is used for receiving the first data query request and determining a data table to be queried indicated by the first data query request;
the information list acquisition module is used for generating a field basic attribute information list of the data table to be queried based on a plurality of field attributes of the data table to be queried, and sending the field basic attribute information list to the client so that the client displays the query table head according to the field basic attribute information list;
and the data query module is used for receiving a second data query request for querying the fields in the field basic attribute information list, acquiring a query result matched with the query condition in the second data query request from the database and sending the query result to the client so as to display the query result under the query table head of the client.
In a third aspect, an embodiment of the present application further provides an electronic device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory in communication via the bus when the electronic device is running, the machine-readable instructions when executed by the processor performing the steps of the data querying method as described above.
In a fourth aspect, embodiments of the present application also provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the data querying method as described above.
The embodiment of the application has the following beneficial effects:
according to the data query method, the device, the electronic equipment and the storage medium, the field attributes of each field of the data table can be set for different data tables so as to meet the query requirements of different data tables, meanwhile, the field basic attribute information list of the data table to be queried is sent to the client, the table header of the data table to be queried is displayed at the client to prompt a user to query the field content, the query result is determined according to specific query conditions, and the query result is displayed under the corresponding table header, so that the target fields of different data tables can be queried by setting the same field attributes for the target fields of different data tables under the condition that the field contents are the same but the field names are different, and the normal query result can be obtained when the data query is performed on different data tables.
In order to make the above objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 shows a flow chart of a data query method provided by an embodiment of the present application;
fig. 2 is a schematic structural diagram of a data query device according to an embodiment of the present application;
fig. 3 shows a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. The components of the embodiments of the present application generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the application, as presented in the figures, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. Based on the embodiments of the present application, every other embodiment obtained by a person skilled in the art without making any inventive effort falls within the scope of protection of the present application.
It is worth noting that, before the present application proposes, with the rapid development of information technology, the information volume presents explosive growth, and accordingly, the data stored in the database also grows exponentially, which makes the application of the data query function more and more widespread. The data query function can enable the user to conveniently and rapidly acquire the data wanted by the user. The data query function is typically performed for multiple data tables obtained from different channels, and the field names, field types, and field numbers may be different among the multiple data tables. When the same query statement is used for different data tables, query results can be normally obtained for some data tables, but query results can not be obtained for other data tables, even query errors occur, and the problem of poor adaptability of the data query function is caused.
Based on the above, the embodiment of the application provides a data query method to improve the adaptability of the data query function.
Referring to fig. 1, fig. 1 is a flowchart of a data query method according to an embodiment of the present application. As shown in fig. 1, the data query method provided by the embodiment of the present application includes:
step S101, a plurality of data tables are acquired from different channels, and a plurality of field attributes of each field in each data table are set for that field.
In this step, the data table may refer to a table storing data.
By way of example, the data table may be a merchandise data table for storing merchandise information; the data table may be an enterprise data table for storing enterprise information; the data table may also be a user data table for storing user information, such as: information such as a user name, gender, age, mobile phone number, occupation, academic history, etc., wherein each information is stored as a field correspondingly, for example: the age field is used to store the ages of all users in the data table.
The field attribute may refer to attribute information of a field for displaying field information of a data table at a client and checking contents inputted by a user.
The field attributes include, but are not limited to: the field English name, the field Chinese name, the field type, the field length, whether filling is needed and whether the field is unique.
In the embodiment of the present application, a plurality of data tables are obtained from a web page, a network transmission or a third party organization, and the field Chinese names of the fields between different data tables are the same, but the meanings may be different, for example: the field content of the "user name" field in the data table a is the WeChat name of each user, and the field content of the "user name" field in the data table B is the real name of each user, and at this time, although the names in the fields of the data table a and the data table B are both "user names", the meanings of the two are completely different.
In addition, the field type of the "number" field in the data table a is a number, and the field type of the "number" field in the data table B is a character, and in this case, the field types of the data table a and the data table B are completely different, although the field names of the data table a and the data table B are both "number".
It is also possible that the data table is not marked with a field chinese name.
Therefore, after the data table is obtained, the server side can set corresponding field attributes for each field of each data table, so that the data table can be managed conveniently, and the set field attributes can be sent to the client side for display, so that a user can understand the specific content stored in the fields conveniently.
In an alternative embodiment, after setting a plurality of field attributes of each field in each data table, the method further includes: combining a plurality of field attributes together to obtain a field attribute group of the field; the table identification of the data table is used as a primary key, and is used as field mapping information of the data table together with field attribute groups of a plurality of fields.
Here, a field attribute group may refer to an attribute group composed of a plurality of field attributes of a single field, the field attribute group being used to characterize attribute information of the field.
The table identification may refer to a unique identification of the data table, which may be, for example, a table ID.
Specifically, assuming that the data table a has 2 fields, the 2 fields are a field a and a field b, field mapping information of the data table a may be obtained, where the field mapping information a sequentially includes: table identification, field attribute group a and field attribute group b, wherein the field attribute group a comprises a field English name a, a field Chinese name a, a field type, a field length, whether filling is needed and whether uniqueness is achieved.
Step S102, a first data query request is received, and a data table to be queried indicated by the first data query request is determined.
In this step, the first data query request may refer to a request to query a data table, where the first data query request is used to determine the data table to be queried.
The data table to be queried may refer to a data table in which the queried data is located.
In the embodiment of the application, a plurality of activity options are displayed in a query interface of a query platform client, a user can select which activity data to query through a click operation, the client sends a first data query request to a server according to the click operation, and the server receives the first data query request and determines the table identification of a data table to be queried according to a user identification and an activity identification. Here, after the server obtains the data table, the server may establish a correspondence between the data table and the user identifier and the activity identifier, so as to determine the data table to be queried according to the correspondence after receiving the first data query request. The user identification may refer to a unique identification of the user, and the user identification may be, for example, a tenant ID of a tenant registered on the query platform.
Step S103, a field basic attribute information list of the data table to be queried is generated based on a plurality of field attributes of the data table to be queried, and the field basic attribute information list is sent to the client so that the client displays the query header according to the field basic attribute information list.
In this step, the field base attribute information list may refer to a list composed of field attributes of different fields, and the field base attribute information list is used for displaying the header of the data table by the client and verifying whether the query content input by the user meets the requirements.
The lookup table header may refer to a header of a data table to be queried, and the lookup table header is used for displaying field names of fields which can be queried in the data table to be queried.
In an alternative embodiment, generating a field base attribute list of the data table to be queried based on a plurality of field attributes of the data table to be queried includes: acquiring the field basic attribute of each field in the data table to be queried from the field mapping information of the data table to be queried; splicing the plurality of field basic attributes according to a preset format to obtain single-field basic attribute information; and combining a plurality of single-field basic attribute information in the data table to be queried to obtain a field basic attribute information list.
Here, the field base attribute may refer to a specific attribute selected from field attributes, and the field base attribute is used for displaying a field chinese name on a client and performing field type verification on query contents input by a user.
The field base attributes include: field english name, field chinese name, and field type.
The single-field basic attribute information may refer to information obtained by splicing a plurality of field basic attributes of a certain field.
Assume that the data table a is a data table to be queried, wherein the data table a has 12 fields, 5 fields are queriable fields, taking the 1 st field in the 5 fields as an example, the field english name 1, the field chinese name 1 and the field type 1 can be taken as the field basic attribute 1, the field english name 1, the field chinese name 1 and the field type 1 are connected by separators to obtain single-field basic attribute information 1, and similarly, the single-field basic attribute information 2, the single-field basic attribute information 3, the single-field basic attribute information 4 and the single-field basic attribute information 5 can be respectively obtained, and the 5 single-field basic attribute information can be sequentially arranged to obtain a field basic attribute information list.
In addition, the field English name can be used as a single-field basic attribute information header, the field Chinese name and the field type are connected by a separator to be used as a single-field basic attribute information tail, and the single-field basic attribute information header and the single-field basic attribute information tail form single-field basic attribute information. The separator may be any of a plurality of divided symbols such as "-", "+", "-", "/", etc.
After receiving the field basic attribute information list, the client first analyzes and obtains a plurality of single-field basic attribute information in the field basic attribute information list, extracts field chinese names in the single-field basic attribute information, and sequentially displays the plurality of field chinese names as a query header according to the sequence of the field chinese names in the field basic attribute information list, for example, "nickname, head portrait, name, operation time, sex, and client ID". Because the first data query request sent by the user does not include specific query conditions at this time, no data exists under the query table header, i.e. no query result exists. The user knows which data can be queried through the displayed query header.
Step S104, receiving a second data query request for querying the fields in the field basic attribute information list, acquiring a query result matched with the query condition in the second data query request from the database and sending the query result to the client so as to display the query result under the query table head of the client.
In this step, the second data query request may refer to a request for acquiring data in the data table to be queried, where the second data query request is used to send a query condition to the server.
In the embodiment of the application, a user-defined query button is displayed in the client query interface, the user pops up the user-defined query interface after clicking the user-defined query button, and a plurality of query conditions can be set in the user-defined query interface, wherein each query condition comprises a query condition number, a field to be queried and a query rule, and the query rule comprises a condition rule and a threshold rule.
Each of the query conditions is described below.
Query condition number: before the field to be queried and the query rule of the current query condition are displayed, the query condition number is automatically generated and displayed by the client according to the sequence of creating the query condition.
Fields to be queried: the user selects in a pull-down menu mode, a plurality of field Chinese names of the fields available for query are displayed in the pull-down menu, and by taking the above example as an example, 6 items of field Chinese names 'nickname, head portrait, name, operation time, gender and client ID' in the head of the query table are displayed in the pull-down menu, and after the user selects one of the items, the selected item can be used as a field to be queried of the current query condition.
Condition rule: different fields to be queried correspond to different condition rules, the corresponding condition rules can be determined only after the fields to be queried are determined, and when the condition rules are a plurality of options, the plurality of condition rule options are displayed in a pull-down menu mode. Taking gender as an example, the condition rule of the field to be queried can only be equal to, taking age as an example; the condition rule of the field to be queried is equal to, greater than or equal to, less than or equal to, greater than or equal to and less than; taking "name" as an example, the condition rule of the field to be queried is including, beginning with and ending with. The condition rule is a rule set for a field to be queried, the condition rule can be used as a field attribute, the condition rule of the field is set when a plurality of field attributes are set for each field, and the condition rule is used as a field basic attribute and is combined with other field basic attributes to form single-field basic attribute information to be sent to a client; the conditional rules may also be stored separately and then read by the client.
Threshold rule: the threshold rules corresponding to different fields to be queried are different, the threshold rules can be thresholds selected by a user or can be thresholds input by the user, the threshold rules can be compared with the field types to determine whether the threshold meets the field type requirement, the fields to be queried are taken as 'gender' as an example, the condition rules are equal, and the threshold rules must be of character type, for example: either male or female, but not digital or pictorial; taking the field to be queried as 'operation time', the condition rule is equal to or more, the threshold rule is a date-time list, and a user can select one date from the date-time list as a threshold. When the threshold value input by the user is wrong, the user can be prompted that the input content does not meet the query requirement. Similarly, the threshold rule may be a rule set for a field to be queried, the threshold rule may be used as a field attribute, the threshold rule of the field is set when a plurality of field attributes are set for each field, and the threshold rule is used as a field basic attribute to be combined with other field basic attributes to form single field basic attribute information to be sent to the client, and the set threshold rule may be displayed to the user for selection in a pull-down menu or list mode at the client; the threshold rules may also be stored separately and then read by the client.
In addition, a user may create a plurality of query terms in the client query interface, and combine the plurality of query terms as a combined query term. The combined query conditions are divided into two query modes, namely a simple combined query mode and a complex combined query mode.
The simple combination query mode refers to combination of a plurality of query conditions in a logical AND mode, the complex combination query mode refers to combination of a plurality of query conditions in a mode set by an enhancement condition, and by way of example, a total of 3 query conditions of a, b and c, the enhancement condition is (a and b) or c, then a logical AND operation is performed between a query result of the query condition a and a query result of the query condition b, and then a data query is performed in a mode of performing a logical OR operation between a result of the logical AND operation and a query result of the query condition c.
It should be noted that, other field attributes such as field length may be used as a field basic attribute, and content input by the user may be determined by using single-field basic attribute information formed by the field lengths, to determine whether the content input by the user meets the query requirement.
In an alternative embodiment, the query condition includes a plurality of; obtaining a query result matched with the query condition in the second data query request from the database and sending the query result to the client, wherein the query result comprises the following steps: determining whether the query mode of the second data query request is a complex combined query mode; if the query mode is a complex combined query mode, acquiring an enhanced conditional expression from the second data query request; analyzing the enhanced condition expression to determine a plurality of query conditions and a logic relationship among the plurality of query conditions; for each query condition, determining a single query result of the query condition; and processing the plurality of single query results according to the enhanced conditional expression to obtain a combined query result, and sending the combined query result to the client.
Here, the enhanced condition may refer to a logical relationship between a plurality of query conditions input by a user, and the enhanced condition may be "(a and b) or c) by way of example.
The enhanced condition expression may refer to an expression of enhanced condition recognizable by the database, and the enhanced condition expression is (a & & b) |c, for example.
Specifically, firstly, a server analyzes a second data query request sent by a client, determines the type of a query mode, directly obtains a single query result of each query condition if the query mode is a simple combination query mode, processes a plurality of single query results in a logical AND mode to obtain a first combination query result, and sends the first combination query result to the client. The first combined query result refers to a query result obtained when the query mode is a simple combined query mode.
If the method is a complex combined query mode, the enhanced conditional expression is acquired first, the enhanced conditional expression is analyzed, and characters input by a user are converted into characters which can be identified by a database, for example: converting AND into & _, determining the number of the query conditions and the logic relation between the query conditions, obtaining single query results of each query condition, processing a plurality of single query results according to the determined logic relation to obtain a second combined query result, and sending the second combined query result to the client. The second combined query result refers to a query result obtained when the query mode is a complex combined query mode.
In an alternative embodiment, determining the single query result for the query condition includes: acquiring the field English name of the query condition and the query rule; determining a field to be queried in a data table to be queried according to the English name of the field; and taking the data meeting the query rule in the field to be queried as a single query result of the query condition.
Specifically, after receiving the field basic attribute information list, the client can acquire the field english name of each field to be queried, that is, the client can determine the field english name of each field to be queried of each query condition established by the user, and when the user clicks the query button after establishing the query condition, the client generates a second data query instruction including the field english name and then sends the second data query instruction to the server.
The server receives a second data query command, can determine a field to be queried in a data table to be queried corresponding to the query condition according to the field English name corresponding to the query condition in the second data query command, determines whether the data in the field to be queried accords with the query rule according to each data in the field to be queried, and takes all data which accord with the query rule as a single query result of the query condition.
In an alternative embodiment, determining whether the query mode of the second data query request is a complex combined query mode includes: determining whether the enhancement condition identifier in the second data query request is a preset value; and if the enhancement condition mark is a preset value, determining that the query mode of the second data query request is a complex combination query mode.
Here, the enhanced condition identification may refer to an identification that determines whether the user sets enhanced conditions.
The preset value may refer to a set numerical value, and may be 1, for example.
Specifically, a selection item of whether to set the enhancement condition is displayed in the client query interface, after the user sets a plurality of query conditions, whether to set the enhancement condition for the query conditions can be selected, if the user selects the selection item of whether to set the enhancement condition, the enhancement condition identifier is set to 1, and if the user does not select the selection item, the enhancement condition is set to 0. When the user selects to set the enhancement condition, the enhancement condition may be input in the corresponding input field, for example: a or b, then after clicking the query button, the user generates a second data query request and sends the second data query request to the server, the server judges whether the enhancement condition identifier is 1, and if the enhancement condition identifier is 1, the query mode of the second data query request is determined to be a complex combination query mode.
In an alternative embodiment, after the field base attribute information list is sent to the client, the method further includes: receiving a filter creation instruction aiming at a data table to be queried, wherein the filter creation instruction comprises a filter name and a plurality of query conditions; sequentially combining a plurality of query conditions to form a filter condition list; the filter is composed of a filter name, a list of filter conditions, and an enhanced conditional expression, and is saved in a database.
Here, the filter may refer to a plurality of or a single query condition included in the filter.
Specifically, in the user-defined query interface popped up after the user clicks the user-defined query button, the user can set not only a plurality of query conditions but also a filter name, and after the filter name, one or more query conditions and an enhancement condition are set, the filter can be generated by clicking the save button. After receiving a save instruction sent by a user, the client generates a filter creation instruction, where the filter creation instruction includes filter creation information, for example: after receiving the filter creation instruction, the server side forms the filter by the filter name, the filter condition list and the enhancement condition expression, and stores the filter in the database. Wherein, the enhancement condition is not necessary for creating the filter, the user can set the filter with the enhancement condition or not set the filter with the enhancement condition, and the number of the query conditions of the filter can be one or a plurality of.
In addition, the filter stored in the database also includes table identification of the data table to be queried to determine which data table the filter is querying for.
Compared with the data query method in the prior art, the method can set the field attribute of each field of the data table for different data tables so as to adapt to the query requirements of different data tables, simultaneously send the field basic attribute information list of the data table to be queried to the client, display the field content which can be queried by the user and is prompted by the header of the data table to be queried at the client, determine the query result according to specific query conditions, and display the query result under the corresponding header, so that the problem of poor adaptability of the data query function is solved by setting the same field attribute for the target fields of different data tables under the condition that the field content is the same but the field names are different.
Based on the same inventive concept, the embodiment of the application further provides a data query device corresponding to the data query method, and since the principle of solving the problem by the device in the embodiment of the application is similar to that of the data query method in the embodiment of the application, the implementation of the device can refer to the implementation of the method, and the repetition is omitted.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a data query device according to an embodiment of the application. As shown in fig. 2, the data query device 200 includes:
a field attribute setting module 201, configured to obtain a plurality of data tables from different channels, and set a plurality of field attributes of each field in each data table;
a data table determining module 202, configured to receive a first data query request, and determine a data table to be queried indicated by the first data query request;
the information list obtaining module 203 is configured to generate a field basic attribute information list of the data table to be queried based on a plurality of field attributes of the data table to be queried, and send the field basic attribute information list to a client, so that the client displays a query header according to the field basic attribute information list;
the data query module 204 is configured to receive a second data query request for querying a field in the field base attribute information list, obtain a query result matching with a query condition in the second data query request from a database, and send the query result to the client, so as to display the query result under a query table header of the client.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the application. As shown in fig. 3, the electronic device 300 includes a processor 310, a memory 320, and a bus 330.
The memory 320 stores machine-readable instructions executable by the processor 310, when the electronic device 300 is running, the processor 310 communicates with the memory 320 through the bus 330, and when the machine-readable instructions are executed by the processor 310, the steps of the data query method in the method embodiment shown in fig. 1 can be executed, and the specific implementation can be referred to the method embodiment and will not be described herein.
The embodiment of the present application further provides a computer readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps of the data query method in the embodiment of the method shown in fig. 1 may be executed, and a specific implementation manner may refer to the embodiment of the method and will not be described herein.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, and are not repeated herein.
In the several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer readable storage medium executable by a processor. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Finally, it should be noted that: the above examples are only specific embodiments of the present application, and are not intended to limit the scope of the present application, but it should be understood by those skilled in the art that the present application is not limited thereto, and that the present application is described in detail with reference to the foregoing examples: any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or perform equivalent substitution of some of the technical features, while remaining within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (8)

1. A method of querying data, comprising:
acquiring a plurality of data tables from different channels, and setting a plurality of field attributes of each field in each data table;
receiving a first data query request, and determining a data table to be queried indicated by the first data query request;
generating a field basic attribute information list of the data table to be queried based on a plurality of field attributes of the data table to be queried, and sending the field basic attribute information list to a client so that the client displays a query table head according to the field basic attribute information list;
receiving a second data query request for querying the fields in the field basic attribute information list, acquiring a query result matched with the query condition in the second data query request from a database and sending the query result to the client so as to display the query result under the query table head of the client;
after the setting of the plurality of field attributes of each field in each data table, the method further comprises:
combining a plurality of field attributes together to obtain a field attribute group of the field;
taking a table identifier of the data table as a primary key and taking the table identifier and a field attribute group of a plurality of fields together as field mapping information of the data table;
the generating a field basic attribute list of the data table to be queried based on a plurality of field attributes of the data table to be queried comprises the following steps:
acquiring a field basic attribute of each field in the data table to be queried from the field mapping information of the data table to be queried;
splicing the plurality of field basic attributes according to a preset format to obtain single-field basic attribute information;
and combining a plurality of single-field basic attribute information in the data table to be queried to obtain a field basic attribute information list.
2. The method of claim 1, wherein the query condition comprises a plurality of;
the step of obtaining the query result matched with the query condition in the second data query request from the database and sending the query result to the client side comprises the following steps:
determining whether the query mode of the second data query request is a complex combined query mode;
if the query mode is a complex combined query mode, acquiring an enhanced conditional expression from the second data query request;
analyzing the enhanced condition expression to determine a plurality of query conditions and a logic relationship among the plurality of query conditions;
for each query condition, determining a single query result of the query condition;
and processing the plurality of single query results according to the enhanced conditional expression to obtain a combined query result, and sending the combined query result to the client.
3. The method of claim 1, further comprising, after said sending the field base attribute information list to the client:
receiving a filter creation instruction aiming at the data table to be queried, wherein the filter creation instruction comprises a filter name and a plurality of query conditions;
sequentially combining a plurality of query conditions to form a filter condition list;
a filter is formed from the filter name, the list of filter conditions, and the enhanced conditional expression, and is stored in a database.
4. The method of claim 2, wherein said determining the single query result for the query condition comprises:
acquiring the field English name of the query condition and the query rule;
determining a field to be queried in the data table to be queried according to the field English name;
and taking the data meeting the query rule in the field to be queried as a single query result of the query condition.
5. The method of claim 1, wherein the field base attribute is used for displaying a field chinese name and performing field type verification on query content input by a user at a client, and the field base attribute includes: field english name, field chinese name, and field type.
6. A data query device, comprising:
a field attribute setting module, configured to obtain a plurality of data tables from different channels, and set a plurality of field attributes of each field in each data table;
the data table determining module is used for receiving a first data query request and determining a data table to be queried indicated by the first data query request;
the information list acquisition module is used for generating a field basic attribute information list of the data table to be queried based on a plurality of field attributes of the data table to be queried, and sending the field basic attribute information list to the client so that the client displays a query table head according to the field basic attribute information list;
the data query module is used for receiving a second data query request for querying the fields in the field basic attribute information list, acquiring a query result matched with the query condition in the second data query request from a database and sending the query result to the client so as to display the query result under the query table head of the client;
the mapping information construction module is used for:
combining a plurality of field attributes together to obtain a field attribute group of the field;
taking a table identifier of the data table as a primary key and taking the table identifier and a field attribute group of a plurality of fields together as field mapping information of the data table;
the information list acquisition module is specifically configured to:
acquiring a field basic attribute of each field in the data table to be queried from the field mapping information of the data table to be queried;
splicing the plurality of field basic attributes according to a preset format to obtain single-field basic attribute information;
and combining a plurality of single-field basic attribute information in the data table to be queried to obtain a field basic attribute information list.
7. An electronic device, comprising: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating over the bus when the electronic device is running, the processor executing the machine-readable instructions to perform the steps of the data querying method according to any of claims 1 to 5.
8. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, performs the steps of the data query method of any of claims 1 to 5.
CN202211286642.3A 2022-10-20 2022-10-20 Data query method and device, electronic equipment and storage medium Active CN115599818B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211286642.3A CN115599818B (en) 2022-10-20 2022-10-20 Data query method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211286642.3A CN115599818B (en) 2022-10-20 2022-10-20 Data query method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115599818A CN115599818A (en) 2023-01-13
CN115599818B true CN115599818B (en) 2023-08-25

Family

ID=84849175

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211286642.3A Active CN115599818B (en) 2022-10-20 2022-10-20 Data query method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115599818B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107807977A (en) * 2017-10-26 2018-03-16 河海大学 A kind of object properties Metadata Extraction system based on configuration
CN108694214A (en) * 2017-04-12 2018-10-23 北京京东尚科信息技术有限公司 Generation method, generating means, readable medium and the electronic equipment of data sheet
CN112597186A (en) * 2020-12-29 2021-04-02 广州慧智信息科技有限公司 Data query method, computer equipment and storage medium
CN112861182A (en) * 2021-03-29 2021-05-28 中信银行股份有限公司 Database query method and system, computer equipment and storage medium
CN113641881A (en) * 2021-08-23 2021-11-12 北京字跳网络技术有限公司 Metadata display method, device, equipment and medium
US11269872B1 (en) * 2019-07-31 2022-03-08 Splunk Inc. Intent-based natural language processing system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108694214A (en) * 2017-04-12 2018-10-23 北京京东尚科信息技术有限公司 Generation method, generating means, readable medium and the electronic equipment of data sheet
CN107807977A (en) * 2017-10-26 2018-03-16 河海大学 A kind of object properties Metadata Extraction system based on configuration
US11269872B1 (en) * 2019-07-31 2022-03-08 Splunk Inc. Intent-based natural language processing system
CN112597186A (en) * 2020-12-29 2021-04-02 广州慧智信息科技有限公司 Data query method, computer equipment and storage medium
CN112861182A (en) * 2021-03-29 2021-05-28 中信银行股份有限公司 Database query method and system, computer equipment and storage medium
CN113641881A (en) * 2021-08-23 2021-11-12 北京字跳网络技术有限公司 Metadata display method, device, equipment and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"基于字段嵌入的数据库自然语言查询接口";田野等;《计算机科学》;第60-66页 *

Also Published As

Publication number Publication date
CN115599818A (en) 2023-01-13

Similar Documents

Publication Publication Date Title
US10218657B2 (en) Method and system for providing private chat within a group chat
CN108519967A (en) Chart method for visualizing, device, terminal and storage medium
CN106796682A (en) Filling user contact's entry
US20190050376A1 (en) Automatic value formatting based on intrinsic structural semantics
US7302427B2 (en) Text mining server and program
CN106527841A (en) A functional interface display method and device
CN109951318A (en) The function configuration method and device of application
CN106487748A (en) Data transmission method, apparatus and system
CN108415998A (en) Using dependence update method, terminal, equipment and storage medium
CN110209780B (en) Question template generation method and device, server and storage medium
CN114490889A (en) Configuration information processing method, device, equipment, medium and program product
CN109885780A (en) Data processing method and device
CN115599818B (en) Data query method and device, electronic equipment and storage medium
CN111641554B (en) Message processing method and device and computer readable storage medium
CN113114557B (en) Message sending method and device, electronic equipment and storage medium
CN115544417A (en) Webpage form verification method and device, electronic equipment and storage medium
CN110661693A (en) Methods, computing device-readable storage media, and computing devices facilitating media-based content sharing performed in a computing device
CN109840080B (en) Character attribute comparison method and device, storage medium and electronic equipment
CN112994900A (en) File countersigning method, device, client, server and storage medium
CN112835573A (en) Data query method and device, electronic equipment and storage medium
CN109815426A (en) Page info detection method and device, terminal and computer readable storage medium
US20140282200A1 (en) Method and system for automatically displaying information based on task context
CN114115833B (en) Automatic protocol audit code generation method and device
CN109348413A (en) Location information sharing method, device, equipment and storage medium
CN111291215B (en) Formula generation method and server

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant