A method and device for data query
By generating pattern identifiers and data identifiers, the problem of complex query logic for different roles and modules is solved, efficient, flexible and secure data query is achieved, the query process is simplified and costs are reduced.
Patent Information
- Application Number
- CN202310260700.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-17
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2043-03-17
AI Technical Summary
Different roles, organizations, or business modules correspond to different query logics, and each query requires associating multiple data, resulting in a complex data query process and low query efficiency.
By determining the query scope and identity information of the query request, a pattern identifier is generated, and the query result corresponding to the pattern identifier is obtained, including determining the query scenario and query permissions based on the processing interface, generating multiple pattern identifiers and integrating target data, screening data fields that meet the query granularity, processing mutually exclusive query permissions, using wildcards to replace information fields, generating data identifiers and storing data.
It improves data query efficiency and accuracy, simplifies the data query process, enhances the flexibility and security of the query scope, reduces R&D and maintenance costs, and improves the high availability and accuracy of data query.
Smart Images

Figure CN116340355B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data management and control technology, and in particular to a data query method and device. Background Art
[0002] Business systems store vast amounts of data, generated across different business modules, used in diverse business scenarios, and subject to varying confidentiality levels. To ensure data security, permissions are typically controlled for operations such as adding, deleting, modifying, and querying business data, ensuring that only authorized data is processed. When implementing permission control on business data, data permissions are typically set based on factors such as the role of the request initiator, the organization they work for, and the business module being processed.
[0003] In the process of implementing the present invention, the inventors discovered that the prior art has at least the following problems:
[0004] Different roles, organizations, or business modules correspond to different query logics, and each query requires associating multiple data, resulting in a complex data query process and low query efficiency. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a method and apparatus for data query, which can improve data query efficiency and query accuracy and simplify the data query process.
[0006] To achieve the above object, according to a first aspect of an embodiment of the present invention, a data query method is provided, comprising:
[0007] In response to receiving the query request, determining a query scope corresponding to the query request;
[0008] Determining the identity information corresponding to the initiator of the query request;
[0009] A corresponding mode identifier is generated according to the query scope and the identity information, and a query result corresponding to the mode identifier is obtained.
[0010] Optionally, determining a query scope corresponding to the query request includes:
[0011] Determine a processing interface corresponding to the query request, and determine a corresponding query scenario based on the processing interface;
[0012] A corresponding query authority is determined according to the query scenario, and a query scope included in the query authority is used as a query scope corresponding to the query request.
[0013] Optionally, when the query scenario corresponds to multiple query permissions, generating a corresponding mode identifier according to the query scope and the identity information, and obtaining a query result corresponding to the mode identifier includes:
[0014] According to the query scope included in each query authority, a corresponding mode identifier is generated respectively with the identity information, and the target data corresponding to the mode identifier is obtained;
[0015] Integrate the acquired target data to obtain the query results.
[0016] Optionally, the query authority includes a query granularity; after obtaining the query result corresponding to the mode identifier, the method further includes:
[0017] According to the query granularity, the data fields included in the query result are screened, and the data fields that meet the query granularity are retained.
[0018] Optionally, when the query scenario corresponds to multiple query permissions, the data fields included in the query result are filtered to retain data fields that meet the query granularity, including:
[0019] According to the query granularity included in each query permission, the data fields included in the query result are respectively filtered to obtain a filtering result;
[0020] An intersection is taken for the data fields included in the screening results to retain data fields that meet each query granularity.
[0021] Optionally, before determining the corresponding query authority according to the query scenario, the method further includes:
[0022] In response to receiving the configuration request, obtaining the target query authority corresponding to the configuration request;
[0023] The query scenario indicated by the configuration request is configured according to the target query authority.
[0024] Optionally, there are multiple target query permissions; before configuring the query scenario according to the target query permissions, the method further includes:
[0025] Determine whether there are mutually exclusive query permissions in the target query permissions;
[0026] In the case of mutually exclusive query permissions, configuring the query scenario according to the target query permission includes:
[0027] The query scenario is configured according to target query permissions other than the mutually exclusive query permissions.
[0028] Optionally, generating a corresponding mode identifier according to the query scope and the identity information includes:
[0029] Generate a corresponding identity identifier according to the identity information, wherein the identity identifier includes an information field;
[0030] In the case that the information field belongs to the query range, the identity identifier is used as the mode identifier.
[0031] Optionally, the method further includes:
[0032] In the case that the information field does not belong to the query range, the information field is replaced with a wildcard, and the replaced identity identifier is used as the pattern identifier.
[0033] Optionally, obtaining a query result corresponding to the pattern identifier includes:
[0034] determining a data identifier that matches the pattern identifier;
[0035] The business data corresponding to the data identifier is obtained, and the business data is used as the query result corresponding to the pattern identifier.
[0036] Optionally, before determining the data identifier that matches the pattern identifier, the method further includes:
[0037] In response to receiving a storage request, obtaining the data to be stored and the identity information corresponding to the initiator of the storage request;
[0038] A data identifier corresponding to the data to be stored is generated according to the identity information corresponding to the initiator of the storage request.
[0039] Optionally, the method further includes:
[0040] In response to receiving the modification request, the query scenario or the query authority is modified.
[0041] According to a second aspect of an embodiment of the present invention, a data query device is provided, including:
[0042] A first determining module, configured to, in response to receiving a query request, determine a query range corresponding to the query request;
[0043] A second determining module is used to determine the identity information corresponding to the initiator of the query request;
[0044] The query module is used to generate a corresponding mode identifier according to the query scope and the identity information, and obtain a query result corresponding to the mode identifier.
[0045] Optionally, determining a query scope corresponding to the query request includes:
[0046] Determine a processing interface corresponding to the query request, and determine a corresponding query scenario based on the processing interface;
[0047] A corresponding query authority is determined according to the query scenario, and a query scope included in the query authority is used as a query scope corresponding to the query request.
[0048] Optionally, when the query scenario corresponds to multiple query permissions, generating a corresponding mode identifier according to the query scope and the identity information, and obtaining a query result corresponding to the mode identifier includes:
[0049] According to the query scope included in each query authority, a corresponding mode identifier is generated respectively with the identity information, and the target data corresponding to the mode identifier is obtained;
[0050] Integrate the acquired target data to obtain the query results.
[0051] Optionally, the query authority includes query granularity; and the apparatus further includes:
[0052] The screening module is used to screen the data fields included in the query results according to the query granularity and retain the data fields that meet the query granularity.
[0053] Optionally, when the query scenario corresponds to multiple query permissions, the data fields included in the query result are filtered to retain data fields that meet the query granularity, including:
[0054] According to the query granularity included in each query permission, the data fields included in the query result are respectively filtered to obtain a filtering result;
[0055] An intersection is taken for the data fields included in the screening results to retain data fields that meet each query granularity.
[0056] Optionally, the device further comprises:
[0057] A first acquisition module is configured to, in response to receiving a configuration request, acquire a target query permission corresponding to the configuration request;
[0058] A configuration module is used to configure the query scenario indicated by the configuration request according to the target query authority.
[0059] Optionally, there are multiple target query permissions; the device further includes:
[0060] A judgment module, used to judge whether there is a mutually exclusive query permission in the target query permission;
[0061] In the case of mutually exclusive query permissions, configuring the query scenario according to the target query permission includes:
[0062] The query scenario is configured according to target query permissions other than the mutually exclusive query permissions.
[0063] Optionally, generating a corresponding mode identifier according to the query scope and the identity information includes:
[0064] Generate a corresponding identity identifier according to the identity information, wherein the identity identifier includes an information field;
[0065] In the case that the information field belongs to the query range, the identity identifier is used as the mode identifier.
[0066] Optionally, the device further comprises:
[0067] The replacement module is used to replace the information field with a wildcard when the information field does not belong to the query range, and use the replaced identity identifier as the pattern identifier.
[0068] Optionally, obtaining a query result corresponding to the pattern identifier includes:
[0069] determining a data identifier that matches the pattern identifier;
[0070] The business data corresponding to the data identifier is obtained, and the business data is used as the query result corresponding to the pattern identifier.
[0071] Optionally, the device further comprises:
[0072] a second acquisition module, configured to, in response to receiving a storage request, acquire the data to be stored and the identity information corresponding to the initiator of the storage request;
[0073] A generating module is used to generate a data identifier corresponding to the data to be stored according to the identity information corresponding to the initiator of the storage request.
[0074] Optionally, the device further comprises:
[0075] The modification module is configured to modify the query scenario or query authority in response to receiving a modification request.
[0076] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, including:
[0077] one or more processors;
[0078] a storage device for storing one or more programs,
[0079] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of the above embodiments.
[0080] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any one of the above embodiments is implemented.
[0081] According to a fifth aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, which implements the method described in any of the above embodiments when executed by a processor.
[0082] An embodiment of the above invention has the following advantages or beneficial effects: generating a corresponding pattern identifier according to the query scope and identity information, and obtaining a query result corresponding to the pattern identifier, which can improve data query efficiency and query accuracy and simplify the data query process; determining the query scenario according to the processing interface, determining the query authority according to the query scenario, and thus determining the query scope included in the query authority, which can improve the flexibility of the query scope and the efficiency of obtaining the query scope, and avoid the mutual coupling of the query scope with the processing interface and the query scenario; in the case where the query scenario corresponds to multiple query scopes, generating multiple pattern identifiers, obtaining multiple target data, and integrating the target data can further improve the flexibility of the query scenario and the query scope, and improve the efficiency and accuracy of obtaining the query result; filtering the data fields included in the query result according to the query granularity, which can further improve the accuracy and efficiency of the query result, improve the security of the data query, and improve the authority control of the data query; in the case where the query scenario corresponds to multiple query permissions, taking the intersection of the data fields included in the filtered results can further Improve the accuracy of query results, ensure the security of data query, and effectively control data processing permissions; configure query scenarios according to target query permissions to improve the flexibility of query scenarios, further improve data query permission control, and reduce R&D and maintenance costs; determine whether there are mutually exclusive query permissions for target query permissions to improve the high availability of data queries, avoid data queries based on conflicting query permissions, and improve data query efficiency and accuracy; use identity identifiers as pattern identifiers to improve the efficiency of pattern identifier generation; use wildcards to replace information fields to expand the matching range of pattern identifiers and improve the flexibility of data queries; determine the data identifier corresponding to the pattern identifier and obtain the business data corresponding to the data identifier, which can improve the efficiency and accuracy of business data acquisition; generate data identifiers based on identity information to improve the efficiency of data identifier generation and ensure the uniqueness and directionality of data identifiers; modify query scenarios and query permissions to improve the flexibility of query scenarios and query permissions, avoid mutual coupling between the two, and improve data query accuracy.
[0083] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0084] The accompanying drawings are provided for a better understanding of the present invention and are not intended to limit the present invention.
[0085] Figure 1 is a schematic diagram of the main process of the data query method according to an embodiment of the present invention;
[0086] Figure 2 is a schematic diagram of the overall process of data query according to a reference embodiment of the present invention;
[0087] Figure 3 This is a schematic diagram of a business scenario of data query according to a reference embodiment of the present invention;
[0088] Figure 4 is a schematic diagram of the main process of a data query method according to a reference embodiment of the present invention;
[0089] Figure 5 is a schematic diagram of the main process of a data query method according to another reference embodiment of the present invention;
[0090] Figure 6 is a schematic diagram of the main process of a data query method according to yet another reference embodiment of the present invention;
[0091] Figure 7 is a schematic diagram of main modules of a data query device according to an embodiment of the present invention;
[0092] Figure 8 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
[0093] Figure 9 It is a schematic diagram of the structure of a computer system of a terminal device or server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0094] The following description of exemplary embodiments of the present invention is made in conjunction with the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding. These details should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0095] It should be noted that in the technical solution of the present invention, the collection, use, storage, sharing and transfer of user personal information involved are in compliance with the provisions of relevant laws and regulations, and it is necessary to inform the user and obtain the user's consent or authorization. When applicable, the user's personal information is de-identified and / or anonymized and / or encrypted.
[0096] Business systems store vast amounts of data. This data is generated in different business modules, used in different business scenarios, and has varying confidentiality levels. To ensure the security of business data, permission controls are typically implemented for operations such as adding, deleting, modifying, and querying business data to ensure that each operation only processes business data within the scope of the permission. When performing permission control on business data, data permissions are typically set based on factors such as the role of the request initiator, the organization they work for, and the business module being processed. For example, different roles are assigned to users, and different permissions are assigned to different roles in different business scenarios. This allows users with different roles to obtain the data they need in different business scenarios and perform data operations within their respective permission scopes.
[0097] Different roles, organizations, or business modules correspond to different query logics. Each query requires associating multiple data, resulting in a complex data query process, low query efficiency, and increased R&D and maintenance costs.
[0098] In view of this, according to a first aspect of an embodiment of the present invention, a method for data query is provided.
[0099] Figure 1 FIG. 1 is a schematic diagram of the main process of the data query method according to an embodiment of the present invention. Figure 1 As shown, the data query method according to the embodiment of the present invention mainly includes the following steps S101 to S103.
[0100] Step S101: In response to receiving a query request, determining a query range corresponding to the query request.
[0101] A query request is a request to query business data. The query parameters carried in the query request are parsed to obtain the query scope. The query scope is the query condition used to query business data. The query scope includes the following query items: business module, business department, the initiator of the query request and their role, data generation time, data last modification time, etc. The query scope can correspond to one or more of these query items.
[0102] Exemplarily, after receiving the query request, the parameters carried by the query request are parsed to obtain "{'department':'A'; 'role':'B'; 'createTime':'yyyy-m1-d1,yyyy-m2-d2'}", where "'department':'A'" indicates that the query scope corresponding to the query request includes the department with department number "A", "'role':'B'" indicates that the query scope corresponding to the query request also includes the role with role number "B", and "'createTime':'yyyy-m1-d1,yyyy-m2-d2'" indicates that the query scope corresponding to the query request also includes the data generation time between "yyyy-m1-d1" and "yyyy-m2-d2", where "yyyy-m1-d1" indicates "yyyy" year "m1" month "d1" day, and so on for other times.
[0103] After receiving a query request, the parameters carried in the query request are parsed to obtain the query scope, which can improve the efficiency of obtaining the query scope and help ensure high availability of data query.
[0104] According to a reference embodiment of the present invention, determining the query scope corresponding to the query request includes: determining a processing interface corresponding to the query request, and determining a corresponding query scenario based on the processing interface; determining a corresponding query permission based on the query scenario, and using the query scope included in the query permission as the query scope corresponding to the query request.
[0105] After receiving the query request, the query request is parsed to obtain the processing interface corresponding to the query request, and the processing interface indicates the interface method for processing the query request; multiple processing interfaces are pre-set to be responsible for receiving and processing the query request, and the processing interface corresponding to the query request is determined according to the interface method name included in the query request, or only one query request receiving interface is set, and the parameters carried by the query request are parsed to obtain the processing interface identifier, and the processing interface corresponding to the query request is determined according to the processing interface identifier.
[0106] Each processing interface corresponds to a query scenario. A query scenario is the scenario that triggers a query request. Query scenarios include querying detailed information, statistical information, and historical editing information about the business data of different business modules. For example, based on the need to analyze the current status of the target business module, query the business data details of the target business module. Based on an analysis of the development of the target business department, query the business data details of the target business department. Query permissions are the permission requirements that must be met when querying data. Query permissions include factors such as the business module, business department, the initiator of the query request, and their role. Query permissions include a query scope, and the corresponding query scope is determined based on the query permissions. Specifically, based on the various factors included in the query permissions, the identity information included in the query request (for example, the organization, department, role, etc. corresponding to the initiator of the query request) is determined. This specific information is incorporated into the query permissions to determine the query scope, and the query scope included in the query permissions is used as the query scope corresponding to the query request. If the query request lacks identity information, subsequent data query operations are not performed, and a prompt message is returned to the initiator of the query request.
[0107] Figure 2 FIG. 1 is a schematic diagram of the overall process of data query according to a reference embodiment of the present invention. For example, Figure 2 As shown, the execution body of the embodiment of the present invention includes three modules: an authority query module, a business data operation module and a query request processing module. After the query request processing module receives the query request, it obtains the processing interface number corresponding to the query request and the identity information of the initiator of the query request, and sends the processing interface number to the authority query module. The authority query module determines the corresponding query scenario and query authority according to the processing interface number, wherein the query authority includes the query scope.
[0108] Figure 3 Schematic diagram of a data query business scenario according to a reference embodiment of the present invention. Figure 3 As shown, the contract list query page 301 includes five query buttons for querying the contract list. The signing dates corresponding to the contracts queried by the five query buttons are: within the past week, within the past month, within the past quarter, within the past six months, and within the past year. Click any query button to query the list of contracts with signing dates within the corresponding time; after clicking any query button, the page will send a query request to the execution body of the embodiment of the present invention. The query request carries the processing interface number corresponding to the query contract list. According to the processing interface number, the corresponding query scenario is determined, that is, the contract list is queried, and the corresponding query range is determined according to the query scenario.
[0109] As another example, after receiving the query request, the parameters carried by the query request are parsed to obtain "{'apiId':'#contractList';'department':'C';'role':'D'}", where "'apiId':'#contractList'" indicates that the interface identifier of the processing interface corresponding to the query request is "#contractList", "'department':'C'" indicates that the business department number of the initiator of the query request is "C", and "'role':'D'" indicates the role number "D" of the initiator of the query request. The query scenario corresponding to the processing interface is "Query contract list", and the query permissions corresponding to the query scenario include: business department and role information. Therefore, the query scope corresponding to the query request is: contract list data corresponding to the department with department number "D" and the role with role number "D".
[0110] Determine the query scenario based on the processing interface, determine the query authority based on the query scenario, and thus determine the query scope included in the query authority. This can improve the flexibility of the query scope and the efficiency of obtaining the query scope, and avoid the mutual coupling of the query scope with the processing interface and query scenario.
[0111] According to a reference embodiment of the present invention, before determining the corresponding query authority based on the query scenario, the method also includes: in response to receiving a configuration request, obtaining the target query authority corresponding to the configuration request; and configuring the query scenario indicated by the configuration request according to the target query authority.
[0112] Before determining query permissions based on a query scenario, the corresponding query permissions are first configured for the query scenario. After receiving a configuration request, the configuration request parameters are parsed to obtain a processing interface identifier and a target query permission. The corresponding target query scenario is determined based on the processing interface identifier. The target query scenario is then associated with the target query permission, allowing the target query permission to be determined based on the target query scenario, and further determining the query scope covered by the target query permission.
[0113] For example, Figure 2 As shown, before determining the corresponding query authority according to the query scenario, the authority query module obtains the corresponding target query authority and target query scenario in response to receiving the configuration request, obtains the target query range and target query granularity included in the target query authority, and uses the target query range and target query granularity to configure the target query scenario.
[0114] As another example, after receiving the configuration request, the parameters carried by the configuration request are parsed to obtain "{'apiId':'#contractDetail'; 'permission':'department,module,role'}", where "'apiId':'#contractDetail'" indicates that the interface identifier of the processing interface corresponding to the configuration request is "#contractDetail", and the target query scenario corresponding to the processing interface identifier is "query contract details", and "'permission':'department,module,role'" indicates that the target query permission includes, in sequence: the department where the query request initiator is located, the business module corresponding to the query request, and the role to which the query request initiator belongs. The above three factors constitute the query scope of the target query permission. The target query permission is associated with the query scenario "query contract details" and stored, so that when the query scenario "query contract details" triggers a query request, the query scope is determined according to the target query permission (i.e., the above three factors).
[0115] Configuring query scenarios based on target query permissions can improve the flexibility of query scenarios, further improve permission control for data queries, and reduce R&D and maintenance costs.
[0116] According to a reference embodiment of the present invention, there are multiple target query permissions; before configuring the query scenario according to the target query permissions, the method also includes: determining whether there are mutually exclusive query permissions in the target query permissions; if there are mutually exclusive query permissions, configuring the query scenario according to the target query permissions, including: configuring the query scenario according to target query permissions other than the mutually exclusive query permissions.
[0117] After parsing the parameters of the configuration request to obtain the processing interface identifier and the target query permission, if multiple target query permissions are obtained, determine whether mutually exclusive query permissions are stored between the multiple target query permissions; mutually exclusive query permissions mean that the query scopes included in the two target query permissions are mutually exclusive, resulting in no intersection in the query results; for mutually exclusive query permissions, using the query scope included in one of the query permissions to query data, the query results obtained do not conform to the query scope included in the other query permission. For example, the query scope included in one target query permission is: only query the business data of business department E within the past month, and the query scope included in the other target query permission is: only query the business data of business department F within the past week. The query results obtained based on the above two query scopes have no intersection.
[0118] A query scope mutual exclusion table is pre-set, indicating mutually exclusive query scopes. For example, if a query scope only includes a target business department, target business module, or target role, other query scopes that include other business departments, business modules, or roles are mutually exclusive with the aforementioned query scope. Query permissions with mutually exclusive query scopes are mutually exclusive query permissions. After obtaining multiple target query permissions, the query scope corresponding to each target query permission is determined. The query scope mutual exclusion table is used to determine whether there are mutually exclusive query scopes, thereby determining whether mutually exclusive query permissions exist. In the case of mutually exclusive query permissions, the query scenario is not configured using the mutually exclusive query permissions; or the priority of the query permissions is pre-set, and in the case of only two mutually exclusive query permissions, the query permission with a higher priority is retained, that is, the query scenario is configured using the query permission with a higher priority; or in the case of multiple mutually exclusive query permissions, the following operations are repeatedly performed: the query permission with the most mutually exclusive relationships is deleted and it is determined again whether there are any mutually exclusive query permissions, until there are no mutually exclusive query permissions or there is only a query permission with a mutually exclusive relationship with one query permission. For the latter, the query permission with a higher priority is retained, so that there are no mutually exclusive query permissions, and the query scenario is configured using the target query permission where no mutually exclusive query permissions exist.
[0119] Exemplarily, the received configuration request is parsed to obtain multiple target query permissions, including target query permission G, target query permission H, target query permission I, target query permission J, and target query permission K; according to the query range mutual exclusion table, it is determined that target query permission I and target query permission H, target query permission J, and target query permission K are mutually exclusive, and target query permission K and target query permission G are mutually exclusive; since target query permission I has a mutually exclusive relationship with three query permissions and target query permission K has a mutually exclusive relationship with two query permissions, the target query permission I is deleted. After deletion, according to the query range mutual exclusion table, it is determined that only target query permission K and target query permission G are mutually exclusive, and the priorities of target query permission K and target query permission G are obtained, and it is obtained that the priority of target query permission K is higher than that of target query permission G, so the target query permission G is deleted, thereby obtaining target query permissions that do not have mutually exclusive query permissions, including: target query permission H, target query permission J, and target query permission K, and the corresponding query scenarios are configured using the above three target query permissions.
[0120] Determining whether there are mutually exclusive query permissions for the target query permissions can improve the high availability of data queries, avoid data queries based on conflicting query permissions, and improve data query efficiency and accuracy.
[0121] Step S102: Determine the identity information corresponding to the initiator of the query request.
[0122] After receiving the query request, the query request is parsed to obtain the identity information of the initiator of the query request. The identity information includes: the department to which the initiator of the query request belongs, the institution where the initiator of the query request is located, the title information of the initiator of the query request, the role information of the initiator of the query request, whether the initiator of the query request has authorization information, etc.
[0123] For example, Figure 3 As shown, the contract list query page 301 includes the information: "The current operator's account ID is: 10023". After clicking any query button, the page will send a query request to the execution entity of the embodiment of the present invention. In addition to carrying the processing interface number, the query request will also carry the account ID of the initiator of the query request, and the corresponding identity information will be determined based on the account ID.
[0124] As another example, the received query request is parsed to obtain "{'department':'L1';'role':'L2';'institution':'L3';'title':'L4';'autho':'false'}", where "'department':'L1'" indicates that the department number of the initiator of the query request is "L1", "'role':'L2'" indicates that the role number of the initiator of the query request is "L2", "institution':'L3'" indicates that the institution number of the initiator of the query request is "L3", "'title':'L4'" indicates that the title number of the initiator of the query request is "L4", and "'autho':'false'" indicates that the initiator of the query request does not have specific authorization information.
[0125] After receiving the query request, the parameters carried in the query request are parsed to obtain the identity information, which can improve the efficiency of obtaining the identity information and help ensure the high availability of data query.
[0126] Step S103: Generate a corresponding mode identifier according to the query scope and the identity information, and obtain a query result corresponding to the mode identifier.
[0127] After determining the query scope and identity information, the query scope and identity information are combined to obtain a pattern identifier. The pattern identifier is used to match business data. The pattern identifier includes numbers, English letters, special symbols, etc.; according to the query scope and identity information indicated by the pattern identifier, the business data within the query scope that can be queried by the identity information is determined, and the above business data that matches the pattern identifier is used as the query result.
[0128] For example, Figure 2As shown, after the permission query module obtains the query scope, it sends the query scope to the query request processing module. The query request processing module generates an identity identifier based on the identity information of the initiator of the query request, and generates a pattern identifier based on the query scope and the identity identifier. Then, the query request processing module sends the pattern identifier to the business data operation module. The business data operation module obtains the business data that matches the pattern identifier and uses the obtained business data as the query result.
[0129] For example, Figure 3 As shown, the execution subject of the embodiment of the present invention determines the corresponding pattern identifier as "d01r02" according to the query scope and identity information, and obtains the corresponding contract list 302 from the database according to the pattern identifier. The data fields of the contract list include: data identifier, contract number, signing date, contract party A, contract party B, contract terms, start-up capital, supplementary terms, etc.
[0130] For another example, the query request is parsed, and the obtained processing interface identifier is "#userList". The query scenario corresponding to the processing interface identifier is "query user list", and the query range corresponding to the query scenario includes "{'department':'M1,M2'; 'role':'N1,N2'}", wherein "'department':'M1,M2'" indicates that the department numbers corresponding to the query scenario include "M1" and "M2", and "'role':'N1,N2'" indicates that the role numbers corresponding to the query scenario include "N1" and "N2". The obtained identity The information includes "{'department':'M1'; 'role':'N2'}", where "'department':'M1'" indicates that the department number of the department where the initiator of the query request is located is "M1", and "'role':'N2'" indicates that the role number of the initiator of the query request is "N1". According to the above query scope and identity information, the generated pattern identifier is "#userList-M1-N2", that is, the user list corresponding to the department number "M1" and the role number "N2" is queried, and the business data that meets the above pattern identifier is queried as the query result.
[0131] Generating a corresponding pattern identifier according to the query scope and identity information and obtaining the query result corresponding to the pattern identifier can improve data query efficiency and query accuracy, simplify the data query process, and provide a generally applicable data query method.
[0132] According to a reference embodiment of the present invention, obtaining the query result corresponding to the pattern identifier includes: determining a data identifier that matches the pattern identifier; obtaining business data corresponding to the data identifier, and using the business data as the query result corresponding to the pattern identifier.
[0133] After generating a corresponding pattern identifier based on the query scope and identity information, determine the data identifier that matches the pattern identifier. A data identifier is an identifier that indicates business data. One data identifier corresponds to one business data. Data identifiers include numbers, English letters, and special symbols. Determining whether a pattern identifier and a data identifier are identical includes: if the pattern identifier and the data identifier are exactly the same, or if both the pattern identifier and the data identifier are composed of multiple parts such as organization, role, business module, etc., if a part of the pattern identifier is the same as the corresponding part of the data identifier, then the pattern identifier and the data identifier are determined to match each other. Obtain the business data associated with the data identifier and use the obtained business data as the query result corresponding to the pattern identifier.
[0134] Exemplarily, the generated pattern identifier is "d001r002", where "d001" indicates the department number is "001", and "r002" indicates the role number is "002". The remaining pattern identifiers and data identifiers in this example are similar. The business data includes three business data, "data1", "data2" and "data3", where the association relationship between the business data and the data identifier is "{'data1':'d001r002'; 'data2':'d003r002'; 'data3':'d004r003'}", where the data identifier corresponding to "data1" is "d001r002", the data identifier corresponding to "data2" is "d003r002", and the data identifier corresponding to "data3" is "d004r003". The data identifier that matches the pattern identifier is determined to be "d001r002", so that the business data corresponding to the data identifier "d001r002" is "data1".
[0135] Determining the data identifier corresponding to the pattern identifier and obtaining the business data corresponding to the data identifier can improve the efficiency and accuracy of obtaining business data.
[0136] According to a reference embodiment of the present invention, when the query scenario corresponds to multiple query permissions, a corresponding pattern identifier is generated according to the query scope and the identity information, and a query result corresponding to the pattern identifier is obtained, including: generating a corresponding pattern identifier according to the query scope included in each query permission and the identity information, and obtaining the target data corresponding to the pattern identifier; integrating the obtained target data to obtain the query result.
[0137] A query scenario can correspond to one or more query permissions. In the case of multiple query permissions corresponding to the query scenario, the corresponding query scope is determined according to each query permission, and then the corresponding pattern identifier is generated according to each query scope and identity information. Therefore, in the case of multiple query permissions corresponding to the query scenario, multiple pattern identifiers are generated, and the data identifier matching the pattern identifier is determined according to each pattern identifier, and the target data corresponding to the matching data identifier is obtained. The multiple target data obtained are integrated. Specifically, it is determined whether there are duplicate data between the multiple target data and the duplicate data are deleted; or it is determined whether there are duplicate fields between the multiple target data, the duplicate fields are deleted, and the multiple target data with duplicate fields are spliced into one target data; or it is determined whether the same field is null in a certain target data but not null in other target data. If the above situation exists, the value of the corresponding field in the other target data is used to fill the above null field. If the above situation does not exist, the default value is used to fill the above null field.
[0138] For example, the query scenario obtained corresponds to three query permissions, and the corresponding query scopes are determined according to the three query permissions. The corresponding pattern identifiers are generated according to the three query scopes and identity identifiers. The three pattern identifiers include: "i005d006r007", "i005d007r008" and "i006d007r009", where "i005" indicates that the organization number is "005", "d006" indicates that the department number is "006", and "r007" indicates that the role number is "007". In this example, the rest of the pattern identifiers and data identifiers are similar; the business data includes three business data, "data4", "data5" and "data6", among which the association relationship between business data and data identifiers is "{'data4':'i005d006r007'; 'data5':'i005d007r008'; 'data6':'i006d007r008'; 'data7':'i006d007r009'}", among which "data 4" is identified as "i005d006r007", the data identifier of "data5" is "i005d007r008", and the data identifier of "data6" is "i006d007r009". According to the above pattern identifiers and association relationships, it is determined that the target data includes "data4", "data5" and "data7", among which "data4" includes "O1", "O2" and "O3" which are three fields, "data5" includes "O2", "O3" and "O4" which are three fields, and "data7" includes "O5", "O6" and "O7" which are three fields. It can be seen from the above that "data4" and "data5" have repeated fields. The repeated fields are deleted and then "data4" and "data5" are merged to obtain the merged target data "data4-5". The target data includes four fields "O1", "O2", "O3" and "O4". The target data "data4-5" and the target data "data7" are used as the query results.
[0139] When a query scenario corresponds to multiple query ranges, generating multiple pattern identifiers, obtaining multiple target data, and integrating the target data can further improve the flexibility of the query scenario and query range, and improve the efficiency and accuracy of obtaining query results.
[0140] According to a reference embodiment of the present invention, before determining the data identifier that matches the pattern identifier, the method further includes: in response to receiving a storage request, obtaining identity information corresponding to the data to be stored and the initiator of the storage request; and generating a data identifier corresponding to the data to be stored based on the identity information corresponding to the initiator of the storage request.
[0141] Before determining the data identifier that matches the pattern identifier, first add the corresponding data identifier to the business data. Specifically, after receiving the storage request, the storage request is parsed to obtain the identity information corresponding to the data to be stored and the initiator of the storage request. The identity information includes: the institution number, the department number, the role number, the title number, the corresponding account number, etc. The corresponding data identifier is generated based on the above identity information; one data identifier can correspond to one or more data to be stored, and one data to be stored corresponds to only one data identifier; the data identifier is associated with the data to be stored and stored, so that the corresponding data to be stored (i.e., the business data or target data mentioned above) can be determined based on the data identifier, and the corresponding data identifier can be determined based on the business data or target data.
[0142] For example, Figure 2 As shown, before determining the data identifier that matches the pattern identifier, the business data operation module obtains the identity information corresponding to the data to be stored and the initiator of the storage request in response to receiving the storage request, generates a data identifier based on the identity information corresponding to the initiator of the storage request, associates the data identifier and the data to be stored, and obtains business data with the data identifier.
[0143] For another example, after receiving the storage request, the storage request is parsed to obtain "{'institution':'P1'; 'department':'P2'; 'role':'P3'; 'title':'P4'; 'id':'P5'; 'save':'data8'}", "'institution':'P1'" indicates that the number of the institution where the initiator of the query request is located is "P1", and "'department':'P2'" indicates that the number of the department where the initiator of the query request is located is "P2". The number is "P2", "'role':'P3'" indicates that the role number of the initiator of the query request is "P3", "'title':'P4'" indicates that the title number of the initiator of the query request is "P4", "'id':'P5'" indicates that the account number of the initiator of the query request is "P5", and "'save':'data8'" indicates that the data to be stored is "data8". According to the above identity information, the data identifier "P1P2P3P4P5" is obtained, and the above data identifier is associated with the data to be stored "data8".
[0144] Generating data identifiers based on identity information can improve the efficiency of data identifier generation and ensure the uniqueness and directionality of data identifiers.
[0145] According to a reference embodiment of the present invention, the query authority includes query granularity; after obtaining the query result corresponding to the pattern identifier, the method further includes: filtering the data fields included in the query result according to the query granularity, and retaining the data fields that meet the query granularity.
[0146] Query permissions also include query granularity. Compared with the query scope that indicates which data can be used as query results, query granularity indicates the field level of the data field to be queried. Data fields that meet the field level indicated by the query granularity can be used as query results. Query granularity includes: ordinary level, key level, special level, all levels, etc. After obtaining the query result corresponding to the pattern identifier, the query granularity corresponding to the query permission is determined, and the data fields in the query results that meet the field level corresponding to the query granularity are retained, and the data fields in the query results that do not meet the field level corresponding to the query granularity are deleted, thereby filtering the query results.
[0147] For example, Figure 2 As shown, after the business data operation module obtains the query result, it sends the query result to the query request processing module. The query request processing module filters the data fields included in the query result according to the query granularity to obtain the filtered result.
[0148] For example, Figure 3 As shown, after obtaining the contract list 302, the execution entity of the embodiment of the present invention obtains the corresponding query granularity of the ordinary level from the query request. In the contract list 302, the data fields: data identification, contract number, signing date, contract party A, and contract party B are all at the ordinary level, the data fields: contract terms and start-up capital are all at the key level, and the data field: supplementary terms are at the special level; therefore, after filtering the contract list 302 according to the query granularity, the contract list query result page 303 is obtained. The contract list in the contract list query result page 303 only includes ordinary-level data fields; and an option to view details is added at the end of each data. Clicking "Click to view" can send a query request for the details of the corresponding contract to the execution entity of the embodiment of the present invention.
[0149] As another example, the query result corresponding to the obtained pattern identifier is the business data "data9", which includes three data fields, namely "field1", "field2", and "field3", among which the data field "field1" is a data field of the ordinary level, the data field "field2" is a data field of the key level, and the data field "field1" is a data field of the special level; the corresponding query granularity is determined according to the query authority, and the field level indicated by the query granularity is the ordinary level. Therefore, only the data field "field1" is retained in the query result, and the data field "field2" and the data field "field3" are deleted.
[0150] Filtering the data fields included in the query results according to the query granularity can further improve the accuracy and acquisition efficiency of the query results, enhance the security of data query, and improve the permission control of data query.
[0151] According to a reference embodiment of the present invention, when the query scenario corresponds to multiple query permissions, the data fields included in the query results are filtered to retain the data fields that meet the query granularity, including: filtering the data fields included in the query results according to the query granularity included in each query permission to obtain a filtered result; and taking the intersection of the data fields included in the filtered results to retain the data fields that meet each query granularity.
[0152] In the case of multiple query permissions corresponding to a query scenario, each query permission may include one or more query ranges and one or more query granularities. When the query permission includes multiple query granularities, after obtaining the corresponding query results, the data fields included in the query results are filtered according to each query granularity included in the query permission to obtain filtered results. The obtained filtered results are subjected to intersection processing. Specifically, whether there are identical data fields among the multiple filtered results is determined, the identical data fields are retained, and the different data fields are deleted.
[0153] For example, the business data "data10" corresponding to the query result includes five data fields, namely "field4", "field5", "field6", "field7" and "field8". The current query permission is obtained, and the query permission includes three query granularities, namely "level1", "level2" and "level3". The data fields included in the business data "data10" are filtered using these three query granularities respectively, and the filtering results are as follows: the data fields obtained using the query granularity "level1" include "field5", "field6" and "field7"; the data fields obtained using the query granularity "level2" include "field4", "field6" and "field7"; the data fields obtained using the query granularity "level3" include "field6", "field7" and "field8"; the intersection of the three groups of data fields included in the above filtering results is taken to obtain "field6" and "field7". Therefore, the query results obtained according to the multiple query granularities included in the query permission are the data field "field6" and the data field "field7", which means that the data field "field6" and the data field "field7" meet all the query granularities included in the query permission.
[0154] Filtering the data fields included in the query results according to the query granularity can further improve the accuracy and acquisition efficiency of the query results, enhance the security of data query, and improve the permission control of data query.
[0155] According to a reference embodiment of the present invention, a corresponding pattern identifier is generated according to the query scope and the identity information, including: generating a corresponding identity identifier according to the identity information, the identity identifier including an information field; when the information field belongs to the query scope, using the identity identifier as the pattern identifier.
[0156] Identity information includes: organization, department, role, title, and other information items. These information items are combined to obtain an identity identifier. Each information item included in the identity identifier is an information field. The information field is compared with the query scope. If the information field falls within the query scope, the information field is retained. If the information field does not fall within the query scope, the information field is deleted. The identity identifier corresponding to the retained information field is used as the pattern identifier.
[0157] Exemplarily, the identity information obtained includes: the number of the institution where the initiator of the query request is located is "i001", the number of the department is "d003", the number of the role is "r005", and the number of the job title is "t007". The identity identifier generated according to the above identity information is "i001d003r005t007", where the information fields include "i001", "d003", "r005", and "t007"; the query range obtained includes "{'institution':'i001,i002'; 'department':'d003,d004'; 'title':'t005,t006'}, where. "'institution':'i001,i002'" indicates that the institution numbers include "i001" and "i002", "'department':'d003,d004'" indicates that the department numbers include "d003" and "d004", and "'title':'t005,t006'" indicates that the professional title numbers include "t005" and "t006". Comparing the information fields included in the identity information with the above query range, it can be seen that the information fields "i001" and "d003" belong to the above query range, while the information fields "r005" and "t007" do not. Therefore, only the information fields "i001" and "d003" are retained for the identity identification, and the corresponding pattern identifier is "i001d003".
[0158] Generate a corresponding identity identifier based on the identity information. When the information field falls within the query scope, use the identity identifier as a pattern identifier to improve the efficiency and accuracy of obtaining the pattern identifier and increase the flexibility of data query.
[0159] According to a reference embodiment of the present invention, the method further includes: when the information field does not belong to the query range, replacing the information field with a wildcard, and using the replaced identity identifier as the pattern identifier.
[0160] The information field is compared with the query range. If the information field does not fall within the query range, the information field is replaced with a pre-set wildcard. The wildcards include: asterisk (*), hyphen (-), percent sign (%), exclamation mark (!), etc. Wildcards can match any number, English letter or special character, etc. The replaced identity identifier with the wildcard is used as the pattern identifier.
[0161] Exemplarily, the obtained identity identifier is "i002d004r006t008c010", wherein the information fields include "i002", "d004", "r006", "t008", and "c010", wherein "c010" indicates that the account number corresponding to the initiator of the query request is "c010"; the obtained query scope includes "{'title':'t007,t008'}", that is, the query scope is only restricted to the title of the initiator of the query request; by comparing the information fields included in the identity information with the above query scope, it can be seen that the information field "t008" belongs to the above query scope, and the information fields "i002", "d004", "r006", and "id010" do not belong to the above query scope. Therefore, the pre-set wildcard is determined to be "*", and the above information fields that do not belong to the query scope are replaced with "*", and the corresponding pattern identifier is obtained as "************t008****", which can match the data identifier of the title number "t008" of the initiator of the query request.
[0162] Using wildcards to replace information fields can expand the matching range of pattern identifiers and improve the flexibility of data queries.
[0163] According to a reference embodiment of the present invention, the method further includes: in response to receiving a modification request, modifying the query scenario or query authority.
[0164] A modification request is a request to modify the query scenario or query permission. After receiving the modification request, the parameters carried by the modification request are parsed to obtain the query scenario corresponding to the processing interface, or the query permission corresponding to the query scenario; when the query scenario is obtained, the name of the query scenario is modified, or the association between the query scenario and the processing interface and query permission is modified, or the existing query scenario is deleted, or a new query scenario is added, etc.; when the query permission is obtained, the query scope and query granularity included in the query permission are obtained, the existing query scope and query granularity are modified or deleted, or a new query scope or query granularity is added within the query permission.
[0165] For example, after receiving the modification request, the parameters carried by the modification request are parsed to obtain "{'type':'add'; 'role':'r003'; 'apiId':'#g7i9w'}", where "'type':'add'" indicates that the operation type corresponding to the modification request is an add operation, "'apiId':'#g7i9w'" indicates that the processing interface number corresponding to the add operation is "#g7i9w", and "'role':'r003'" indicates that "r003" is to be added to the "role" corresponding to the query scope, that is, in the processing The role number "r003" of the role of the query request initiator is added to the query scope corresponding to the processing interface with the interface number "#g7i9w". The query scope corresponding to the processing interface with the processing interface number "#g7i9w" is obtained, and "{'department':'d002,d005'; 'role':'r001,r005'}" is obtained. After performing the above addition operation, the query scope obtained is "{'department':'d002,d005'; 'role':'r001.r003,r005'}".
[0166] Modifying query scenarios and query permissions can improve their flexibility, avoid coupling between them, and improve data query accuracy.
[0167] Figure 4 FIG. 1 is a schematic diagram of the main process of a data query method according to a reference embodiment of the present invention. Figure 4 As shown, the data query method includes the following steps:
[0168] Step S401: In response to receiving a query request, determining a processing interface corresponding to the query request, and determining a corresponding query scenario according to the processing interface;
[0169] Step S402: determining the corresponding query authority according to the query scenario, and using the query scope included in the query authority as the query scope corresponding to the query request;
[0170] Step S403: Parse the query request to obtain the department, organization, title, and role information of the person who initiated the query request;
[0171] Step S404, generating a corresponding identity identifier according to the identity information, the identity identifier including an information field;
[0172] Step S405, determine whether the information field belongs to the query range, if so, jump to step S407, otherwise, jump to step S406;
[0173] Step S406: Replace the information field with a wildcard, and use the replaced identity identifier as the pattern identifier;
[0174] Step S407, using the identity identifier as the mode identifier;
[0175] Step S408: Determine the data identifier that matches the pattern identifier, obtain the business data corresponding to the data identifier, and use the business data as the query result corresponding to the pattern identifier.
[0176] The specific implementation content of the data query method of the above-mentioned reference embodiment of the present invention has been described in detail in the above-mentioned data query method, so the repeated content will not be described again here.
[0177] Figure 5 FIG. 1 is a schematic diagram of the main process of a data query method according to another reference embodiment of the present invention. Figure 5 As shown, the data query method includes the following steps:
[0178] Step S501: in response to receiving a configuration request, obtaining a target query permission corresponding to the configuration request;
[0179] Step S502: determine whether there is a mutually exclusive query permission in the target query permission. If so, jump to step S504; otherwise, jump to step S503;
[0180] Step S503: deleting the mutually exclusive query permissions included in the target query permissions;
[0181] Step S504: configuring the query scenario indicated by the configuration request according to the target query authority;
[0182] Step S505: In response to receiving the query request, determining a processing interface corresponding to the query request, and determining a corresponding query scenario according to the processing interface;
[0183] Step S506: determining the corresponding query authority according to the query scenario, and using the query scope included in the query authority as the query scope corresponding to the query request;
[0184] Step S507: Parse the query request to obtain the department, organization, title, and role information of the person who initiated the query request;
[0185] Step S508, generating a corresponding identity identifier according to the identity information, the identity identifier including an information field;
[0186] Step S509, determine whether the information field belongs to the query range, if so, jump to step S511, otherwise, jump to step S510;
[0187] Step S510: Replace the information field with a wildcard, and use the replaced identity identifier as a pattern identifier;
[0188] Step S511, using the identity identifier as the mode identifier;
[0189] Step S512: determining a data identifier that matches the pattern identifier, obtaining business data corresponding to the data identifier, and using the business data as a query result corresponding to the pattern identifier;
[0190] Step S513: obtaining the query granularity included in the query authority, and filtering the data fields included in the query result according to the query granularity to obtain the filtering result.
[0191] The specific implementation content of the data query method of the above-mentioned reference embodiment of the present invention has been described in detail in the above-mentioned data query method, so the repeated content will not be described again here.
[0192] Figure 6 FIG. 1 is a schematic diagram of the main process of a data query method according to another reference embodiment of the present invention. Figure 6 As shown, the data query method includes the following steps:
[0193] Step S601: in response to receiving a storage request, obtaining the data to be stored and the identity information corresponding to the initiator of the storage request;
[0194] Step S602: Generate a data identifier corresponding to the data to be stored based on the identity information corresponding to the initiator of the storage request;
[0195] Step S603: in response to receiving the configuration request, obtaining the target query authority corresponding to the configuration request;
[0196] Step S604: determine whether there is a mutually exclusive query permission in the target query permission. If so, jump to step S606; otherwise, jump to step S605;
[0197] Step S605: deleting the mutually exclusive query permissions included in the target query permissions;
[0198] Step S606: configuring the query scenario indicated by the configuration request according to the target query authority;
[0199] Step S607: In response to receiving the query request, determining a processing interface corresponding to the query request, and determining a corresponding query scenario according to the processing interface;
[0200] Step S608: determining the corresponding query authority according to the query scenario, and using the query scope included in the query authority as the query scope corresponding to the query request;
[0201] Step S609: Parse the query request to obtain the department, organization, title, and role information of the person who initiated the query request;
[0202] Step S610, generating a corresponding identity identifier according to the identity information, the identity identifier including an information field;
[0203] Step S611, determine whether the information field belongs to the query range, if so, jump to step S612, otherwise jump to step S613;
[0204] Step S612: Replace the information field with a wildcard, and use the replaced identity identifier as the pattern identifier;
[0205] Step S613, using the identity identifier as the mode identifier;
[0206] Step S614: determining a data identifier that matches the pattern identifier, obtaining business data corresponding to the data identifier, and using the business data as a query result corresponding to the pattern identifier;
[0207] Step S615: Obtain the query granularity included in the query authority, and filter the data fields included in the query result according to the query granularity to obtain the filter result;
[0208] Step S616: In response to receiving the modification request, the name of the query scenario is modified, and a new query scope or query granularity is added within the query authority.
[0209] The specific implementation content of the data query method of the above-mentioned reference embodiment of the present invention has been described in detail in the above-mentioned data query method, so the repeated content will not be described again here.
[0210] According to a second aspect of an embodiment of the present invention, a device for data query is provided.
[0211] Figure 7 Schematic diagram of the main modules of the data query device according to an embodiment of the present invention. Figure 7 As shown, the data query device 700 mainly includes:
[0212] A first determining module 701 is configured to, in response to receiving a query request, determine a query scope corresponding to the query request;
[0213] A second determining module 702 is configured to determine the identity information corresponding to the initiator of the query request;
[0214] The query module 703 is configured to generate a corresponding mode identifier according to the query scope and the identity information, and obtain a query result corresponding to the mode identifier.
[0215] According to a reference embodiment of the present invention, determining a query scope corresponding to the query request includes:
[0216] Determine a processing interface corresponding to the query request, and determine a corresponding query scenario based on the processing interface;
[0217] A corresponding query authority is determined according to the query scenario, and a query scope included in the query authority is used as a query scope corresponding to the query request.
[0218] According to another reference embodiment of the present invention, when the query scenario corresponds to multiple query permissions, generating a corresponding mode identifier according to the query scope and the identity information, and obtaining a query result corresponding to the mode identifier includes:
[0219] According to the query scope included in each query authority, a corresponding mode identifier is generated respectively with the identity information, and the target data corresponding to the mode identifier is obtained;
[0220] Integrate the acquired target data to obtain the query results.
[0221] According to another reference embodiment of the present invention, the query authority includes query granularity; the device further includes:
[0222] The screening module is used to screen the data fields included in the query results according to the query granularity and retain the data fields that meet the query granularity.
[0223] According to another reference embodiment of the present invention, when the query scenario corresponds to multiple query permissions, the data fields included in the query results are filtered to retain data fields that meet the query granularity, including:
[0224] According to the query granularity included in each query permission, the data fields included in the query result are respectively filtered to obtain a filtering result;
[0225] An intersection is taken for the data fields included in the screening results to retain data fields that meet each query granularity.
[0226] According to yet another reference embodiment of the present invention, the data query device 700 further includes:
[0227] A first acquisition module is configured to, in response to receiving a configuration request, acquire a target query permission corresponding to the configuration request;
[0228] A configuration module is used to configure the query scenario indicated by the configuration request according to the target query authority.
[0229] According to a reference embodiment of the present invention, the target query authority has multiple permissions; the data query device 700 further includes:
[0230] A judgment module, used to judge whether there is a mutually exclusive query permission in the target query permission;
[0231] In the case of mutually exclusive query permissions, configuring the query scenario according to the target query permission includes:
[0232] The query scenario is configured according to target query permissions other than the mutually exclusive query permissions.
[0233] According to another reference embodiment of the present invention, generating a corresponding mode identifier according to the query scope and the identity information includes:
[0234] Generate a corresponding identity identifier according to the identity information, wherein the identity identifier includes an information field;
[0235] In the case that the information field belongs to the query range, the identity identifier is used as the mode identifier.
[0236] According to another reference embodiment of the present invention, the data query device 700 further includes:
[0237] The replacement module is used to replace the information field with a wildcard when the information field does not belong to the query range, and use the replaced identity identifier as the pattern identifier.
[0238] According to another reference embodiment of the present invention, obtaining a query result corresponding to the pattern identifier includes:
[0239] determining a data identifier that matches the pattern identifier;
[0240] The business data corresponding to the data identifier is obtained, and the business data is used as the query result corresponding to the pattern identifier.
[0241] According to yet another reference embodiment of the present invention, the data query device 700 further includes:
[0242] a second acquisition module, configured to, in response to receiving a storage request, acquire the data to be stored and the identity information corresponding to the initiator of the storage request;
[0243] A generating module is used to generate a data identifier corresponding to the data to be stored according to the identity information corresponding to the initiator of the storage request.
[0244] According to a reference embodiment of the present invention, the data query device 700 further includes:
[0245] The modification module is configured to modify the query scenario or query authority in response to receiving a modification request.
[0246] It should be noted that the specific implementation content of the data query device described in the embodiment of the present invention has been described in detail in the data query method described above, so the repeated content will not be described again here.
[0247] According to the technical solution of the embodiment of the present invention, a corresponding pattern identifier is generated according to the query scope and identity information, and a query result corresponding to the pattern identifier is obtained, which can improve data query efficiency and query accuracy and simplify the data query process; the query scenario is determined according to the processing interface, and the query authority is determined according to the query scenario, so as to determine the query scope included in the query authority, which can improve the flexibility of the query scope and the efficiency of obtaining the query scope, and avoid the mutual coupling of the query scope with the processing interface and the query scenario; in the case where the query scenario corresponds to multiple query scopes, multiple pattern identifiers are generated, multiple target data are obtained, and the target data are integrated, which can further improve the flexibility of the query scenario and the query scope, and improve the efficiency and accuracy of obtaining the query result; the data fields included in the query result are filtered according to the query granularity, which can further improve the accuracy and efficiency of the query result, improve the security of the data query, and improve the authority control of the data query; in the case where the query scenario corresponds to multiple query authorities, the data fields included in the filtered results are taken for intersection, which can further improve the query The accuracy of query results is ensured, the security of data query is ensured, and data processing permissions are effectively controlled; configuring query scenarios according to target query permissions can improve the flexibility of query scenarios, further improve the permission control of data queries, and reduce R&D costs and maintenance costs; judging whether there are mutually exclusive query permissions for target query permissions can improve the high availability of data queries, avoid data queries based on conflicting query permissions, and improve data query efficiency and accuracy; using identity identifiers as pattern identifiers can improve the generation efficiency of pattern identifiers; using wildcards to replace information fields can expand the matching range of pattern identifiers and improve the flexibility of data queries; determining the data identifier corresponding to the pattern identifier and obtaining the business data corresponding to the data identifier can improve the efficiency and accuracy of business data acquisition; generating data identifiers based on identity information can improve the generation efficiency of data identifiers and ensure the uniqueness and directionality of data identifiers; modifying query scenarios and query permissions can improve the flexibility of query scenarios and query permissions, avoid mutual coupling between the two, and improve data query accuracy.
[0248] According to a third aspect of an embodiment of the present invention, an electronic device for data query is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in the first aspect of the embodiment of the present invention.
[0249] According to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method provided by the first aspect of the embodiment of the present invention is implemented.
[0250] According to a fifth aspect of an embodiment of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method provided in the first aspect of the embodiment of the present invention is implemented.
[0251] Figure 8 An exemplary system architecture 800 is shown to which the data query method or data query apparatus according to an embodiment of the present invention may be applied.
[0252] like Figure 8 As shown, system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. Network 804 is used to provide a medium for communication links between terminal devices 801, 802, 803 and server 805. Network 804 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0253] Users can use terminal devices 801, 802, and 803 to interact with server 805 via network 804 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 801, 802, and 803, such as data query applications, data statistics applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0254] The terminal devices 801 , 802 , and 803 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0255] Server 805 can be a server that provides various services, such as a background management server (for example only) that supports data query requests sent by upstream terminal devices 801, 802, and 803. In response to receiving a query request, the background management server can determine the query scope corresponding to the query request; determine the identity information corresponding to the initiator of the query request; generate a corresponding pattern identifier based on the query scope and the identity information, obtain a query result corresponding to the pattern identifier; and feedback the data query result (for example only) to the terminal device.
[0256] It should be noted that the data query method provided in the embodiment of the present invention is generally executed by the server 805, and accordingly, the data query device is generally set in the server 805. The data query method provided in the embodiment of the present invention can also be executed by the terminal devices 801, 802, and 803, and accordingly, the data query device can be set in the terminal devices 801, 802, and 803.
[0257] It should be understood that Figure 8 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0258] Reference below Figure 9 , which shows a schematic structural diagram of a computer system 900 of a terminal device suitable for implementing an embodiment of the present invention. Figure 9 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0259] like Figure 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage unit 908 into a random access memory (RAM) 903. Various programs and data required for the operation of the system 900 are also stored in the RAM 903. The CPU 901, ROM 902, and RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0260] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, and the like; an output section 907 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 908 including a hard disk and the like; and a communication section 909 including a network interface card such as a LAN card or a modem. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 910 as needed, so that computer programs read therefrom can be installed into the storage section 908 as needed.
[0261] In particular, according to the embodiments disclosed in the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present invention include a computer program comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 909, and / or installed from a removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above-mentioned functions defined in the system of the embodiment of the present invention are executed.
[0262] It should be noted that the computer-readable medium shown in the embodiments of the present invention may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In embodiments of the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device, or component. In embodiments of the present invention, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.
[0263] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer programs according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0264] The modules described in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be provided in a processor. For example, they may be described as follows: a processor including a first determination module, a second determination module, and a query module. The names of these modules do not, in certain circumstances, constitute limitations on the modules themselves. For example, the query module may also be described as a "module for obtaining query results corresponding to a pattern identifier."
[0265] As another aspect, embodiments of the present invention further provide a computer-readable medium, which may be included in the device described in the above embodiments, or may exist independently and not incorporated into the device. The computer-readable medium carries one or more programs. When executed by a device, the device implements the following method: in response to receiving a query request, determining a query scope corresponding to the query request; determining identity information corresponding to the initiator of the query request; generating a corresponding pattern identifier based on the query scope and the identity information, and obtaining a query result corresponding to the pattern identifier.
[0266] According to the technical solution of the embodiment of the present invention, a corresponding pattern identifier is generated according to the query scope and identity information, and a query result corresponding to the pattern identifier is obtained, which can improve data query efficiency and query accuracy and simplify the data query process; the query scenario is determined according to the processing interface, and the query authority is determined according to the query scenario, so as to determine the query scope included in the query authority, which can improve the flexibility of the query scope and the efficiency of obtaining the query scope, and avoid the mutual coupling of the query scope with the processing interface and the query scenario; in the case where the query scenario corresponds to multiple query scopes, multiple pattern identifiers are generated, multiple target data are obtained, and the target data are integrated, which can further improve the flexibility of the query scenario and the query scope, and improve the efficiency and accuracy of obtaining the query result; the data fields included in the query result are filtered according to the query granularity, which can further improve the accuracy and efficiency of the query result, improve the security of the data query, and improve the authority control of the data query; in the case where the query scenario corresponds to multiple query authorities, the data fields included in the filtered results are taken for intersection, which can further improve the query The accuracy of query results is ensured, the security of data query is ensured, and data processing permissions are effectively controlled; configuring query scenarios according to target query permissions can improve the flexibility of query scenarios, further improve the permission control of data queries, and reduce R&D costs and maintenance costs; judging whether there are mutually exclusive query permissions for target query permissions can improve the high availability of data queries, avoid data queries based on conflicting query permissions, and improve data query efficiency and accuracy; using identity identifiers as pattern identifiers can improve the generation efficiency of pattern identifiers; using wildcards to replace information fields can expand the matching range of pattern identifiers and improve the flexibility of data queries; determining the data identifier corresponding to the pattern identifier and obtaining the business data corresponding to the data identifier can improve the efficiency and accuracy of business data acquisition; generating data identifiers based on identity information can improve the generation efficiency of data identifiers and ensure the uniqueness and directionality of data identifiers; modifying query scenarios and query permissions can improve the flexibility of query scenarios and query permissions, avoid mutual coupling between the two, and improve data query accuracy.
[0267] The above specific embodiments do not limit the scope of protection of the embodiments of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the embodiments of the present invention should be included in the scope of protection of the embodiments of the present invention.
Claims
1. A data query method, characterized in that: include: In response to receiving the query request, determining a query scope corresponding to the query request; Determining the identity information corresponding to the initiator of the query request; Generate a corresponding mode identifier according to the query scope and the identity information, and obtain a query result corresponding to the mode identifier; Generate a corresponding pattern identifier according to the query scope and the identity information, including: generating a corresponding identity identifier according to the identity information, the identity identifier including an information field; when the information field belongs to the query scope, use the identity identifier as the pattern identifier; when the information field does not belong to the query scope, replace the information field with a wildcard, and use the replaced identity identifier as the pattern identifier.
2. The method according to claim 1, characterized in that Determining a query scope corresponding to the query request includes: Determine a processing interface corresponding to the query request, and determine a corresponding query scenario based on the processing interface; A corresponding query authority is determined according to the query scenario, and a query scope included in the query authority is used as a query scope corresponding to the query request.
3. The method according to claim 2, characterized in that In the case where the query scenario corresponds to multiple query permissions, generating a corresponding mode identifier according to the query scope and the identity information, and obtaining a query result corresponding to the mode identifier includes: According to the query scope included in each query authority, a corresponding mode identifier is generated respectively with the identity information, and the target data corresponding to the mode identifier is obtained; Integrate the acquired target data to obtain the query results.
4. The method according to claim 2, characterized in that The query authority includes a query granularity; after obtaining the query result corresponding to the mode identifier, the method further includes: According to the query granularity, the data fields included in the query result are screened, and the data fields that meet the query granularity are retained.
5. The method according to claim 4, characterized in that In the case where the query scenario corresponds to multiple query permissions, the data fields included in the query results are screened, and the data fields that meet the query granularity are retained, including: According to the query granularity included in each query permission, the data fields included in the query result are respectively filtered to obtain a filtering result; An intersection is taken for the data fields included in the screening results to retain data fields that meet each query granularity.
6. The method according to claim 2, characterized in that Before determining the corresponding query authority according to the query scenario, the method further includes: In response to receiving the configuration request, obtaining the target query authority corresponding to the configuration request; The query scenario indicated by the configuration request is configured according to the target query authority.
7. The method according to claim 6, characterized in that There are multiple target query permissions; before configuring the query scenario according to the target query permissions, the method further includes: Determine whether there are mutually exclusive query permissions in the target query permissions; In the case of mutually exclusive query permissions, configuring the query scenario according to the target query permission includes: The query scenario is configured according to target query permissions other than the mutually exclusive query permissions.
8. The method according to claim 1, characterized in that Obtaining the query result corresponding to the pattern identifier includes: determining a data identifier that matches the pattern identifier; The business data corresponding to the data identifier is obtained, and the business data is used as the query result corresponding to the pattern identifier.
9. The method according to claim 8, characterized in that Before determining the data identifier that matches the pattern identifier, the method further includes: In response to receiving a storage request, obtaining the data to be stored and the identity information corresponding to the initiator of the storage request; A data identifier corresponding to the data to be stored is generated according to the identity information corresponding to the initiator of the storage request.
10. The method according to claim 2, characterized in that The method further comprises: In response to receiving the modification request, the query scenario or the query authority is modified.
11. A data query device, characterized in that: include: A first determining module, configured to, in response to receiving a query request, determine a query range corresponding to the query request; A second determining module is used to determine the identity information corresponding to the initiator of the query request; A query module, configured to generate a corresponding pattern identifier according to the query scope and the identity information, and obtain a query result corresponding to the pattern identifier; Generate a corresponding pattern identifier according to the query scope and the identity information, including: generating a corresponding identity identifier according to the identity information, the identity identifier including an information field; when the information field belongs to the query scope, use the identity identifier as the pattern identifier; when the information field does not belong to the query scope, replace the information field with a wildcard, and use the replaced identity identifier as the pattern identifier.
12. The device according to claim 11, characterized in that Determining a query scope corresponding to the query request includes: Determine a processing interface corresponding to the query request, and determine a corresponding query scenario based on the processing interface; A corresponding query authority is determined according to the query scenario, and a query scope included in the query authority is used as a query scope corresponding to the query request.
13. The device according to claim 12, characterized in that The query authority includes query granularity; the device further includes: The screening module is used to screen the data fields included in the query results according to the query granularity and retain the data fields that meet the query granularity.
14. The device according to claim 12, characterized in that The device further comprises: A first acquisition module is configured to, in response to receiving a configuration request, acquire a target query permission corresponding to the configuration request; A configuration module is used to configure the query scenario indicated by the configuration request according to the target query authority.
15. The device according to claim 14, characterized in that The target query authority has multiple permissions; the device also includes: A judgment module, used to judge whether there is a mutually exclusive query permission in the target query permission; In the case of mutually exclusive query permissions, configuring the query scenario according to the target query permission includes: The query scenario is configured according to target query permissions other than the mutually exclusive query permissions.
16. The device according to claim 11, characterized in that Obtaining the query result corresponding to the pattern identifier includes: determining a data identifier that matches the pattern identifier; The business data corresponding to the data identifier is obtained, and the business data is used as the query result corresponding to the pattern identifier.
17. The device according to claim 16, characterized in that The device further comprises: a second acquisition module, configured to, in response to receiving a storage request, acquire the data to be stored and the identity information corresponding to the initiator of the storage request; A generating module is used to generate a data identifier corresponding to the data to be stored according to the identity information corresponding to the initiator of the storage request.
18. An electronic device, characterized in that: include: One or more callers; a storage device for storing one or more programs, When the one or more programs are executed by the one or more callers, the one or more callers implement the method according to any one of claims 1 to 10.
19. A computer-readable medium having a computer program stored thereon, characterized in that: When the program is executed by the caller, the method according to any one of claims 1 to 10 is implemented.
20. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Data query method and device, equipment, medium and product
CN117076721A