CN115599818A - 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
CN115599818A
CN115599818A CN202211286642.3A CN202211286642A CN115599818A CN 115599818 A CN115599818 A CN 115599818A CN 202211286642 A CN202211286642 A CN 202211286642A CN 115599818 A CN115599818 A CN 115599818A
Authority
CN
China
Prior art keywords
query
field
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.)
Granted
Application number
CN202211286642.3A
Other languages
Chinese (zh)
Other versions
CN115599818B (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

Images

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 a client so that the client can display a query table header according to the field basic attribute information list; and receiving a second data query request for querying 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 and apparatus, an electronic device, and a storage medium.
Background
With the rapid development of information technology, the information amount is increased explosively, and correspondingly, the data stored in the database is also increased exponentially, so that the application of the data query function is more and more extensive. The data query function can enable a user to conveniently and quickly acquire the data desired by the user. The data query function is usually performed for multiple data tables obtained by different channels, and the field name, the field type and the field number may be different between different data tables.
When two different data tables are respectively and independently queried, if the same query statement is used for data query, a query result can be normally obtained for a certain data table, but the query result may not be obtained for the other data table, and even a query error condition occurs, so that the problem of poor data query function adaptability is caused.
Disclosure of Invention
In view of this, an object of the present application is to provide a data query method, apparatus, electronic device and storage medium, so as to solve the problem of poor adaptability of 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 a client so that the client can display a query table header according to the field basic attribute information list;
and receiving a second data query request for querying 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 header of the client.
Optionally, after setting a plurality of field attributes of each field in each sheet data table, the method further includes: combining a plurality of field attributes together to obtain a field attribute group of the field; and taking the table identification of the data table as a primary key and taking the table identification of the data table and the field attribute group of the plurality of fields as field mapping information of the data table.
Optionally, 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, including: acquiring field basic attributes of each field in the data table to be queried from 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; combining a plurality of single-field basic attribute information in a data table to be queried to obtain a field basic attribute information list.
Optionally, the query condition comprises a plurality of conditions; 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: 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 conditional expression to determine a plurality of query conditions and a plurality of logical relations among the 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 expressions to obtain combined query results, and sending the combined query results to the client.
Optionally, after sending the field basic attribute information list to the client, the method further includes: receiving a filter establishing instruction aiming at a data table to be queried, wherein the filter establishing instruction comprises a filter name and a plurality of query conditions; combining a plurality of query conditions in sequence to form a filter condition list; the filter is constituted by a filter name, a filter condition list, and an enhanced conditional expression, and is saved in a database.
Optionally, determining a single query result of the query condition includes: acquiring a field English name and a query rule of the query condition; determining a field to be queried in a data table to be queried according to the field English name; and taking the data which accords with the query rule in the field to be queried as a single query result of the query condition.
Optionally, the field base attribute is used for displaying a field chinese name at the client and performing field type verification on the query content input by the user, and the field base attribute includes: a field English name, a field Chinese name, and a field type.
In a second aspect, an embodiment of the present application further provides a data query apparatus, where the apparatus includes:
the field attribute setting module is used for acquiring a plurality of data tables from different channels and setting 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 inquired based on a plurality of field attributes of the data table to be inquired and sending the field basic attribute information list to the client so that the client can display the inquiry 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 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 form header 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 communicating via the bus when the electronic device is running, the machine-readable instructions being executable by the processor to perform the steps of the data query method as described above.
In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps of the data query method as described above.
The embodiment of the application brings the following beneficial effects:
according to the data query method, the data query 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 to adapt to 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 side, the header of the data table to be queried is displayed at the client side to prompt the user of the content of the field which can be queried, the query result is determined according to specific query conditions, and the query result is displayed under the corresponding header, so that the same field attributes can be set for the target fields of different data tables under the conditions that the field contents are the same but the field names are different, so that the normal query result can be obtained when the data query is carried out on different data tables.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
FIG. 1 is a flow chart illustrating a data query method provided by an embodiment of the present application;
fig. 2 is a schematic structural diagram illustrating a data query device according to an embodiment of the present application;
fig. 3 shows a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. Every other embodiment that can be obtained by a person skilled in the art without making creative efforts based on the embodiments of the present application falls within the protection scope of the present application.
It is noted that, before the present application is proposed, with the rapid development of information technology, the amount of information shows explosive growth, and accordingly, the data stored in the database also shows exponential growth, which makes the application of the data query function more and more extensive. The data query function can enable a user to conveniently and quickly acquire the data desired by the user. The data query function is usually performed for multiple data tables obtained from different channels, and the field names, field types, and field numbers of the multiple data tables may be different. When the same query statement is used for different data tables, the query result can be normally obtained for some data tables, but the query result cannot be obtained for other data tables, and even the query error condition occurs, so that the problem of poor adaptability of the data query function is caused.
Based on this, 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 illustrating a data query method according to an embodiment of the present application. As shown in fig. 1, a data query method provided in an embodiment of the present application includes:
step S101, acquiring a plurality of data tables from different channels, and setting a plurality of field attributes of each field in each data table.
In this step, the data table may refer to a table storing data.
Illustratively, the data table may be a commodity data table for storing commodity information; the data table can be an enterprise data table used for storing enterprise information; the data table may also be a user data table for storing user information, such as: the system comprises information such as user name, gender, age, mobile phone number, occupation and academic calendar, wherein each type of information is correspondingly stored as a field, for example: the age field is used to store the age of all users in the data table.
The field attribute may refer to attribute information of a field used for displaying field information of the data table at the client and verifying contents input by the user.
Field attributes include, but are not limited to: english name of field, chinese name of field, type of field, length of field, whether it must be filled in or not, and whether it is unique or not.
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, although the names in fields of different data tables are the same, the meanings may be different, for example: the field contents of the fields in the data table a (user name) are WeChat names of the users, and the field contents of the fields in the data table B (user name) are real names of the users, at this time, although the field Chinese names of the data table a and the data table B are both (user name), the meanings of the fields 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, in this case, although the field names of the data table a and the data table B are both [ number ], the field types are completely different.
It is also possible that the chinese name is in a field in the data table where no field is noted.
Therefore, after the data tables are obtained, corresponding field attributes can be set for each field of each data table at the server side, so that the data tables are convenient to manage, and the set field attributes can be sent to the client side to be displayed, so that a user can conveniently understand specific contents stored in the fields.
In an optional 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; and taking the table identification of the data table as a primary key and taking the table identification of the data table and the field attribute group of the plurality of fields as field mapping information of the data table.
Here, a field attribute group may refer to an attribute group consisting of a plurality of field attributes of a single field, and the field attribute group is used to characterize attribute information of the field.
The table identification may refer to a unique identification of the data table, and may be, for example, a table ID.
Specifically, assuming that the data table a has 2 fields, and the 2 fields are field a and field b, respectively, the field mapping information of the data table a can be obtained, where the field mapping information a sequentially includes: the system comprises a table identifier, a field attribute group a and a 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, and whether filling is necessary or not and whether the field attribute group is unique or not.
Step S102, receiving a first data query request, and determining a data table to be queried indicated by the first data query request.
In this step, the first data query request may refer to a request for querying a data table, and the first data query request is used to determine the data table to be queried.
The data table to be queried may refer to the 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 active data is to be queried through clicking operation, the client sends a first data query request to a server according to the clicking operation, and the server receives the first data query request and determines a table identifier of a data table to be queried according to a user identifier and an activity identifier. Here, after acquiring the data table, the server may establish a corresponding relationship 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 corresponding relationship after receiving the first data query request. The user identification may refer to a unique identification of the user, and may be, for example, a tenant ID of a tenant registered on the query platform.
Step S103, generating a field basic attribute information list of the data table to be queried based on the 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 can display a query table header according to the field basic attribute information list.
In this step, the field basic attribute information list may refer to a list composed of field attributes of different fields, and the field basic attribute information list is used for displaying a header of the data table at the client and verifying whether the query content input by the user meets the requirement.
The query header can refer to a header of the data table to be queried, and the query header is used for displaying field names of fields which can be queried in the data table to be queried.
In an optional 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 field basic attributes of each field in the data table to be queried from 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 for displaying a field chinese name and performing field type verification on a query content input by a user at a client.
The field base attribute includes: a field english name, a field chinese name, and a field type.
The single-field basic attribute information may be information obtained by splicing a plurality of field basic attributes of a certain field.
Assuming that the data table a is a data table to be queried, the data table a has 12 fields in total, wherein 5 fields are queryable fields, and taking the 1 st field of the 5 fields as an example, the english name 1, the chinese name 1 and the type 1 of the field can be used as the basic attribute 1 of the field, and the english name 1, the chinese name 1 of the field and the type 1 of the field are connected by a separator to obtain the basic attribute information 1 of a single word segment.
Alternatively, the single-field basic attribute information may be formed by using the english name of the field as the header of the single-field basic attribute information, connecting the chinese name of the field and the type of the field by a separator as the trailer of the single-field basic attribute information, and using the header of the single-field basic attribute information and the trailer of the single-field basic attribute information. The separator may be any of a division symbol such as "-", "+", "-", "/", and the like.
It should be noted that, after receiving the field basic attribute information list, the client 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 a 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, such as "nickname, head portrait, name, operation time, gender, and client ID". At this time, the first data query request sent by the user does not include a specific query condition, so there is no data under the query table, that is, there is no query result. The user knows which data can be queried through the displayed query header.
And step S104, receiving a second data query request for querying 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 form of the client.
In this step, the second data query request may refer to a request for obtaining data in the data table to be queried, and the second data query request is used for sending a query condition to the server.
In the embodiment of the application, a user-defined query button is displayed in a client query interface, a user pops up the user-defined query interface after clicking the user-defined query button, a plurality of query conditions can be set by the user in the user-defined query interface, 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 query condition is explained below.
The inquiry condition number is as follows: and the inquiry condition numbers are automatically generated and displayed by the client according to the sequence of creating the inquiry conditions before the fields to be inquired and the inquiry rules of the current inquiry conditions are displayed.
A field to be queried: the method is characterized in that a pull-down menu mode is used for users to select, a plurality of field Chinese names for inquiring fields are displayed in the pull-down menu, the 6 items of the field Chinese names 'nickname, head portrait, name, operation time, gender and customer ID' in the head of the inquiry table are displayed in the pull-down menu of the pull-down menu by taking the example as an example, and after one item is selected by the user, the selected item can be used as the field to be inquired of the current inquiry condition.
Condition rules: 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 multiple options, the multiple condition rule options are displayed in a pull-down menu mode. Taking "gender" as an example, the conditional rule of the field to be queried can only be "equal" and "age" as an example; the condition rule of the field to be queried is equal to, more than or equal to, less than or equal to, more than or less than; taking "name" as an example, the conditional rule of the field to be queried is including, starting, and ending. 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 to be combined with other field basic attributes to form single-field basic attribute information and 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 may be thresholds selected by a user or thresholds input by the user, the threshold rules are compared with the field types to determine whether the thresholds meet the field type requirements, taking the field to be queried as "gender", for example, the condition rule is equal to, and the threshold rules must be character-type, for example: male or female, not a number or picture; taking the field to be queried as "operation time" as an example, the condition rule is greater than or equal to, the threshold rule is a date-time list, and the user can select a date from the date-time list as the 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 also 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, the threshold rule is used as a field basic attribute and is combined with other field basic attributes to form single-field basic attribute information, and the single-field basic attribute information is sent to the client, and the set threshold rule may be displayed to the user in a pull-down menu or list manner at the client for selection; the threshold rule may also be stored separately and then read by the client.
In addition, a user can establish a plurality of query conditions in the client query interface, and the plurality of query conditions are combined to be used as combined query conditions. The combined query condition is divided into two query modes, one is a simple combined query mode, and the other is a complex combined query mode.
The simple combined query mode refers to that a plurality of query conditions are combined in a logical and mode, the complex combined query mode refers to that a plurality of query conditions are combined in a mode set by an enhancement condition, illustratively, 3 query conditions of a, b and c are shared, the enhancement condition is (a and b) or c, then data query is carried out in a mode that a logical and operation is carried out between a query result of the query condition a and a query result of the query condition b, and a result of the logical and operation is further carried out in a logical or operation mode with a query result of the query condition c.
It should be noted that other field attributes such as the field length may also be used as field basic attributes, and the content input by the user is determined by using the single-field basic attribute information formed by the field lengths, so as to determine whether the content input by the user meets the query requirement.
In an alternative embodiment, 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: 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 conditional expression to determine a plurality of query conditions and a plurality of logical relations between the 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 expressions to obtain combined query results, and sending the combined query results to the client.
Here, the enhanced condition may refer to a logical relationship between a plurality of query conditions input by the user, and the enhanced condition may be "(a and b) or c", for example.
The enhanced conditional expression may refer to an expression of an enhanced condition that may be recognized by the database, and is, for example, (a & & b) | c.
Specifically, the server analyzes a second data query request sent by the 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 combined query mode, processes a plurality of single query results according to a logical and mode to obtain a first combined query result, and sends the first combined 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 query mode is a complex combination query mode, acquiring an enhanced conditional expression, analyzing the enhanced expression, and converting characters input by a user into characters which can be recognized by a database, for example: the AND is converted into the 'and', the number of the query conditions and the logic relation between the query conditions are determined, then the single query result of each query condition is obtained, the single query results are processed according to the determined logic relation to obtain a second combined query result, and the second combined query result is sent to the client. And 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 of the query condition comprises: acquiring the English name of the field of the query condition and a query rule; determining a field to be queried in a data table to be queried according to the field English name; and taking the data which accords with 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 may obtain the field english name of each field to be queried, that is, the client may 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.
And the server receives a second data query instruction, for each query condition, the field to be queried in the data table to be queried corresponding to the query condition can be determined through the English name of the field corresponding to the query condition in the second data query instruction, whether the data in each row of data in the field to be queried meet the query rule is determined, and all data meeting the query rule are used 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 identification in the second data query request is a preset value; and if the enhancement condition identification is a preset value, determining that the query mode of the second data query request is a complex combined query mode.
Here, the enhancement condition flag may refer to a flag that determines whether the user sets the enhancement condition.
The preset value may refer to a set value, and for example, the preset value may be 1.
Specifically, a hook option for setting whether to set an enhancement condition is displayed in a client query interface, after a user sets a plurality of query conditions, the user can select whether to set the enhancement condition for the query conditions, if the user hooks the hook option of "whether to set the enhancement condition", the enhancement condition identifier is set to 1, and if the user does not hook the hook option, the enhancement condition is set to 0. When the user selects to set the enhancement condition, the enhancement condition may be entered in the corresponding input field, for example: and a or b, then the user clicks the query button to generate 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 combined query mode.
In an optional embodiment, after sending the field basic attribute information list to the client, the method further includes: receiving a filter establishing instruction aiming at a data table to be queried, wherein the filter establishing instruction comprises a filter name and a plurality of query conditions; combining a plurality of query conditions in sequence to form a filter condition list; the filter is constituted by a filter name, a filter condition list, and an enhanced conditional expression, and is saved in a database.
Here, the filter may refer to a query condition that can be multiplexed, and the query condition included in the filter may be plural or single.
Specifically, in a user-defined query interface popped up after a user clicks a user-defined query button, the user can set a plurality of query conditions and 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 a storage button. After receiving a save instruction sent by a user, a client generates a filter creation instruction, where the filter creation instruction includes filter creation information, for example: the server side receives the filter creating command, and then constructs a filter by the filter name, the filter condition list and the enhanced conditional expression and stores the filter in a database. The enhancement condition is not necessary for creating the filter, the user may set the filter with the enhancement condition or may not set the filter with the enhancement condition, and the number of the query conditions of the filter may be one or more.
In addition, the filter stored in the database also includes a table identifier 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 and the device have the advantages that the field attributes of the fields of the data table can be set for different data tables to adapt to 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 header of the data table to be queried is displayed at the client to prompt the field content which can be queried by a user, the query result is determined according to specific query conditions, and the query result is displayed under the corresponding header, so that the same field attributes can be set for the target fields of different data tables under the conditions that the field contents are the same but the field names are different, the normal query result can be obtained when the data query is carried out on the different data tables, and the problem of poor data query function adaptability is solved.
Based on the same inventive concept, a data query device corresponding to the data query method is also provided in the embodiments of the present application, and because the principle of solving the problem of the device in the embodiments of the present application is similar to the data query method in the embodiments of the present application, the implementation of the device may refer to the implementation of the method, and repeated details are not repeated.
Referring to fig. 2, fig. 2 is a schematic structural diagram of a data query device according to an embodiment of the present disclosure. As shown in fig. 2, the data querying device 200 includes:
a field attribute setting module 201, configured to obtain multiple data tables from different channels, and set multiple 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, where the first data query request indicates;
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 table 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 basic attribute information list, obtain a query result matched with a query condition in the second data query request from a database, and send the query result to the client, so that the query result is displayed under a query table of the client.
Referring to fig. 3, fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. 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 runs, 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 embodiment of the method shown in fig. 1 may be executed.
An embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the step of the data query method in the method embodiment shown in fig. 1 may be executed.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed coupling or direct coupling or communication connection between each other may be through some communication interfaces, indirect coupling or communication connection between devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed 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 can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in software functional units and sold or used as a stand-alone product, may be stored in a non-transitory computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute 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 (RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present application, and are used for illustrating the technical solutions of the present application, but not limiting the same, and the scope of the present application is not limited thereto, and although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: those skilled in the art can still make modifications or changes to the embodiments described in the foregoing embodiments, or make equivalent substitutions for some features, within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present application and are intended to be covered by the appended claims. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

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 the 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 can display a query table header according to the field basic attribute information list;
and receiving a second data query request for querying 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 a query table header of the client.
2. The method according to claim 1, further comprising, after said setting, for each field in each data table, a plurality of field attributes of that field:
combining a plurality of field attributes together to obtain a field attribute group of the field;
and taking the table identifier of the data table as a primary key and taking the table identifier and the field attribute group of the plurality of fields as field mapping information of the data table.
3. The method according to claim 2, wherein the 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 comprises:
acquiring field basic attributes of each field in the data table to be inquired from the field mapping information of the data table to be inquired;
splicing the plurality of field basic attributes according to a preset format to obtain single-field basic attribute information;
and combining a plurality of pieces of single-field basic attribute information in the data table to be queried to obtain a field basic attribute information list.
4. The method of claim 1, wherein the query condition comprises a plurality;
the 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 includes:
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 conditional expression to determine a plurality of query conditions and a plurality of logical relations between the 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 expressions to obtain combined query results, and sending the combined query results to the client.
5. The method of claim 1, wherein after sending the field base attribute information list to a client, further comprising:
receiving a filter creating instruction aiming at the data table to be queried, wherein the filter creating instruction comprises a filter name and a plurality of query conditions;
combining a plurality of query conditions in sequence to form a filter condition list;
and forming a filter by the filter name, the filter condition list and the enhanced conditional expression, and storing the filter in a database.
6. The method of claim 4, wherein determining the single query result of the query condition comprises:
acquiring the English name of the field of the query condition and a 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 which accords with the query rule in the field to be queried as a single query result of the query condition.
7. The method of claim 3, wherein the field basic attribute is used for displaying a field Chinese name at a client and performing field type verification on the query content input by a user, and the field basic attribute comprises: a field english name, a field chinese name, and a field type.
8. A data query device, comprising:
the field attribute setting module is used for acquiring a plurality of data tables from different channels and setting 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 the 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 can display a query table header according to the field basic attribute information list;
and the data query module is used for receiving a second data query request for querying 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 form header of the client.
9. 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 via the bus when the electronic device is operating, the processor executing the machine-readable instructions to perform the steps of the data query method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, performs the steps of the data query method according to any one of claims 1 to 7.
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 true CN115599818A (en) 2023-01-13
CN115599818B 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 (2)

* Cited by examiner, † Cited by third party
Title
MOHAMED TRABELSI等: ""Improved Table Retrieval Using Multiple Context Embeddings for Attributes"", 《 2019 IEEE INTERNATIONAL CONFERENCE ON BIG DATA (BIG DATA)》, pages 1 - 4 *
田野等: ""基于字段嵌入的数据库自然语言查询接口"", 《计算机科学》, pages 60 - 66 *

Also Published As

Publication number Publication date
CN115599818B (en) 2023-08-25

Similar Documents

Publication Publication Date Title
CN109873745B (en) Communication control method, communication control device and storage medium
US20030093474A1 (en) Group contacting system, and recording medium for storing computer instructions for executing operations of the contact system
CN107734031B (en) Information interaction method and system based on electronic book
CN110750222A (en) Printing method, printing device, computer equipment and storage medium
CN108353018B (en) Method, device and system for sending message
US6910034B2 (en) Search apparatus, search method and storage medium for storing search program
JP6442807B1 (en) Dialog server, dialog method and dialog program
CN113625911A (en) Information display method and device
CN109766315A (en) Document presentation method and terminal, computer storage medium, computer equipment
CN113259774B (en) Live broadcast information pushing method and device
CN112818654B (en) Message storage method, message generation method, device, electronic equipment and computer readable medium
CN109885780A (en) Data processing method and device
CN114595012A (en) To-do item adding and displaying method and related equipment
CN115599818A (en) Data query method and device, electronic equipment and storage medium
CN112235120B (en) Group combination method and electronic equipment
CN112260933B (en) Communication method, communication device, electronic equipment and medium
CN115544417A (en) Webpage form verification method and device, electronic equipment and storage medium
CN113051477A (en) Content recommendation method and device, electronic equipment and medium
US11665114B2 (en) Information processing apparatus and non-transitory computer readable medium for determination of message and member suitability for tasks
CN113704486A (en) Map data construction method and device and map data query method and device
CN112835573A (en) Data query method and device, electronic equipment and storage medium
CN114066377B (en) Warehouse product query method and device, computer equipment and medium
CN114115833B (en) Automatic protocol audit code generation method and device
CN116016410B (en) Service communication method and device, electronic equipment and storage medium
CN114240167A (en) Power supply enterprise performance assessment method and device and computer storage medium

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