CROSS-REFERENCE TO RELATED APPLICATIONS

The present application is the U.S. national stage of International Patent Application No. PCT/CN2017/104532, filed on Sep. 29, 2017, which claims the benefit of priority of Chinese Patent Application No. 201710707849.6, entitled “USER PERMISSION DATA QUERY METHOD AND TERMINAL DEVICE”, filed with State Intellectual Property Office on Aug. 17, 2017. The content of the foregoing applications is incorporated herein by reference in its entirety.

TECHNICAL FIELD

The present application relates to the technical field of data management, and particularly, to a method and a device for user permission data query, an electronic device and a medium.

BACKGROUND

In order to enable different users of a human resources system to have different information administration authority, in a database called by the human resources system, a plurality of data tables such as a user table, a role table, and a role permission table are usually established in advance. When a user issues an information management request in the human resource system, such as a staff information query request, the database needs to crawl, from the associated multiple data tables, each department and each staff searchable by the user in the permission range in real time in a mode of traversing a tree recursively. Specifically, the role permission table stores the correspondence relationship among roles and management departments, and since there may be a plurality of subordinate departments under one management department, the same role will exist in a plurality of data records in the role permission table. If the user needs to query staff information of multiple departments, the role of the user needs to be determined first in the role table. Then, in the role permission table, each management department corresponding to this role, including subordinate departments, needs to be found in each data record in real time. For each of these departments, staffs belonging to the department are also screened one by one in the user table to determine the staffs who are screened as staffs whose personal information can be viewed by the user.

However, as the scale of an enterprise continues to expand, if the human resource system needs to manage the information of tens of thousands of staffs, and the users of the system need to have personal information administration authority, the amount of data in the above multiple data tables will be very large. For example, although different users have different roles, different roles are often set with the same department administration authority, so there will be multiple repeatedly set permission data in the data tables. In addition, in the case that multiple users with the same permission issue a data query request, every time it is necessary to recursively traverse the tree again to determine the users' administration authority in real time, that is, every time it is necessary to repeatedly traverse each data table with a large amount of data. Therefore, the existing database and human resource system are faced with more serious performance problems, thereby making the query efficiency of the user permission data relatively low.

SUMMARY

In view of this, an embodiment of the present application provides a user permission data query method and device, an electronic device and a medium, which aims at solving the problem in the related art that performances of database and system are poor and permission data query efficiency is low due to excessive staff information.

A first aspect of an embodiment of the present application provides a user permission data query method which includes:

obtaining a first data table including staff identification numbers and departments corresponding to the staff identification numbers, and obtaining a second data table including a correspondence relationship among the staff identification numbers, roles, and administration authority information, where the administration authority information includes management departments;

obtaining, from the second data table, a plurality of data records having the same staff identification number and the same role, processing the administration authority information in the plurality of data records by using a preset algorithm to obtain an MD5 value, and storing the correspondence relationship among the staff identification number, the role, and the MD5 value in a third data table;

screening and obtaining various MD5 values that are different from each other, and obtaining management departments and management staffs respectively corresponding to the screened various MD5 values based on the first data table, the second data table, and the third data table;

obtaining an MD5 value corresponding to the permission query request when a permission query request based on any user is received;

searching for the management departments and the management staffs corresponding to the MD5 value of the permission query request from the management departments and the management staffs respectively corresponding to the screened various MD5 values to determine the search result as permission data of the user.

A second aspect of an embodiment of the present application provides a user permission data query device which includes:

a first obtaining module configured to obtain a first data table including staff identification numbers and departments corresponding to the staff identification numbers, and obtain a second data table including a correspondence relationship among the staff identification numbers, roles, and administration authority information, where the administration authority information includes management departments;

a calculation module configured to obtain, in the second data table, a plurality of data records having the same staff identification number and the same role, process the administration authority information in the plurality of data records by using a preset algorithm to obtain an MD5 value, and store the correspondence relationship among the staff identification number, the role, and the MD5 value in a third data table;

a screening module configured to screen and obtain various MD5 values that are different from each other, and obtain the management departments and the management staffs respectively corresponding to the screened various MD5 values based on the first data table, the second data table, and the third data table;

a second obtaining module configured to obtain an MD5 value corresponding to a permission query request, when the permission query request based on any user is received; and

a search module configured to search for the management departments and the management staffs corresponding to the MD5 value of the permission query request from the management departments and the management staffs respectively corresponding to the screened various MD5 values to determine the search result as permission data of the user.

A third aspect of an embodiment of the present application provides an electronic device including a memory and a processor, where the memory stores a computer readable instruction executable on the processor, and when the computer readable instruction is executed by the processor, the steps of the user permission data query method as provided by the aforementioned first aspect are implemented.

A fourth aspect of an embodiment of the present application provides a computer readable storage medium which stores a computer readable instruction, and when the computer readable instruction is executed by at least one processor, the steps of the user permission data query method as described in the aforementioned first aspect are implemented.

In an embodiment of the present application, MD5 values corresponding to each staff identification number and its role are calculated by using administration authority information in a plurality of data records having the same staff identification number and the same role, an MD5 value that is not repeated therein is screened, and management departments and management staffs corresponding to the screened MD5 value are obtained in advance, so that when a permission query request is received, management departments and management staffs based on a tree data structure are quickly obtained from administration authority data corresponding to the MD5 value having a unique permission identifier and having a small data size, with no need to consume more system resources to repeatedly crawl permission data in a plurality of associated data tables, thus greatly improving the performance of the system and improving the permission data query efficiency.

