Query permission verification method and device, equipment and storage medium
By obtaining user permission levels in NL2SQL and large-model conversational business intelligence systems, and performing permission verification on natural language queries, the problem of users' unauthorized access to data is solved, and data security and query convenience are improved.
Patent Information
- Application Number
- CN202411069055.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-08-06
AI Technical Summary
In existing natural language to structured query language (NL2SQL) and large-model conversational business intelligence systems, user access permission control is not strict enough, and there is a risk of unauthorized access to data.
By obtaining the permission level of the current user, perform permission verification on the natural language query information input by the user, use a large language model to convert the query information into a database query statement, and execute or deny query operations based on user permissions to prevent unauthorized access.
It effectively improves the security of data and the accuracy of permission verification, prevents users from accessing data without permission, and maintains the convenience of user queries.
Smart Images

Figure CN118643536A
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 technology, the Natural Language to Structured Query Language (NL2SQL) technology enables users to query databases by asking questions in natural language, greatly improving the convenience and efficiency of queries. At the same time, the large-model conversational BI (Business Intelligence) system integrates advanced artificial intelligence models, allowing users to interact with the system in natural language to obtain the required business intelligence information.
[0003] However, in the commonly used NL2SQL and large-model conversational BI systems, the control over user access rights is often not strict enough, 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 according to the permission level corresponding to the current user, strictly control the user's query permission and improve the security of data. The specific scheme is as follows:
[0006] In a first aspect, the present application provides a query authority verification method, which is applied to a business intelligence system, comprising:
[0007] 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;
[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] Acquire 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;
[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 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 account 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 by querying 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 of the field information, then 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 a corresponding query result 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, including:
[0032] An information conversion module, 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, used to feedback error information 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 used 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.
[0036] In a third aspect, the present application provides an electronic device, including:
[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, when executed by a processor, implements the query authority verification method as described above.
[0040] It can be seen that the business intelligence system in this application can obtain the query information of the natural language input by the current user, and convert the query information into a database query statement based on the preset large language model; then perform permission check on the database query statement according to the permission level corresponding to the current user to obtain the corresponding permission check 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 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, the database query statement is executed to obtain the corresponding query result. In this way, the present application can perform permission check 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 query, prevent users from unauthorized access to data, and improve the accuracy of permission check and 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 drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying 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 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 of displaying 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 A schematic diagram of selecting ledger information disclosed in this application;
[0050] Fig. 9 A natural language parsing flow chart disclosed in this application;
[0051] Fig.10 A schematic diagram of the authorization field corresponding to a user disclosed in this application;
[0052] Fig.11 A schematic diagram of a prompt message of unauthorized access disclosed in this application;
[0053] Fig.12 A schematic diagram showing a query result table disclosed in this application;
[0054] Fig.13 A schematic diagram showing a line graph of a query result disclosed in this application;
[0055] Fig.14 A schematic diagram of a bar chart display of query results disclosed in this application;
[0056] Fig.15 A schematic diagram showing a pie chart of query results disclosed in this application;
[0057] Fig.16 This is a schematic diagram of the structure of a query authority verification device disclosed in this application;
[0058] Fig.17 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0059] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. 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 creative work 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, which is applied to a business intelligence system, including:
[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 through a preset large language model; the large language model can realize accurate conversion between natural language and SQL (Structured Query Language) statements. It can be understood that before using the business intelligence system, the user needs to perform identity authentication and confirm the authority level of the corresponding identity; in a specific embodiment, the acquisition of the natural language query information input by the current user can include: acquiring the identity information of the current user, and determining 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 between several authority levels and the identity information of the user; if the authority level of the current user is less than the first preset authority level, the current user is prohibited 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 acquired. 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 represents 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 the target ledger information corresponding to the first query information from all the ledger information through a preset deep learning model, and displaying the target ledger information through a preset interactive interface. Specifically, the ledger information that can be used for display can also correspond to the permission level. A higher level of permission can contain more ledger information that can be used for display than a lower level of permission. The business intelligence system can determine all the corresponding ledger information that can be used for display according to the permission level of the current user, and then use the deep learning model to query the target ledger information that matches the first query information of the current user from all the ledger information, and then display the queried target ledger information through a preset interactive interface. It should be pointed out 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, the converting the query information into a database query statement based on a preset large language model may include: converting the second query information for the ledger information into a corresponding database query statement based on the preset large language model. Specifically, after the user inputs the second query information for the ledger information, the natural language parsing of the second query information is performed through the NL2SQL capability of the preset large language model, and the second query information may be converted into a corresponding database query statement.
[0065] Step S12: 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.
[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 a permission check 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 check result.
[0067] In a specific implementation, the permission check of the database query statement according to the permission level corresponding to the current user to obtain the corresponding permission check result may include: performing field extraction processing on the database query statement based on regular matching to obtain corresponding field information; judging 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, then generating a permission check result indicating that the database query statement meets the permission level corresponding to the current user; if the authorization field does not contain all the field information, then generating a permission check 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 by regular matching. For example, the system puts the table name bslrxx into a wildcard to obtain a regular expression by regular matching. 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 the data.
[0070] Step S14: If the authority verification result indicates that the database query statement meets the authority 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 checked for permissions, and the data in the query result that exceeds the user's permissions is fuzzy processed 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 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 in 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 are fields in the field information of the database query statement that are 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, the user's query permission can be strictly controlled while ensuring the convenience of user query, preventing users from unauthorized access to data, and improving the accuracy of permission verification and data security.
[0074] like Figure 2 As shown, the embodiment of the present application discloses a query authority verification method, which is 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 for authentication, in order to comprehensively improve the user's operation convenience, the intelligent ledger retrieval provides a hovering 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 Question" link, the conversational interface will be displayed. Figure 4 As shown in the figure, the user inputs the 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 combines 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 in combination with 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, the user 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, such as Fig. 9As shown, when the user enters the natural language command "the top three streets and towns with the most centenarians in Saihan District" and selects the centenarian information ledger, the system first determines the jurisdiction authority based on the logged-in user. For example: the logged-in user is a manager of Saihan District, and the user has the authority to query data in Saihan District. The system encapsulates the problem, ledger information, and jurisdiction authority control information "Area = Saihan District" and passes them to the big model for parsing. If it is the general NL2SQL technology, the big model extracts the key query conditions and generates an SQL statement: "select the street, count (name) as quantity from the centenarian information ledger group by the street". In this technical solution, the system will add data query filtering conditions to the SQL generated by the general NL2SQL technology based on the user authority control information. The generated SQL is as follows: "select the street, count (name) as quantity from the centenarian information ledger where the area = Saihan District group by the 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 about 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 where (#{original condition}) and (#{permission condition}) after the original query condition. If the SQL has no query condition, add where #{permission condition}
[0094] If the system sets field permissions for users, such as Fig.10 As shown, the system will extract the query field information from the SQL and compare it with the user's authorized fields. If all fields are authorized, the query statement will be executed, otherwise the system will refuse to execute the query statement and return the corresponding prompt information. For example: Sorry, you do not have permission to access this data. Taking this scenario as an example, the generated SQL is: "select street, count (name) as quantity from centenarian information ledger where region = Saihan District group by street". The system extracts the query field information from the SQL: street, name. And compare it with the fields allowed to be accessed by the user to determine whether there is permission. Further, the system can quickly extract the query field in the following way; process the generated SQL as follows, and add the table name before the original field of the query table. The example is as follows: 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,]), put the table name bslrxx into the wildcard to get 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 judged whether the current user has the current query field query permission.
[0095] Furthermore, if the user has the query permission for all fields in the query field, the system can execute the query statement through the database query execution module to return the result, 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 the permission to access the data, such as Fig.11 If the data permission check passes, 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. Fig.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 through the permission level corresponding to the current user, and perform permission control on the database query statement appearing in the user's query process. By using the NL2SQL technology, users can perform database queries through natural language without writing 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 the security of data.
[0097] like Fig.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 used to feedback error information indicating that the user has no authority when the authority verification result indicates that the database query statement exceeds the authority 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 the present application can perform permission verification on the currently generated database query statement through the permission level corresponding to the current user, and perform permission control on the database query statement that appears during the user's query process. It can strictly control the user's query permission while ensuring the convenience of the user's query, prevent the user from unauthorized access to data, and improve the accuracy of permission verification and the security of the data.
[0103] In a specific embodiment, the information conversion module 11 may include:
[0104] The authority level determination unit is used 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 less than a first preset authority level;
[0106] The first information acquisition unit is used 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, used to acquire first query information in natural language currently input by the user;
[0109] A ledger information display submodule, used 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 determination unit, used 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, used to perform field extraction processing on the database query statement based on regular matching to obtain corresponding field information;
[0118] A field information determination unit, used to determine whether the authorization field corresponding to the authority level corresponding to the current user contains all the field information;
[0119] A first verification result generating unit, 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 used 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, used to execute the database query statement and obtain corresponding query results;
[0123] The query result display unit is used to obtain the display form selection instruction for the query result input by the current user, so as to display the query result in a target display form corresponding to the display form selection instruction.
[0124] Furthermore, the present application also discloses an electronic device. Fig.17 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0125] Fig.17 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 in 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 working 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, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present 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, and 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 storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, 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 programs 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete 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 that can be used to complete 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 authority verification method disclosed above is implemented. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the above embodiments, and no further description will be given here.
[0130] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[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 composition and steps of each example have been generally described in the above description according to function. 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 to be beyond the scope of this application.
[0132] The steps of the method or algorithm 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 a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, 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 article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0134] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article 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 general technicians in this field, according to the idea of the present application, there will 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, including: 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; 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, the database query statement is executed to obtain a corresponding query result.
2. The query authority verification method according to claim 1, characterized in that: The obtaining of natural language query information currently input by the user includes: Acquire 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 a plurality of authority levels and the identity information of the user; 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 2, characterized in that: The obtaining of natural language query information currently input by the user includes: Obtaining first query information in natural language input by the current user; 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.
4. The query authority verification method according to claim 3 is characterized in that: The displaying of the ledger information corresponding to the first query information through a preset interactive interface includes: Determine all account information corresponding to the current user according to the authority level of the current user; The target ledger information corresponding to the first query information is obtained by querying from all the ledger information through a preset deep learning model, and the target ledger information is displayed through a preset interactive interface.
5. The query authority verification method according to claim 3, characterized in that: The 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.
6. 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 of the field information, then 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.
7. The query authority verification method according to any one of claims 1 to 6, 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.
8. A query authority verification device, characterized in that: Applications in business intelligence systems, including: An information conversion module, 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, used to feedback error information 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; The query module is used 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.
9. 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 as described in any one of claims 1 to 7.
10. 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 as described in any one of claims 1 to 7.
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
Structured query statement detection method and device, equipment and medium
CN117216095A
NLP workspace collaborations
US20210064775A1
Cited By
Bridge design method, device, equipment and medium
CN118821297A
A bridge design method, device, equipment and medium
CN118821297B
Database authority control method
CN119227140A
Risk query method and device based on large model, medium and equipment
CN119621759A
Natural language data operation method and device for enterprise information system
CN122196012A
