Single-library multi-tenant implementation method and device for application service, equipment and medium
By creating a shared database in the database management system and using sectional technology to intercept SQL requests, obtaining the tenant identity for assembly, the resource waste and complex operation and maintenance problems in the multi-store multi-tenant mode are solved, and data isolation and rapid expansion of single-store multi-tenant is realized, saving hardware costs and improving maintenance efficiency.
Patent Information
- Application Number
- CN202510504577.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-07-18
AI Technical Summary
Under the existing multi-store and multi-tenant model, resource waste is severe and subsequent operation and maintenance is complex, making it difficult to achieve data isolation and rapid transformation of tenant dimensions at the single database instance level.
Create a shared database in the database management system, use facet technology to intercept SQL requests, obtain tenant identity and assemble it, and store it in new fields of the shared database to achieve tenant isolation.
The data isolation and dynamic switching of single-base multi-tenant subjects are realized, saving hardware resource costs and improving maintenance efficiency.
Smart Images

Figure CN120336357A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical fields of databases, healthcare, and fintech, and particularly to a method, apparatus, device, and medium for implementing single-database multi-tenancy for application services. Background Art
[0002] With the development of computer and information technologies, application platforms can provide application services such as address book management, instant messaging, customer relationship management, file sharing, marketing planning, and enterprise risk control. Through various application services on the application platform, users can integrate digital office and customer management, thereby improving work efficiency.
[0003] Currently, application services support multi-tenancy through multiple databases. For each new tenant, a new set of database instance resources is applied for, such as DB (Database Instance) resources of MySQL (an open-source relational database management system), etc. In actual business expansion, the business volume of some tenant entities about to access the application service is not large. For example, the customer scale of a certain tenant entity is 20,000. Applying for a new set of database instance resources alone results in waste of resources and increases the subsequent maintenance cost and complexity at the database instance level, such as table structure changes, etc. Synchronous changes need to be made to multiple sets of database instances corresponding to all tenant entities. Once omitted, it will cause serious production line problems.
[0004] For example, in the health check-up scenario in the medical field, tenant entity a enterprise conducts customer relationship management through the application service, and its customer scale is 5,000. If a new set of database instance resources is applied for tenant entity a alone, there will be a waste of resources, and subsequent operation and maintenance are also more complex.
[0005] Again, in the insurance business scenario in the financial field, tenant entity b enterprise conducts marketing planning and executes marketing plans through the application service, and its customer scale is 1,000. If a new set of database instance resources is applied for tenant entity b alone, there will also be a waste of resources, and subsequent operation and maintenance are also more complex.
[0006] In summary, in the existing multi-database multi-tenancy mode, how to achieve data isolation at the tenant dimension at the single-database instance level with less cost and quickly complete the transformation of single-database multi-tenancy has become an urgent technical problem to be solved. Summary of the Invention
[0007] This application provides a method, apparatus, device, and medium for implementing single-database multi-tenancy for application services to solve the technical problems of resource waste and complex subsequent operation and maintenance existing in the existing multi-database multi-tenancy mode.
[0008] In a first aspect, a method for implementing single-database multi-tenant for application services is provided, including:
[0009] Create a shared database in the database management system to provide data services for multiple tenants;
[0010] When an SQL request is received, use aspect technology to intercept the SQL request and obtain the identity identifier assigned to the current tenant during application service registration;
[0011] Use the identity identifier of the current tenant to assemble with the SQL request to obtain an assembled SQL request;
[0012] Receive and execute the assembled SQL request in the shared database, and store the identity identifier of the current tenant in the assembled SQL request in a new field of the shared database for distinguishing tenant entities.
[0013] In a second aspect, an apparatus for implementing single-database multi-tenant for application services is provided, including:
[0014] A creation unit for creating a shared database in the database management system to provide data services for multiple tenants;
[0015] An interception unit for intercepting the SQL request using aspect technology when an SQL request is received and obtaining the identity identifier assigned to the current tenant during application service registration;
[0016] An assembly unit for assembling the SQL request with the identity identifier of the current tenant to obtain an assembled SQL request;
[0017] A storage unit for receiving and executing the assembled SQL request in the shared database and storing the identity identifier of the current tenant in the assembled SQL request in a new field of the shared database for distinguishing tenant entities.
[0018] In a third aspect, a computer device is provided. The computer device includes a processor and a memory. Among them, a computer program is stored in the memory, and the processor is configured to run the computer program to execute the method for implementing single-database multi-tenant for application services described in any one of the above.
[0019] In a fourth aspect, a storage medium is provided. The storage medium stores a computer program. Among them, the computer program is configured to execute the method for implementing single-database multi-tenant for application services described in any one of the above when running.
[0020] With the above technical solution, the method, apparatus, device, and medium for implementing single-database multi-tenant for application services provided by the embodiments of the present application create a shared database in the database management system to provide data services for multiple tenants; when receiving an SQL request, use aspect technology to intercept the SQL request, and obtain the identity identifier assigned to the current tenant when registering for the application service; use the identity identifier of the current tenant to assemble with the SQL request to obtain the assembled SQL request; receive and execute the assembled SQL request in the shared database, and store the identity identifier of the current tenant in the assembled SQL request in a new field of the shared database for distinguishing tenant entities. It can be seen that this embodiment uses aspect technology to intercept the SQL request and uses the identity identifier of the current tenant to assemble with the SQL request, realizing data isolation and dynamic switching of single-database multi-tenant entities, facilitating the subsequent rapid access of lightweight services, achieving support for single-database multi-tenant expansion, saving the cost of hardware resources; and during subsequent maintenance, perform maintenance changes on a single set of shared database instances for multiple tenants, improving the maintenance efficiency. Brief Description of the Drawings
[0021] To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for describing the embodiments of the present application will be briefly introduced below.
[0022] Figure 1 Shows a schematic diagram of the application environment of the method for implementing single-database multi-tenant for application services provided by the embodiments of the present application;
[0023] Figure 2 Shows a flowchart of the method for implementing single-database multi-tenant for application services provided by the embodiments of the present application;
[0024] Figure 3 Shows a flowchart of SQL request processing provided by the embodiments of the present application;
[0025] Figure 4 Shows a structural diagram of the apparatus for implementing single-database multi-tenant for application services provided by the embodiments of the present application;
[0026] Figure 5 Shows a structural diagram of a computer device provided by the embodiments of the present application. Detailed Description of the Embodiments
[0027] The exemplary embodiments of the present application will be described in more detail below with reference to the drawings. Although the exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided so that the present application can be more thoroughly understood and the scope of the present application can be fully conveyed to those skilled in the art.
[0028] It should be noted that the terms "first", "second", etc. in the specification, claims and above-mentioned drawings of this application are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that such use can be interchanged under appropriate circumstances, so that the embodiments of this application described here can be implemented in an order other than those illustrated or described here. In addition, the term "comprising" and its variants should be interpreted as open-ended terms meaning "including but not limited to".
[0029] The implementation method for single-database multi-tenant for application services provided by the embodiments of this application can be applied in an application environment such as Figure 1 where the client communicates with the server through the network. The client can send an SQL request to the server; the server creates a shared database in the database management system to provide data services for multiple tenants. When the server receives the SQL request from the client, it uses aspect technology to intercept the SQL request, obtains the identity identifier assigned to the current tenant when registering for the application service; assembles the SQL request with the identity identifier of the current tenant to obtain the assembled SQL request; receives and executes the assembled SQL request in the shared database, and stores the identity identifier of the current tenant in the assembled SQL request in a new field in the shared database for distinguishing tenant entities. It can be seen that this embodiment uses aspect technology to intercept the SQL request and assembles the SQL request with the identity identifier of the current tenant, realizing data isolation and dynamic switching of single-database multi-tenant entities, facilitating the rapid access of subsequent lightweight services, realizing the expansion support of single-database multi-tenant, and saving the cost of hardware resources; and in subsequent maintenance, maintenance changes are made to a single set of shared database instances for multiple tenants, improving the maintenance efficiency. Among them, the client can be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of multiple servers. The following describes this application in detail through specific embodiments.
[0030] Please refer to Figure 2 as shown in Figure 2 which is a flowchart of the implementation method for single-database multi-tenant for application services provided by the embodiments of this application, including the following steps S201 to S204:
[0031] Step S201, create a shared database in the database management system to provide data services for multiple tenants.
[0032] In this step, the database management system can be, for example, MySQL, Redis (Remote Dictionary Service, an open-source in-memory database), etc., and this embodiment does not limit this.
[0033] Step S202: When an SQL request is received, use aspect technology to intercept the SQL request and obtain the identity identifier assigned to the current tenant during application service registration.
[0034] In this step, aspect technology is used to intercept SQL (Structured Query Language) requests. Here, aspect technology is to weave additional logic (such as SQL interception) into specific positions of the target method at runtime or compile time through dynamic proxy or bytecode enhancement technology, without modifying the original code. Specifically, all methods involving database operations can be matched through expressions, and then the preset interception method is used to execute, obtain SQL information and record or monitor.
[0035] For example, in the scenario of health check-ups in the medical field, tenant entity a enterprise needs to store the information of customers who come to the store for physical examinations on the same day. At this time, the client generates an SQL request to insert customer information. When the server receives the SQL request, it uses aspect technology to intercept the SQL request and obtain the identity identifier assigned to the current tenant during application service registration. After several days, when the customer needs to check the new physical examination results, the client generates an SQL request to query customer information. When the server receives the SQL request, it uses aspect technology to intercept the SQL request and obtain the identity identifier assigned to the current tenant during application service registration.
[0036] Another example is in the scenario of insurance business in the financial field. Tenant entity b enterprise needs to store the information of customers who enjoy the marketing plan this month. At this time, the client generates an SQL request to insert customer information. When the server receives the SQL request, it uses aspect technology to intercept the SQL request and obtain the identity identifier assigned to the current tenant during application service registration.
[0037] Step S203: Assemble the identity identifier of the current tenant with the SQL request to obtain the assembled SQL request.
[0038] Step S204: Receive and execute the assembled SQL request in the shared database, and store the identity identifier of the current tenant in the assembled SQL request in the new field of the shared database for distinguishing tenant entities.
[0039] In this embodiment, aspect technology is used to intercept SQL requests, and the identity identifier of the current tenant is used to assemble with the SQL request, realizing data isolation and dynamic switching of multiple tenant entities in a single database, facilitating the rapid access of subsequent lightweight services, achieving the expansion support of multiple tenant entities in a single database, saving hardware resource costs; and during subsequent maintenance, maintenance changes are made to a single set of shared database instances for multiple tenants, improving the maintenance efficiency.
[0040] In an embodiment of the present application, a possible implementation is provided. If the SQL request is a request for inserting information, in the above step S203, the identity identifier of the current tenant is used to assemble with the SQL request to obtain the assembled SQL request, which may specifically include the following steps A1:
[0041] Step A1: In the request for inserting information, add a preset field to each table, and assign the identity identifier of the current tenant to the preset field.
[0042] In this embodiment, in the request for inserting information, a preset field is added to each table, and the identity identifier of the current tenant is assigned to the preset field, which facilitates receiving and executing the assembled SQL request in the shared database subsequently.
[0043] In an embodiment of the present application, a possible implementation is provided. If the SQL request is a request for updating information, in the above step S203, the identity identifier of the current tenant is used to assemble with the SQL request to obtain the assembled SQL request, which may specifically include the following steps A2:
[0044] Step A2: In the request for updating information, add a preset field to the where condition, and assign the identity identifier of the current tenant to the preset field.
[0045] In SQL, the where condition is the core clause for filtering data. Its function is to retrieve, update, or delete records that meet specific conditions from a database table. It filters out target data rows by specifying a boolean expression (such as comparison operations, logical combinations, etc.), and is a key tool for achieving precise data operations in SQL queries.
[0046] In this embodiment, in the request for updating information, a preset field is added to the where condition, and the identity identifier of the current tenant is assigned to the preset field, which facilitates receiving and executing the assembled SQL request in the shared database subsequently.
[0047] In an embodiment of the present application, a possible implementation is provided. If the SQL request is a request for querying information, in the above step S203, the identity identifier of the current tenant is used to assemble with the SQL request to obtain the assembled SQL request, which may specifically include the following steps A3:
[0048] Step A3: In the request for querying information, add a preset field to the where condition, and assign the identity identifier of the current tenant to the preset field.
[0049] In this embodiment, in the request for querying information, a preset field is added to the where condition, and the identity of the current tenant is assigned to the preset field, so that it is convenient to receive and execute the assembled SQL request in the shared database later.
[0050] Figure 3 The SQL request processing flow chart provided in the embodiment of the present application is shown, and operations such as insert, update, and select can be performed on employee information, customer information, customer group information, material information, and other information. The client generates an SQL request, and when the server receives the SQL request from the client, it intercepts the SQL request using aspect technology to obtain the identity identifier assigned to the current tenant when the application service is registered; the identity identifier of the current tenant is used to assemble the SQL request to obtain the assembled SQL request; the assembled SQL request is received and executed in a shared database, and the identity identifier of the current tenant in the assembled SQL request is stored in a newly added field of the shared database for distinguishing the tenant subject.
[0051] exist Figure 3 In the example, the client's SQL request is:
[0052] insert into t_scrm_customer(id,external_user_id,customer_name)
[0053] values(1,'wxavcfggfrderdfc','喜闻乐见');
[0054] update t_scrm_customer set customer_name='test name modification' where id=1and external_user_id='wxavcfggfrderdfc';
[0055] select from t_scrm_customer where customer_name like '%Name%'.
[0056] Use the current tenant's identity to assemble the SQL request. The assembled SQL request is:
[0057] insert into t_scrm_customer(id,external_user_id,customer_name,corp_id)
[0058] values(1,’wxavcfggfrderdfc’,’Well-known and popular’,’ww6b82f72c62ef747d’);
[0059] update t_scrm_customer set customer_name=’test Name modification’where id=1and external_user_id=’wxavcfggfrderdfc’and corp_id=’ww6b82f72c62ef747d’;
[0060] select from t_scrm_customer where customer_name like’%Name%’andcorp_id=’ww6b82f72c62ef747d’.
[0061] It can be seen that the identity identifier of the current tenant is added to the assembled SQL request, that is, the identity identifier ’ww6b82f72c62ef747d’ of the current tenant is stored through the preset field corp_id.
[0062] In an embodiment of the present application, a possible implementation manner is provided. In the above step S202, the identity identifier assigned to the current tenant during application service registration is obtained. Specifically, it may be to obtain the thread where the SQL request is located, and extract the identity identifier assigned to the current tenant during application service registration from the thread where the SQL request is located.
[0063] In this embodiment, the identity identifier transmission mechanism based on thread binding can run through the entire request life cycle, from the API (Application Programming Interface) gateway to the business logic layer, and then to the data persistence layer. Each component can obtain tenant information through the thread context, avoiding the code coupling problem caused by parameter passing through.
[0064] In an embodiment of the present application, a possible implementation manner is provided. In the above step S204, the identity identifier of the current tenant in the assembled SQL request is stored in the newly added field for distinguishing tenant entities in the shared database. Specifically, it may include the following steps B1 and B2:
[0065] Step B1, create a newly added field in the shared database for distinguishing tenant entities;
[0066] Step B2, store the identity identifier of the current tenant in the assembled SQL request in the newly added field.
[0067] In this embodiment, logical isolation of tenant data in the shared database is achieved by adding new fields, ensuring that each SQL operation carries a tenant identifier. This mechanism enables the data of different tenants to be distinguished at the field level in a physically shared database, retaining the resource-intensive advantage of the shared database while achieving data boundary division through the tenant identifier field. Moreover, the operation of automatically injecting the tenant identifier field avoids the repetitive labor of developers manually writing tenant filtering conditions.
[0068] In an embodiment of this application, a possible implementation is provided. Before assembling the identity identifier of the current tenant with the SQL request in step S203 above to obtain the assembled SQL request, the following step C may also be included:
[0069] Step C: According to the identity identifier of the current tenant, determine whether the current tenant has the permission to access the shared database. If so, assemble the identity identifier of the current tenant with the SQL request to obtain the assembled SQL request.
[0070] This embodiment completes the verification of tenant permissions before the SQL request is executed, ensuring that only authorized tenants can perform subsequent operations. This pre-check avoids invalid requests from entering the database execution stage, reducing system resource waste and security risks.
[0071] In a specific application, tenants such as Wanlitong Tenant, Lu Jin Suo Tenant, and Ping An Pay E-Tenant need to access the application service. At this time, database instance resources can be allocated according to the business volume of each tenant. If the business volume of a tenant is greater than or equal to a preset threshold, independent database instance resources are allocated; if the business volume of a tenant is less than the preset threshold, the single-database multi-tenant mode is adopted, and specifically, steps S201 to S204 provided in the previous embodiment can be used to implement it. The preset threshold here can be determined according to the actual situation, such as the preset threshold is 100,000, etc., and this embodiment does not limit this.
[0072] It should be noted that the magnitudes of the sequence numbers of the above steps in the embodiments do not mean the order of execution. The order of execution of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of this application. In practical applications, all the above possible implementation manners can be combined arbitrarily to form possible embodiments of this application, which will not be elaborated here one by one.
[0073] Based on the implementation method of single-database multi-tenant for application services provided in the above embodiments, based on the same inventive concept, an embodiment of this application also provides an implementation device for single-database multi-tenant for application services.
[0074] Figure 4It is a structural diagram of an implementation device for single-database multi-tenant of application services provided by an embodiment of the present application. As Figure 4 shown, the implementation device for single-database multi-tenant of application services may specifically include a creation unit 410, an interception unit 420, an assembly unit 430, and a storage unit 440.
[0075] The creation unit 410 is used to create a shared database in the database management system to provide data services for multiple tenants;
[0076] The interception unit 420 is used to intercept the SQL request by using aspect technology when receiving the SQL request, and obtain the identity identifier assigned to the current tenant when registering for the application service;
[0077] The assembly unit 430 is used to assemble the identity identifier of the current tenant with the SQL request to obtain an assembled SQL request;
[0078] The storage unit 440 is used to receive and execute the assembled SQL request in the shared database, and store the identity identifier of the current tenant in the assembled SQL request in a new field for distinguishing tenant entities in the shared database.
[0079] In a possible implementation provided by an embodiment of the present application, if the SQL request is a request for inserting information, the assembly unit 430 is further used for:
[0080] In the request for inserting information, add a preset field to each table, and assign the identity identifier of the current tenant to the preset field.
[0081] In a possible implementation provided by an embodiment of the present application, if the SQL request is a request for updating information, the assembly unit 430 is further used for:
[0082] In the request for updating information, add a preset field to the where condition, and assign the identity identifier of the current tenant to the preset field.
[0083] In a possible implementation provided by an embodiment of the present application, if the SQL request is a request for querying information, the assembly unit 430 is further used for:
[0084] In the request for querying information, add a preset field to the where condition, and assign the identity identifier of the current tenant to the preset field.
[0085] In a possible implementation provided by an embodiment of the present application, the interception unit 420 is further used for:
[0086] Obtain the thread where the SQL request is located, and extract the identity identifier assigned to the current tenant during application service registration from the thread where the SQL request is located.
[0087] In an exemplary embodiment of the present application, a possible implementation is provided, and the storage unit 440 is further configured to:
[0088] Create a new field in the shared database for distinguishing tenant entities;
[0089] Store the identity identifier of the current tenant in the assembled SQL request in the new field.
[0090] In an exemplary embodiment of the present application, a possible implementation is provided, and the assembly unit 430 is further configured to:
[0091] Before assembling the SQL request with the identity identifier of the current tenant to obtain the assembled SQL request, determine whether the current tenant has the permission to access the shared database according to the identity identifier of the current tenant. If so, assemble the SQL request with the identity identifier of the current tenant to obtain the assembled SQL request.
[0092] Based on the same inventive concept, an exemplary embodiment of the present application further provides a computer device, including a processor and a memory. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the implementation method for single-database multi-tenant of the application service in any one of the above embodiments.
[0093] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as Figure 5 shown. The computer device includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, it realizes the functions or steps of the server side of an implementation method for single-database multi-tenant of the application service.
[0094] Based on the same inventive concept, an exemplary embodiment of the present application further provides a storage medium, in which a computer program is stored. The computer program is configured to execute the implementation method for single-database multi-tenant of the application service in any one of the above embodiments when running.
[0095] Those skilled in the art can clearly understand that the specific working processes of the systems, devices, and modules described above can refer to the corresponding processes in the foregoing method embodiments. For the sake of brevity, they will not be described herein again.
[0096] Those of ordinary skill in the art can understand that the technical solution of the present application, in essence, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, which includes several program instructions for causing a computer device (such as a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application when the program instructions are run. The foregoing storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc.
[0097] Alternatively, all or part of the steps of implementing the foregoing method embodiments can be completed by hardware related to program instructions (such as a computer device such as a personal computer, a server, or a network device). The program instructions can be stored in a computer-readable storage medium. When the program instructions are executed by the processor of the computer device, the computer device executes all or part of the steps of the methods described in the embodiments of the present application.
[0098] The above embodiments are only used to illustrate the technical solution of the present application, rather than to limit it; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that within the spirit and principle of the present application, they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not cause the corresponding technical solutions to deviate from the protection scope of the present application.
Claims
1. A method for implementing single-database multi-tenant for application services, characterized in that, Including: Create a shared database in the database management system to provide data services for multiple tenants; When receiving an SQL request, use aspect technology to intercept the SQL request and obtain the identity identifier assigned to the current tenant during application service registration; Use the identity identifier of the current tenant to assemble with the SQL request to obtain the assembled SQL request; Receive and execute the assembled SQL request in the shared database, and store the identity identifier of the current tenant in the assembled SQL request in a new field of the shared database for distinguishing tenant entities.
2. The method according to claim 1, characterized in that, If the SQL request is a request for inserting information, use the identity identifier of the current tenant to assemble with the SQL request to obtain the assembled SQL request, including: In the request for inserting information, add a preset field to each table and assign the identity identifier of the current tenant to the preset field.
3. The method according to claim 1, characterized in that, If the SQL request is a request for updating information, use the identity identifier of the current tenant to assemble with the SQL request to obtain the assembled SQL request, including: In the request for updating information, add a preset field to the where condition and assign the identity identifier of the current tenant to the preset field.
4. The method according to claim 1, wherein If the SQL request is a request for querying information, use the identity identifier of the current tenant to assemble with the SQL request to obtain the assembled SQL request, including: In the request for querying information, add a preset field to the where condition and assign the identity identifier of the current tenant to the preset field.
5. The method according to claim 1, characterized in that, Obtain the identity identifier assigned to the current tenant during application service registration, including: Obtain the thread where the SQL request is located, and extract the identity identifier assigned to the current tenant during application service registration from the thread where the SQL request is located.
6. The method according to any one of claims 1 to 5, characterized in that, Store the identity identifier of the current tenant in the assembled SQL request in a new field of the shared database for distinguishing tenant entities, including: Create a new field in the shared database for distinguishing tenant entities; Store the identity identifier of the current tenant in the assembled SQL request in the new field.
7. The method according to claim 1, wherein Before using the identity identifier of the current tenant to assemble with the SQL request to obtain the assembled SQL request, the method further includes: According to the identity identifier of the current tenant, determine whether the current tenant has the permission to access the shared database. If so, use the identity identifier of the current tenant to assemble with the SQL request to obtain the assembled SQL request.
8. An implementation device for single-database multi-tenant of application services, characterized in that, Including: A creation unit for creating a shared database in the database management system to provide data services for multiple tenants; An interception unit for intercepting the SQL request using aspect technology when receiving an SQL request and obtaining the identity identifier assigned to the current tenant during application service registration; An assembly unit for using the identity identifier of the current tenant to assemble with the SQL request to obtain the assembled SQL request; A storage unit for receiving and executing the assembled SQL request in the shared database, and storing the identity identifier of the current tenant in the assembled SQL request in a newly added field of the shared database for distinguishing tenant entities.
9. A computer device, characterized in that, It includes a processor and a memory. Among them, a computer program is stored in the memory, and the processor is configured to run the computer program to execute the implementation method of single-database multi-tenant for application services described in any one of claims 1 to 7.
10. A storage medium, characterized in that, A computer program is stored in the storage medium, and the computer program is configured to execute the implementation method of single-database multi-tenant for application services described in any one of claims 1 to 7 when running.