A query authority verification method, device, equipment and storage medium
By obtaining user permission levels and verifying database query statements in NL2SQL and the large-model conversational BI system, the problem of users accessing data without permission is solved, and the accuracy of permission control and data security are achieved.
Patent Information
- Application Number
- CN202411069055.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-08-06
AI Technical Summary
In the existing NL2SQL and large-model conversational BI systems, user access rights control is not strict enough, and there is a risk of unauthorized access to data.
By obtaining the current user's permission level, the generated database query statement is checked for permissions. If the permission level is exceeded, an error message is fed back; otherwise, the query is executed.
While ensuring user query convenience, strictly control user query permissions to prevent unauthorized access to data and improve data security.
Smart Images

Figure CN118643536B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing technology, and in particular to a query authority verification method, device, equipment and storage medium. Background Art
[0002] With the development of artificial intelligence (AI), Natural Language to Structured Query Language (NL2SQL) technology enables users to query databases using natural language, significantly improving query convenience and efficiency. Furthermore, large-scale conversational BI (Business Intelligence) systems, by integrating advanced AI models, enable users to interact with the system in natural language, thereby obtaining the necessary business intelligence information.
[0003] However, the currently commonly used NL2SQL and large-model conversational BI systems often do not have strict enough control over user access rights, and there is still a risk of unauthorized access to data.
[0004] Therefore, how to avoid unauthorized access to data through permission control has become an urgent problem to be solved in this field. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to provide a query permission verification method, device, equipment and storage medium, which can verify the permission of the currently generated database query statement based on the permission level corresponding to the current user, strictly control the user's query permission and improve data security. The specific scheme is as follows:
[0006] In a first aspect, the present application provides a query authority verification method applied to a business intelligence system, comprising:
[0007] Obtaining natural language query information input by the current user, and converting the query information into a database query statement based on a preset large language model;
[0008] Performing permission verification on the database query statement according to the permission level corresponding to the current user to obtain a corresponding permission verification result;
[0009] If the permission check result indicates that the database query statement exceeds the permission level corresponding to the current user, an error message indicating that the user has no permission is fed back;
[0010] If the permission check result indicates that the database query statement meets the permission level corresponding to the current user, the database query statement is executed to obtain a corresponding query result.
[0011] Optionally, obtaining the natural language query information currently input by the user includes:
[0012] Obtaining the identity information of the current user, and determining the permission level corresponding to the current user based on a preset identity-permission correspondence relationship; the preset identity-permission correspondence relationship includes a correspondence between several permission levels and the user's identity information;
[0013] If the authority level of the current user is lower than the first preset authority level, prohibiting the current user from using the business intelligence system;
[0014] If the authority level of the current user is not less than the first preset authority level, the natural language query information input by the current user is obtained.
[0015] Optionally, obtaining the natural language query information currently input by the user includes:
[0016] Obtaining the first query information in natural language input by the current user;
[0017] The ledger information corresponding to the first query information is displayed through a preset interactive interface, and the second query information for the ledger information input by the current user is obtained.
[0018] Optionally, displaying the ledger information corresponding to the first query information through a preset interactive interface includes:
[0019] Determine all ledger information corresponding to the current user according to the authority level of the current user;
[0020] The target ledger information corresponding to the first query information is obtained from all the ledger information through a preset deep learning model, and the target ledger information is displayed through a preset interactive interface.
[0021] Optionally, converting the query information into a database query statement based on a preset large language model includes:
[0022] Based on the preset large language model, the second query information for the ledger information is converted into a corresponding database query statement.
[0023] Optionally, performing permission verification on the database query statement according to the permission level corresponding to the current user to obtain a corresponding permission verification result includes:
[0024] Perform field extraction processing on the database query statement based on regular matching to obtain corresponding field information;
[0025] Determine whether the authorization field corresponding to the permission level corresponding to the current user contains all the field information;
[0026] If the authorization field contains all the field information, generating a permission verification result indicating that the database query statement complies with the permission level corresponding to the current user;
[0027] If the authorization field does not include all of the field information, a permission verification result is generated indicating that the database query statement exceeds the permission level corresponding to the current user.
[0028] Optionally, executing the database query statement to obtain corresponding query results includes:
[0029] Execute the database query statement to obtain corresponding query results;
[0030] A display format selection instruction for the query result input by the current user is obtained, so as to display the query result in a target display format corresponding to the display format selection instruction.
[0031] In a second aspect, the present application provides a query authority verification device, which is applied to a business intelligence system, comprising:
[0032] An information conversion module is used to obtain the natural language query information input by the current user and convert the query information into a database query statement based on a preset large language model;
[0033] The permission verification module is used to perform permission verification on the database query statement according to the permission level corresponding to the current user and obtain a corresponding permission verification result;
[0034] An error information feedback module is used to feedback an error message indicating that the user has no permission when the permission check result indicates that the database query statement exceeds the permission level corresponding to the current user;
[0035] The query module is configured to execute the database query statement to obtain a corresponding query result when the permission check result indicates that the database query statement meets the permission level corresponding to the current user.
[0036] In a third aspect, the present application provides an electronic device, comprising:
[0037] Memory, used to store computer programs;
[0038] A processor is used to execute the computer program to implement the query authority verification method as described above.
[0039] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, which implements the query authority verification method as described above when executed by a processor.
[0040] It can be seen that the business intelligence system in this application can obtain the natural language query information input by the current user, and convert the query information into a database query statement based on a preset large language model; then perform permission verification on the database query statement according to the permission level corresponding to the current user to obtain a corresponding permission verification result; if the permission verification result indicates that the database query statement exceeds the permission level corresponding to the current user, an error message indicating no permission is fed back; if the permission verification result indicates that the database query statement meets the permission level corresponding to the current user, the database query statement is executed to obtain a corresponding query result. In this way, the present application can perform permission verification on the currently generated database query statement according to the permission level corresponding to the current user, and perform permission control on the database query statement that appears in the user's query process. It can strictly control the user's query permission while ensuring the convenience of user queries, prevent users from unauthorized access to data, improve the accuracy of permission verification, and improve the security of data. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0042] Figure 1 A flowchart of a query authority verification method disclosed in this application;
[0043] Figure 2 A flowchart of a specific query authority verification method disclosed in this application;
[0044] Figure 3 This is a schematic diagram of a ledger search window disclosed in this application;
[0045] Figure 4 A schematic diagram of a conversational interface disclosed in this application;
[0046] Figure 5 This is a schematic diagram showing the ledger information disclosed in this application;
[0047] Figure 6 A specific ledger matching flow chart disclosed in this application;
[0048] Figure 7This is a schematic diagram of a ledger information display interface disclosed in this application;
[0049] Figure 8 This is a schematic diagram of ledger information selection disclosed in this application;
[0050] Figure 9 A natural language parsing flowchart disclosed in this application;
[0051] Figure 10 A schematic diagram of the authorization fields corresponding to a user disclosed in this application;
[0052] Figure 11 This is a schematic diagram of a prompt message of unauthorized access disclosed in this application;
[0053] Figure 12 A schematic diagram showing a query result table disclosed in this application;
[0054] Figure 13 A schematic diagram showing a line graph of query results disclosed in this application;
[0055] Figure 14 A schematic diagram showing a bar chart of query results disclosed in this application;
[0056] Figure 15 A schematic diagram showing a pie chart of query results disclosed in this application;
[0057] Figure 16 This is a schematic diagram of the structure of a query authority verification device disclosed in this application;
[0058] Figure 17 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0059] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0060] See also Figure 1 As shown, an embodiment of the present invention discloses a query authority verification method applied to a business intelligence system, comprising:
[0061] Step S11: Acquire natural language query information input by the current user, and convert the query information into a database query statement based on a preset large language model.
[0062] In an embodiment of the present application, a user can input natural language query information into a business intelligence system, and the business intelligence system can convert the obtained query information into a database query statement using a preset large language model; the large language model can accurately convert between natural language and SQL (Structured Query Language) statements. It is understood that before using the business intelligence system, the user needs to undergo identity authentication and confirm the corresponding identity's permission level. In a specific embodiment, obtaining the natural language query information input by the current user can include: obtaining the current user's identity information and determining the permission level corresponding to the current user based on a preset identity-permission correspondence; the preset identity-permission correspondence includes a correspondence between several permission levels and the user's identity information; if the current user's permission level is less than a first preset permission level, prohibiting the current user from using the business intelligence system; if the current user's permission level is not less than the first preset permission level, obtaining the natural language query information input by the current user. Specifically, the business intelligence system can first obtain the identity information of the current user, and then determine the permission level corresponding to the identity information of the current user by setting an identity permission correspondence relationship that represents the correspondence between the identity information permission levels; it can be understood that the permission levels are divided into several high levels and low levels, and the types and / or quantities of permissions included in the high levels are greater than the permission levels and / or quantities included in the low levels; further, the business intelligence system can determine whether the permission level corresponding to the current user is less than the first preset permission level. If so, the current user is prohibited from using the business intelligence system; correspondingly, if the permission level of the current user is not less than the first preset permission level, it indicates that the current user can use the business intelligence system. At this time, the business intelligence system can obtain the natural language query information input by the current user.
[0063] In a specific embodiment, the acquisition of query information in natural language input by the current user may include: acquiring first query information in natural language input by the current user; displaying the ledger information corresponding to the first query information through a preset interactive interface, and acquiring second query information for the ledger information input by the current user. Specifically, after the business intelligence system receives the first query information in natural language input by the current user, it is clear that the ledger information corresponding to the first query information can be displayed through a preset interactive interface, and the user can further input second query information for the ledger information displayed by the business intelligence system. In a specific embodiment, the display of the ledger information corresponding to the first query information through a preset interactive interface may include: determining all ledger information corresponding to the current user according to the authority level of the current user; obtaining target ledger information corresponding to the first query information from all ledger information through a preset deep learning model, and displaying the target ledger information through a preset interactive interface. Specifically, the ledger information available for display can also correspond to the permission level. A higher permission level can include more ledger information available for display than a lower permission level. The business intelligence system can determine the corresponding total ledger information available for display based on the current user's permission level, and then use the deep learning model to query all the ledger information to obtain the target ledger information that matches the current user's first query information. The queried target ledger information is then displayed through a preset interactive interface. It should be noted that the deep learning model can convert the first query information input by the user into a structured query intent, through which the corresponding target ledger information can be determined from all the ledger information.
[0064] In another specific embodiment, converting the query information based on the preset large language model into a database query statement may include converting a second query information for the ledger information into a corresponding database query statement based on the preset large language model. Specifically, after the user enters the second query information for the ledger information, the preset large language model's NL2SQL capability is used to perform natural language parsing on the second query information, and the second query information may be converted into a corresponding database query statement.
[0065] Step S12: performing permission verification on the database query statement according to the permission level corresponding to the current user to obtain a corresponding permission verification result.
[0066] In an embodiment of the present application, through the above steps, the query information input by the user can be converted into a corresponding database query statement through a large language model, and then the business intelligence system can perform permission verification on the database query statement according to the permission level corresponding to the current user, and determine whether the database query statement is within the permission of the current user, and obtain the corresponding permission verification result.
[0067] In a specific implementation, performing permission verification on the database query statement based on the permission level corresponding to the current user to obtain a corresponding permission verification result may include: performing field extraction processing on the database query statement based on regular matching to obtain corresponding field information; determining whether the authorization field corresponding to the permission level corresponding to the current user contains all of the field information; if the authorization field contains all of the field information, generating a permission verification result indicating that the database query statement meets the permission level corresponding to the current user; if the authorization field does not contain all of the field information, generating a permission verification result indicating that the database query statement exceeds the permission level corresponding to the current user. Specifically, the business intelligence system can extract the field information of the database query statement through regular matching. For example, the system uses regular matching to add a wildcard to the table name bslrxx to obtain a regular expression. Through regular matching, the field information corresponding to the query statement of the bslrxx table in SQL is obtained: bslrxx.ssjd_cn, bslrxx.xm. Then query the authorization fields corresponding to the user's permission level, such as: sscs_cn, xm, ssjd_cn, ssqx_cn and other fields; then compare the field information with the authorization fields corresponding to the current user's permission level. If all fields in the field information are included in the authorization fields, it indicates that the database query statement does not exceed the permission range of the current user, and then generate a permission verification result indicating that the database query statement meets the permission level corresponding to the current user; correspondingly, if the fields in the field information exceed the inclusion range of the authorization fields corresponding to the current user, a permission verification result indicating that the database query statement exceeds the permission level of the current user can be generated.
[0068] Step S13: If the permission check result indicates that the database query statement exceeds the permission level corresponding to the current user, an error message indicating that the user has no permission is fed back.
[0069] Furthermore, if the permission verification result obtained through the above steps indicates that the database query statement exceeds the permission level corresponding to the current user, the business intelligence system will refuse to execute the database query statement and can feedback an error message indicating lack of permission to the user, for example: Sorry, you do not have permission to access this data.
[0070] Step S14: If the permission check result indicates that the database query statement meets the permission level corresponding to the current user, the database query statement is executed to obtain a corresponding query result.
[0071] Correspondingly, if the final permission verification result indicates that the database query statement meets the permission level corresponding to the current user, it means that the current query of the user is legal, and the business intelligence system can execute the database query statement to obtain the corresponding query result. In a specific embodiment, the execution of the database query statement to obtain the corresponding query result may include: executing the database query statement to obtain the corresponding query result; obtaining the display form selection instruction for the query result input by the current user, so as to display the query result through the target display form corresponding to the display form selection instruction. Specifically, after the business intelligence system executes the database query statement to obtain the corresponding query result, it can obtain the display form selection instruction for the query result input by the current user through a pre-set interface, and then display the obtained query result through the corresponding target display form. For example, the final query result can be displayed in a variety of forms such as tables, bar charts, and line charts.
[0072] It should be pointed out that in a specific embodiment, after obtaining the database query statement, the business intelligence system executes the query statement; then, the corresponding query result can also be subjected to permission verification, and the data in the query result that exceeds the user's permission is blurred according to the data type corresponding to the user's permission level, so that the user can only see the data that matches his or her permission level.
[0073] It can be seen from this that the present application can perform permission verification on the currently generated database query statement through the permission level corresponding to the current user, perform permission control on the database query statement that appears during the user's query process, convert the natural language query information input by the user into the corresponding database query statement based on the preset large language model, and then judge the field information in the database query statement through the authorization field of the user's corresponding permission level. If there is a field in the field information of the database query statement that is inconsistent with the authorization field, it is determined that the user has no permission to use the changed database query statement to query; in this way, while ensuring the convenience of user queries, the user's query permissions can be strictly controlled to prevent users from unauthorized access to data, which can improve the accuracy of permission verification and improve data security.
[0074] like Figure 2 As shown, the embodiment of the present application discloses a query authority verification method applied to a business intelligence system, including:
[0075] The user first authenticates access to the system through the Agent front-end user identity authentication module of the business intelligence system, and the user logs in for authentication. In a specific embodiment, after the user logs in and authenticates, in order to comprehensively improve the user's operation convenience, the intelligent ledger retrieval provides a hover entrance on the right side of the resident window, so that the user can call this function at any time, such as Figure 3 When the user clicks the "Smart Numbers" link, the user will enter the conversational interface, as shown in Figure 4 As shown in the figure, the user inputs query information in natural language, and the business intelligence system can use the natural language processing module of the large language model to perform semantic analysis on the query information input by the user.
[0076] The user inputs natural language, and the Agent backend uses the language model to identify and analyze the natural language input by the user. After the analysis is completed, the system will display the ledger information that matches the natural language input by the user based on the user ledger permissions queried by the system. Figure 5 As shown in the figure. The process of matching the ledger is as follows Figure 6 After obtaining the ledger information that matches the query information entered by the user, the ledger information display interface is as follows: Figure 7 shown.
[0077] Furthermore, users can select a specific ledger based on the ledger information displayed by the business intelligence system. Figure 8 As shown. After that, the business intelligence system can realize the accurate conversion between natural language and SQL statements through the NL2SQL conversion module of the preset large language model, and perform permission verification on the SQL query statement output by the NL2SQL conversion module through the permission control module. Among them, the natural language parsing is performed through the NL2SQL capability of the large language model, as shown in the following figure. Figure 9As shown, when a user enters the natural language command "Searching for the top three towns and subdistricts with the most centenarians in Saihan District" and selects the Centenarian Information Ledger, the system first determines the jurisdictional authority based on the logged-in user. For example, if the logged-in user is a Saihan District administrator, they have permission to query data for Saihan District. The system encapsulates the query, the ledger information, and the jurisdictional authority control information "Region = Saihan District" and passes it to the big model for parsing. If the general NL2SQL technology is used, the big model extracts the key query conditions and generates the SQL statement: "select 'street', count(name) as number from 'Centenarian Information Ledger' group by 'street'". However, in this technical solution, the system adds data query filtering conditions to the SQL generated by the general NL2SQL technology based on the user's permission control information. The generated SQL is as follows: "select 'street', count(name) as number from 'Centenarian Information Ledger' where 'Region = Saihan District' group by 'street'". The specific method is to add business knowledge definitions to the big model for training. The example is as follows:
[0078] create table bslrxx (
[0080] sscs_cn varchar(255),
[0081] ssqx_cn varchar(255),
[0082] ssjd_cn varchar(255),
[0083] xm varchar(255),
[0084] … / / Other fields );
[0086] comment on table bslrxx is 'Information of centenarians';
[0087] comment on column bslrxx.sscs_cn is 'city';
[0088] comment on column bslrxx.ssqx_cn is 'district and county';
[0089] comment on column bslrxx.ssjd_cn is 'street';
[0090] comment on column bslrxx.xm is 'name';
[0091] … / / Other fields
[0092] -- Business knowledge
[0093] -- When selecting, you should determine the data row permissions and add the data permission information after the original query condition: where (#{original condition}) and (#{permission condition}). If the SQL does not have a query condition, add where #{permission condition}
[0094] If the system sets field permissions for users, such as Figure 10 As shown, the system extracts the query field information from the SQL and compares it with the user's authorized fields. If all fields are authorized, the query statement executes; otherwise, the system rejects the query and returns a corresponding prompt. For example, "Sorry, you do not have permission to access this data." In this scenario, the generated SQL is: "select street, count(name) as num from centenarian information ledger where region = Saihan District group by street." The system extracts the query field information from the SQL: street and name. It then compares the information with the user's authorized fields to determine whether the user has permission. Furthermore, the system can quickly extract the query fields by processing the generated SQL as follows: adding the table name before the original fields in the query table. An example is: select bslrxx.ssjd_cn, count(bslrxx.xm) as num from bslrxx where bslrxx.ssjd_cn = "Saihan District" group by bslrxx.ssjd_cn"; through regular matching #{table name}\.([a-zA-Z0-9_]+)(?=[\s,]), the table name bslrxx is put into the wildcard to obtain the regular expression bslrxx\.([a-zA-Z0-9_]+)(?=[\s,]). Through regular matching, the query fields of the bslrxx table in SQL are obtained: bslrxx.ssjd_cn, bslrxx.xm. Then the user's identity information corresponds to the authorized permission fields, such as sscs_cn, xm, ssjd_cn, ssqx_cn and other fields. By judging whether the query field name and the authorized field name are the same, it is determined whether the current user has the query permission for the current query field.
[0095] Furthermore, if the user has query permissions for all fields in the query field, the system can execute the query statement through the database query execution module to return the results and display the data through the display module. Otherwise, the system will refuse to execute the query statement and return the corresponding prompt message. For example: Sorry, you do not have permission to access this data, such as Figure 11 If the data permission check is passed, after the system executes the query statement, you can choose to display the data in various forms such as table, bar chart, line chart and pie chart, as shown below. Figure 12 、 13 , 14, and 15.
[0096] It can be seen that the present application can perform permission verification on the currently generated database query statement according to the permission level corresponding to the current user, and perform permission control on the database query statement that appears in the user's query process. By using NL2SQL technology, users can perform database queries through natural language without having to write complex SQL statements, thereby improving the convenience and efficiency of queries. Moreover, the conversational interaction mode of the business intelligence system allows users to interact in a more natural way, thereby improving the user experience. In this way, while ensuring the convenience of user queries, the user's query permissions can be strictly controlled to prevent users from unauthorized access to data, thereby improving the accuracy of permission verification and improving data security.
[0097] like Figure 16 As shown, the embodiment of the present application discloses a query authority verification device, which is applied to a business intelligence system, including:
[0098] The information conversion module 11 is used to obtain the natural language query information input by the current user and convert the query information into a database query statement based on a preset large language model;
[0099] The permission verification module 12 is used to perform permission verification on the database query statement according to the permission level corresponding to the current user and obtain a corresponding permission verification result;
[0100] An error information feedback module 13 is configured to feedback an error message indicating that the user has no permission when the permission check result indicates that the database query statement exceeds the permission level corresponding to the current user;
[0101] The query module 14 is configured to execute the database query statement to obtain a corresponding query result when the permission verification result indicates that the database query statement meets the permission level corresponding to the current user.
[0102] It can be seen from this that this application can perform permission verification on the currently generated database query statement based on the permission level corresponding to the current user, and perform permission control on the database query statements that appear during the user's query process. It can strictly control the user's query permissions while ensuring the convenience of user queries, prevent users from unauthorized access to data, and improve the accuracy of permission verification and the security of data.
[0103] In a specific embodiment, the information conversion module 11 may include:
[0104] An authority level determination unit is configured to obtain the identity information of the current user and determine the authority level corresponding to the current user based on a preset identity-authority correspondence relationship; the preset identity-authority correspondence relationship includes a correspondence relationship between several authority levels and the identity information of the user;
[0105] a prohibition unit, configured to prohibit the current user from using the business intelligence system when the authority level of the current user is lower than a first preset authority level;
[0106] The first information acquisition unit is configured to acquire the natural language query information input by the current user when the authority level of the current user is not less than the first preset authority level.
[0107] In another specific embodiment, the information conversion module 11 may include:
[0108] A second information acquisition unit is used to acquire first query information in natural language input by the current user;
[0109] A ledger information display submodule, configured to display the ledger information corresponding to the first query information through a preset interactive interface;
[0110] The third information acquisition unit is used to obtain the second query information input by the current user for the ledger information.
[0111] In another specific embodiment, the ledger information display submodule may include:
[0112] A ledger information determining unit, configured to determine all ledger information corresponding to the current user according to the authority level of the current user;
[0113] The ledger information display unit is used to query the target ledger information corresponding to the first query information from all the ledger information through a preset deep learning model, and display the target ledger information through a preset interactive interface.
[0114] In a specific embodiment, the information conversion module 11 may include:
[0115] An information conversion unit is used to convert the second query information for the ledger information into a corresponding database query statement based on a preset large language model.
[0116] In a specific embodiment, the permission verification module 12 may include:
[0117] A field extraction unit, configured to perform field extraction processing on the database query statement based on regular expression matching to obtain corresponding field information;
[0118] A field information determination unit, configured to determine whether the authorization field corresponding to the permission level corresponding to the current user contains all of the field information;
[0119] A first verification result generating unit is configured to generate a permission verification result indicating that the database query statement complies with the permission level corresponding to the current user when the authorization field contains all the field information;
[0120] The second verification result generating unit is configured to generate a permission verification result indicating that the database query statement exceeds the permission level corresponding to the current user when the authorization field does not contain all of the field information.
[0121] In a specific embodiment, the query module 14 may include:
[0122] A statement execution unit, configured to execute the database query statement and obtain corresponding query results;
[0123] The query result display unit is configured to obtain a display format selection instruction for the query result input by the current user, so as to display the query result in a target display format corresponding to the display format selection instruction.
[0124] Furthermore, the embodiment of the present application also discloses an electronic device, Figure 17 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram should not be considered as any limitation to the scope of application of the present application.
[0125] Figure 17 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps of the query authority verification method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0126] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device. The communication protocol it follows is any communication protocol that can be applied to the technical solution of this application and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world. Its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0127] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or CD, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0128] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, and can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of implementing the query authority verification method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program capable of implementing other specific tasks.
[0129] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the query permission verification method disclosed above is implemented. For the specific steps of this method, reference can be made to the corresponding content disclosed in the aforementioned embodiments and will not be repeated here.
[0130] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from the other embodiments. Reference can be made to the descriptions of the identical or similar parts between the various embodiments. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple, and the relevant parts can be referred to the descriptions of the methods.
[0131] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0132] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0133] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.
[0134] The above is a detailed introduction to the technical solution provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the ideas of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A query authority verification method, characterized in that: Applications in business intelligence systems include: Obtaining natural language query information input by the current user, and converting the query information into a database query statement based on a preset large language model; Performing permission verification on the database query statement according to the permission level corresponding to the current user to obtain a corresponding permission verification result; If the permission check result indicates that the database query statement exceeds the permission level corresponding to the current user, an error message indicating that the user has no permission is fed back; If the permission check result indicates that the database query statement meets the permission level corresponding to the current user, executing the database query statement to obtain a corresponding query result; The step of obtaining the natural language query information currently input by the user includes: Obtaining the first query information in natural language input by the current user; Displaying the ledger information corresponding to the first query information through a preset interactive interface, and obtaining the second query information for the ledger information input by the current user; The displaying of the ledger information corresponding to the first query information through a preset interactive interface includes: Determine all ledger information corresponding to the current user according to the authority level of the current user; Obtain target ledger information corresponding to the first query information from all ledger information using a preset deep learning model, and display the target ledger information through a preset interactive interface; The step of converting the query information into a database query statement based on a preset large language model includes: Based on the preset large language model, the second query information for the ledger information is converted into a corresponding database query statement.
2. The query authority verification method according to claim 1, characterized in that: The step of obtaining the natural language query information currently input by the user includes: Obtaining the identity information of the current user, and determining the permission level corresponding to the current user based on a preset identity-permission correspondence relationship; the preset identity-permission correspondence relationship includes a correspondence between several permission levels and the user's identity information; If the authority level of the current user is lower than the first preset authority level, prohibiting the current user from using the business intelligence system; If the authority level of the current user is not less than the first preset authority level, the natural language query information input by the current user is obtained.
3. The query authority verification method according to claim 1, characterized in that: The performing permission verification on the database query statement according to the permission level corresponding to the current user to obtain a corresponding permission verification result includes: Perform field extraction processing on the database query statement based on regular matching to obtain corresponding field information; Determine whether the authorization field corresponding to the permission level corresponding to the current user contains all the field information; If the authorization field contains all the field information, generating a permission verification result indicating that the database query statement complies with the permission level corresponding to the current user; If the authorization field does not include all of the field information, a permission verification result is generated indicating that the database query statement exceeds the permission level corresponding to the current user.
4. The query authority verification method according to any one of claims 1 to 3, characterized in that: The executing the database query statement to obtain the corresponding query result includes: Execute the database query statement to obtain corresponding query results; A display format selection instruction for the query result input by the current user is obtained, so as to display the query result in a target display format corresponding to the display format selection instruction.
5. A query authority verification device, characterized in that: Applications in business intelligence systems include: An information conversion module is used to obtain the natural language query information input by the current user and convert the query information into a database query statement based on a preset large language model; The permission verification module is used to perform permission verification on the database query statement according to the permission level corresponding to the current user and obtain a corresponding permission verification result; An error information feedback module is used to feedback an error message indicating that the user has no permission when the permission check result indicates that the database query statement exceeds the permission level corresponding to the current user; a query module, configured to execute the database query statement to obtain a corresponding query result when the permission check result indicates that the database query statement meets the permission level corresponding to the current user; Wherein, the information conversion module includes: A second information acquisition unit is used to acquire first query information in natural language input by the current user; A ledger information display submodule, configured to display the ledger information corresponding to the first query information through a preset interactive interface; A third information acquisition unit is used to acquire second query information input by the current user for the ledger information; The ledger information display submodule includes: A ledger information determining unit, configured to determine all ledger information corresponding to the current user according to the authority level of the current user; A ledger information display unit, configured to query the entire ledger information using a preset deep learning model to obtain target ledger information corresponding to the first query information, and to display the target ledger information through a preset interactive interface; Wherein, the information conversion module includes: An information conversion unit is used to convert the second query information for the ledger information into a corresponding database query statement based on a preset large language model.
6. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the query authority verification method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that Used to store a computer program, which, when executed by a processor, implements the query authority verification method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Data query control method, storage medium, equipment and system
CN110555039A
Data query method and device based on relational database, medium and product
CN114138817A