An information processing method, apparatus, device, and storage medium

By intercepting SQL statements and using MyBatis interceptors and Redis to generate target IDs, and by customizing the ID generation algorithm, the problem of duplicate IDs when merging servers in online game services was solved, achieving ID uniqueness and efficient processing.

CN116059645BActive Publication Date: 2026-03-31YIQIQIFUNETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-21
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

When merging multiple game servers in an online game service, the reliance on the database's auto-increment function can lead to the presence of identical IDs in the tables of multiple servers, causing the data merging to fail. Existing solutions require explicitly generating the IDs before each insertion, which is cumbersome, costly, and prone to errors.

Method used

By intercepting SQL statements, the target ID is generated using MyBatis interceptors and Redis. A custom ID generation algorithm is used to insert the target ID into the SQL statement, avoiding explicit ID generation. The target ID is then combined to generate a unique ID value.

Benefits of technology

It improves the efficiency of information processing, reduces the possibility of vulnerabilities, reduces the workload of developers, and avoids online problems and bugs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116059645B_ABST
    Figure CN116059645B_ABST
Patent Text Reader

Abstract

The application discloses an information processing method and device, equipment and a storage medium, and relates to the technical field of computers, and is used for solving the low processing efficiency, and comprises the following steps: intercepting a current SQL statement, and parsing the current SQL statement by a preset parsing mode to obtain an original SQL statement; obtaining a target ID corresponding to the original SQL statement by a preset ID obtaining method; inserting the target ID into a target area in the original SQL statement to obtain a modified SQL statement; and executing the modified SQL statement to obtain a target information table. The application intercepts the current SQL statement when the current SQL statement is executed, generates a target ID by calling a preset ID obtaining method in the interceptor, modifies the original SQL statement by using the target ID, increases the assignment of the relevant id value, guarantees the uniqueness of the information, improves the information processing efficiency, and reduces the possibility of vulnerabilities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to an information processing method, apparatus, device, and storage medium. Background Technology

[0002] Currently, in online game services, it's necessary to merge multiple game servers into one over time (server merging). If we continue to rely on the database's auto-increment function, duplicate IDs in the tables of multiple servers will cause the merge to fail. A common solution is to generate IDs in the code and then explicitly set the ID value in the SQL. This method requires explicitly generating IDs before each insert, which is cumbersome. Furthermore, if modifying an existing system, the code for each insert must be modified, resulting in significant costs. Additionally, it's prone to omissions in modifications, leading to online issues and bugs. Summary of the Invention

[0003] In view of this, the purpose of this invention is to provide an information processing method, apparatus, device, and storage medium that can ensure the uniqueness of information, improve the efficiency of information processing, and reduce the possibility of vulnerabilities. The specific solution is as follows:

[0004] In a first aspect, this application discloses an information processing method, including:

[0005] Intercept the current SQL statement and parse it using a preset parsing method to obtain the original SQL statement;

[0006] The target ID corresponding to the original SQL statement is obtained using a preset ID acquisition method;

[0007] The target ID is inserted into the target area of ​​the original SQL statement to obtain the modified SQL statement;

[0008] Execute the modified SQL statement to obtain the target information table.

[0009] Optionally, intercepting the current SQL statement and parsing it using a preset parsing method to obtain the original SQL statement includes:

[0010] MyBatis intercepts the current SQL statement to obtain the MappedStatement object;

[0011] Obtain the child object from the MappedStatement object, and obtain the original SQL statement based on the MappedStatement object, the child object, and the preset statement retrieval rules.

[0012] Optionally, obtaining the target ID corresponding to the original SQL statement through a preset ID acquisition method includes:

[0013] Obtain the target information corresponding to the original SQL statement; the target information includes a first category ID, a second category ID, a type ID, and an object ID;

[0014] The target information is combined based on the preset ID combination method to obtain the target ID.

[0015] Optionally, obtaining the target information corresponding to the original SQL statement includes:

[0016] Obtain the first category ID and the second category ID from the configuration file, and determine the type ID corresponding to the object in the original SQL statement;

[0017] The object ID is generated using the Redis INCR command, the first category ID, and the second category ID.

[0018] Optionally, generating the object ID using the Redis INCR command, the first category ID, and the second category ID includes:

[0019] The current region is determined based on the first category ID and the second category ID, and the previous object ID of the current region is obtained;

[0020] If the previous object ID does not exist in the current region, then the preset initial value is determined as the object ID;

[0021] If the previous object ID exists in the current region, then increment the previous object ID by one to obtain the object ID.

[0022] Optionally, inserting the target ID into the target region of the original SQL statement to obtain the modified SQL statement includes:

[0023] Retrieve the insert statement from the original SQL statement;

[0024] Retrieve the list information from the insert statement and add a new list to the list information to obtain the target list information;

[0025] The target ID is inserted into the target list information to obtain the modified SQL statement.

[0026] Optionally, inserting the target ID into the target region of the original SQL statement includes:

[0027] The target ID is inserted into the target region of the original SQL statement using reflection technology.

[0028] Secondly, this application discloses an information processing apparatus, comprising:

[0029] The statement acquisition module is used to intercept the current SQL statement and parse the current SQL statement using a preset parsing method to obtain the original SQL statement;

[0030] The ID acquisition module is used to acquire the target ID corresponding to the original SQL statement through a preset ID acquisition method;

[0031] The ID insertion module is used to insert the target ID into the target area of ​​the original SQL statement to obtain the modified SQL statement;

[0032] The statement execution module is used to execute the modified SQL statement to obtain the target information table.

[0033] Thirdly, this application discloses an electronic device, comprising:

[0034] Memory, used to store computer programs;

[0035] A processor is configured to execute the computer program to implement the steps of the information processing method disclosed above.

[0036] Fourthly, this application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the information processing method disclosed above.

[0037] As can be seen, this application provides an information processing method, including: intercepting the current SQL statement and parsing the current SQL statement using a preset parsing method to obtain the original SQL statement; obtaining the target ID corresponding to the original SQL statement using a preset ID acquisition method; inserting the target ID into the target area of ​​the original SQL statement to obtain the modified SQL statement; and executing the modified SQL statement to obtain the target information table. Therefore, this application, by intercepting the current SQL statement during its execution and generating the target ID in the interceptor by calling the preset ID acquisition method, and using the target ID to modify the original SQL statement and add relevant ID values, ensures the uniqueness of information, improves the efficiency of information processing, and reduces the possibility of vulnerabilities. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0039] Figure 1 This is a flowchart of an information processing method disclosed in this application;

[0040] Figure 2 This is a flowchart of a specific information processing method disclosed in this application;

[0041] Figure 3 A schematic diagram illustrating the type ID settings disclosed in this application;

[0042] Figure 4 This is a schematic diagram of the target ID structure disclosed in this application;

[0043] Figure 5 A schematic diagram of the information processing device provided in this application;

[0044] Figure 6 This application provides a structural diagram of an electronic device. Detailed Implementation

[0045] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0046] Currently, in online game services, as time progresses, it's necessary to merge multiple game servers into a single server. If the database's auto-increment function continues to be used, duplicate IDs in the tables of multiple servers will cause the merge to fail. Existing common solutions involve generating IDs in the code and then explicitly setting the corresponding ID column value in the SQL statement to allow setting custom ID values. This method requires explicitly generating IDs before each insert, which is cumbersome. Furthermore, if modifying an existing system, the code for each insert must be modified, resulting in significant costs. Additionally, it's prone to omissions, leading to online issues and bugs. Therefore, this application provides an information processing method that ensures information uniqueness, improves information processing efficiency, and reduces the possibility of vulnerabilities.

[0047] This invention discloses an information processing method, see [link to relevant documentation]. Figure 1 As shown, the method includes:

[0048] Step S11: Intercept the current SQL statement and parse the current SQL statement using a preset parsing method to obtain the original SQL statement.

[0049] In this embodiment, the current SQL statement is intercepted and parsed using a preset parsing method to obtain the original SQL statement. Specifically, MyBatis intercepts the current SQL statement to obtain a MappedStatement object; it then retrieves a sub-object from the MappedStatement object and uses the MappedStatement object, the sub-object, and preset statement retrieval rules to obtain the original SQL statement. MyBatis is an excellent persistence layer framework (ORM) that supports custom SQL, stored procedures, and advanced mappings. In the internet era, MyBatis has become the preferred persistence layer framework in current internet Java development. During SQL interception, the user calls the MyBatis insert method in the manner of xxxDao.insert(something).

[0050] Step S12: Obtain the target ID corresponding to the original SQL statement using a preset ID acquisition method.

[0051] In this embodiment, the current SQL statement is intercepted and parsed using a preset parsing method to obtain the original SQL statement. Then, a preset ID acquisition method is used to obtain the target ID corresponding to the original SQL statement. It is understood that in system database design, the `id` column of a data table is usually set to auto-increment. This means that when writing an `Insert` statement in SQL, no additional processing of the `id` is needed; the value of the `id` column is automatically generated when inserting data. This type of `id` column is usually of type `int` or `long`. For example, in the `Insert` statement "Insert into table1(c1,c2,...)values(v1,v2,...)", the value of the `id` column is not explicitly specified in this SQL statement, but the database automatically generates the corresponding `id` value during insertion. To ensure the uniqueness of data `id` in different database tables, we usually need to generate the `id` in the code and then explicitly specify the `id` value through the database's `Insert` SQL statement before insertion.

[0052] This solution leverages a custom ID generation method and MyBatis interception technology to automatically generate and insert IDs with category IDs (e.g., server ID) and item type IDs without modifying the SQL INSERT statement. For example, if the existing system has the SQL statement "Insert into table1(c1,c2,...)values(v1,v2,...)", this solution intercepts the SQL and generates a new SQL statement "Insert into table1(id,c1,c2,...)values(***,v1,v2,...)", where *** represents the ID value with the server ID.

[0053] Step S13: Insert the target ID into the target area of ​​the original SQL statement to obtain the modified SQL statement.

[0054] In this embodiment, after obtaining the target ID corresponding to the original SQL statement using a preset ID acquisition method, the target ID is inserted into the target area of ​​the original SQL statement to obtain the modified SQL statement. It can be understood that the target ID is inserted into the target area of ​​the original SQL statement using reflection technology (i.e., filling the object with a primary key value); the specific code is as follows:

[0055] Class<? >cls=Something.class;

[0056] Field field=cls.getField("id");

[0057] long id = generateId(); / / Call the id generation method

[0058] field.set(something, id);

[0059] Step S14: Execute the modified SQL statement to obtain the target information table.

[0060] In this embodiment, the target ID is inserted into the target area of ​​the original SQL statement to obtain the modified SQL statement. Then, the modified SQL statement is executed to obtain the target information table, thereby completing the integration and addition of data.

[0061] This application implements a MyBatis interceptor to intercept Insert statements and modify the SQL statement to assign values ​​to IDs. The specific steps are as follows: Define the `IdGeneratorInterceptor` class to handle related SQL interception and modification. This class needs to implement the MyBatis interceptor interface `Interceptor`; add the `@Intercepts` annotation to the `IdGeneratorInterceptor` class to declare that this interceptor applies to "Insert"; implement the `intercept` method of the interface class, which needs to obtain the `SqlSource` and `BoundSql` objects from the `MappedStatement` object, and then obtain the original SQL using the `getSql` method, such as `mappedStatement.getBoundSql().getSql()`. Then, append the ID to the original SQL, and intercept the SQL in this method to complete the ID generation and SQL modification operations.

[0062] This solution uses a custom object ID generator and a MyBatis interceptor to intercept and modify the SQL statement during insertion. The interceptor calls the custom ID generation algorithm to modify the SQL and assign the relevant ID value. This eliminates the need for developers to explicitly call the ID generation algorithm and set ID values ​​when writing SQL, improving development efficiency and reducing unnecessary bugs caused by overlooked ID values.

[0063] As can be seen, this application provides an information processing method, including: intercepting the current SQL statement and parsing the current SQL statement using a preset parsing method to obtain the original SQL statement; obtaining the target ID corresponding to the original SQL statement using a preset ID acquisition method; inserting the target ID into the target area of ​​the original SQL statement to obtain the modified SQL statement; and executing the modified SQL statement to obtain the target information table. Therefore, this application, by intercepting the current SQL statement during its execution and generating the target ID in the interceptor by calling the preset ID acquisition method, and using the target ID to modify the original SQL statement and add relevant ID values, ensures the uniqueness of information, improves the efficiency of information processing, and reduces the possibility of vulnerabilities.

[0064] See Figure 2 As shown, this embodiment of the invention discloses an information processing method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution.

[0065] Step S21: Intercept the current SQL statement and parse the current SQL statement using a preset parsing method to obtain the original SQL statement.

[0066] Step S22: Obtain the target information corresponding to the original SQL statement.

[0067] In this embodiment, the current SQL statement is parsed using a preset parsing method to obtain the original SQL statement, and then target information corresponding to the original SQL statement is obtained. The target information includes a first category ID, a second category ID, a type ID, and an object ID. Specifically, the first category ID and the second category ID are obtained from the configuration file, and the type ID corresponding to the object in the original SQL statement is determined. The object ID is generated using the Redis INCR command, the first category ID, and the second category ID. Generating the object ID using the Redis INCR command, the first category ID, and the second category ID includes: determining the current region based on the first category ID and the second category ID, and obtaining the previous object ID of the current region; if the previous object ID does not exist in the current region, a preset initial value is set as the object ID; if the previous object ID exists in the current region, the previous object ID is incremented by one to obtain the object ID. For example, the type ID is set as follows: Figure 3 As shown, when the code is TASK("0001", "task"), it means that the current type is a task and the type ID is displayed as 0001; when the code is TASK("0002", "skill"), it means that the current type is a skill and the type ID is displayed as 0002; when the code is TASK("0003", "scroll"), it means that the current type is a scroll and the type ID is displayed as 0003.

[0068] For example, during the process of merging game servers, to avoid duplicate IDs during the merge, a method for generating unique IDs across different servers is needed. Therefore, generating unique IDs like... Figure 4The target ID is formatted as follows. The target ID includes a first category ID, a second category ID, a type ID, and an object ID; for example, area ID (4 digits), server ID (4 digits), type ID (4 digits), and object ID (8 digits). Each area, such as area A, area B, etc., has a unique ID across all areas. This ID is saved in a configuration file, and its uniqueness is manually guaranteed; it is defined as Area-Id. Each server, such as server 1, server 2, etc., has a unique ID across all servers within its area. This ID is saved in a configuration file, and its uniqueness is manually guaranteed; it is defined as Server-Id. The type ID for each object, such as scrolls, tasks, characters, skills, etc., is implemented through enumeration and defined as Type-Id. The object ID does not automatically increment; it increments by one after each generation and is defined as Object-Id. For example, an object ID can be generated using the Redis INCR command, where the key is Area-Id_Server-Id_Type-Id.

[0069] Step S23: Combine the target information based on the preset ID combination method to obtain the target ID.

[0070] In this embodiment, after obtaining the target information corresponding to the original SQL statement, the target information is combined based on the preset ID combination method to obtain the target ID. For example, Area-Id, Server-Id, Type-Id, and Object-Id are concatenated to obtain the target ID.

[0071] Step S24: Obtain the insert statement from the original SQL statement.

[0072] In this embodiment, the target information is combined based on the preset ID combination method to obtain the target ID, and then the insert statement in the original SQL statement is obtained. It can be understood that the list information in the insert statement is obtained, and a new list is added to the list information to obtain the target list information. The specific steps for intercepting SQL and completing operations such as ID generation and SQL modification are as follows: The processing logic consists of two parts: columns and values. For example, given the following SQL: “Insert to table1(c1,c2,...)values(v1,v2,...)”, an id column is added to the column list of the insert statement (i.e., “c1,c2,...”), forming a new column list “id,c1,c2,...”; the value of id is added to the value list of the insert statement (i.e., “v1,v2,...”), forming a new value list.

[0073] Step S25: Insert the target ID into the target list information to obtain the modified SQL statement.

[0074] In this embodiment, after obtaining the INSERT statement from the original SQL statement, the target ID is inserted into the target list information to obtain the modified SQL statement. It can be understood that if the insert statement is for a single data entry, i.e., one statement inserts only one data entry, such as "Insert into table1(c1,c2,...)values(v1,v2,...)", an ID generation algorithm is called to generate IDs, forming a new value list, such as ***,v1,v2,..., where "***" is the ID value. If the insert statement is for multiple data entries, i.e., one statement inserts multiple data entries, such as "Insert into table1(c1,c2,...)values(v1,v2,...),(v3,v4,...),...", then it is necessary to traverse all value lists, call the ID algorithm to generate multiple ID values, add the ID value to each value list, forming a new value list, i.e., "(***,v1,v2,...),(***,v3,v4,...),...", where "***" is the ID value.

[0075] This application generates the final ID through configuration, code, and Redis. By attaching a server ID, it ensures the uniqueness of the ID across all servers, facilitating server merging. It uses a MyBatis interceptor for automatic insertion of the server ID, implementing the call to the server ID generation algorithm and processing the ID column in the SQL. The automatic generation and insertion of IDs via MyBatis interceptors eliminates the need for developers to explicitly handle ID values ​​when writing SQL, improving development efficiency. Other ID generation algorithms can also be used; theoretically, any algorithm supported by Java code is acceptable. This avoids intrusion into business logic code, eliminating the need for developers to manually handle IDs.

[0076] Step S26: Execute the modified SQL statement to obtain the target information table.

[0077] For details regarding steps S21 and S26, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.

[0078] As can be seen, this embodiment of the application intercepts the current SQL statement and parses it using a preset parsing method to obtain the original SQL statement; obtains the target information corresponding to the original SQL statement; combines the target information based on the preset ID combination method to obtain the target ID; obtains the insert statement in the original SQL statement; inserts the target ID into the target list information to obtain the modified SQL statement; and executes the modified SQL statement to obtain the target information table. This ensures the uniqueness of the information, improves the efficiency of information processing, and reduces the possibility of vulnerabilities.

[0079] See Figure 5 As shown in the embodiments, this application also discloses an information processing device, including:

[0080] The statement acquisition module 11 is used to intercept the current SQL statement and parse the current SQL statement using a preset parsing method to obtain the original SQL statement;

[0081] ID acquisition module 12 is used to acquire the target ID corresponding to the original SQL statement through a preset ID acquisition method;

[0082] ID insertion module 13 is used to insert the target ID into the target area of ​​the original SQL statement to obtain the modified SQL statement;

[0083] Statement execution module 14 is used to execute the modified SQL statement to obtain the target information table.

[0084] As can be seen, this application includes: intercepting the current SQL statement and parsing the current SQL statement using a preset parsing method to obtain the original SQL statement; obtaining the target ID corresponding to the original SQL statement using a preset ID acquisition method; inserting the target ID into the target area of ​​the original SQL statement to obtain the modified SQL statement; and executing the modified SQL statement to obtain the target information table. Therefore, this application, by intercepting the execution of the SQL statement during insertion and generating the target ID in the interceptor by calling the preset ID acquisition method, and using the target ID to modify the original SQL statement and assign relevant ID values, ensures the uniqueness of information, improves the efficiency of information processing, and reduces the possibility of vulnerabilities.

[0085] In some specific embodiments, the statement acquisition module 11 specifically includes:

[0086] The object retrieval unit is used to intercept the current SQL statement through MyBatis to obtain the MappedStatement object;

[0087] The original SQL statement retrieval unit is used to obtain the subordinate object from the MappedStatement object, and to obtain the original SQL statement based on the MappedStatement object, the subordinate object, and the preset statement retrieval rules.

[0088] In some specific embodiments, the ID acquisition module 12 specifically includes:

[0089] The ID determination unit is used to obtain the first category ID and the second category ID from the configuration file, and determine the type ID corresponding to the object in the original SQL statement;

[0090] The previous object ID acquisition unit is used to determine the current region based on the first category ID and the second category ID, and to acquire the previous object ID of the current region;

[0091] The first object ID determination unit is used to determine the object ID as a preset initial value if the previous object ID does not exist in the current region.

[0092] The second object ID determination unit is used to increment the previous object ID by one if the current region contains the previous object ID, so as to obtain the object ID.

[0093] The target information acquisition unit is used to acquire target information corresponding to the original SQL statement; the target information includes a first category ID, a second category ID, a type ID, and an object ID.

[0094] The target ID acquisition unit is used to combine the target information based on the preset ID combination method to obtain the target ID.

[0095] In some specific embodiments, the ID insertion module 13 specifically includes:

[0096] The insert statement retrieval unit is used to retrieve the insert statement from the original SQL statement;

[0097] The list addition unit is used to obtain list information from the insert statement and add a new list to the list information to obtain the target list information;

[0098] The SQL statement modification unit is used to insert the target ID into the target area of ​​the original SQL statement using reflection technology to obtain the modified SQL statement.

[0099] In some specific embodiments, the statement execution module 14 specifically includes:

[0100] The statement execution unit is used to execute the modified SQL statement to obtain the target information table.

[0101] Furthermore, embodiments of this application also provide an electronic device. Figure 6 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.

[0102] Figure 6 This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may 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 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the information processing method disclosed in any of the foregoing embodiments. Furthermore, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0103] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire 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.

[0104] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0105] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including computer programs capable of performing the information processing methods executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs capable of performing other specific tasks.

[0106] Furthermore, this application also discloses a storage medium storing a computer program, which, when loaded and executed by a processor, implements the information processing method steps disclosed in any of the foregoing embodiments.

[0107] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0108] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0109] The above provides a detailed description of the information processing method, apparatus, device, and storage medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. An information processing method characterized by comprising: The method comprises the following steps: intercepting a current SQL statement, and parsing the current SQL statement through a preset parsing method to obtain an original SQL statement; obtaining a target ID corresponding to the original SQL statement through a preset ID obtaining method; inserting the target ID into a target region in the original SQL statement to obtain a modified SQL statement; executing the modified SQL statement to obtain a target information table; wherein the step of obtaining the target ID corresponding to the original SQL statement through the preset ID obtaining method comprises: obtaining a first classification ID and a second classification ID from a configuration file, and determining a type ID corresponding to an object in the original SQL statement; determining a current region based on the first classification ID and the second classification ID through an INCR command of Redis, and obtaining a last object ID of the current region; if the last object ID does not exist in the current region, determining a preset initial value as the object ID; if the last object ID exists in the current region, adding one to the last object ID to obtain the object ID; combining the first classification ID, the second classification ID, the type ID and the object ID corresponding to the original SQL statement based on a preset ID combination method to obtain the target ID.

2. The information processing method according to claim 1, characterized by, The step of intercepting the current SQL statement and parsing the current SQL statement through the preset parsing method to obtain the original SQL statement comprises: intercepting the current SQL statement through MyBatis to obtain a MappedStatement object; obtaining a subordinate object from the MappedStatement object, and obtaining the original SQL statement based on the MappedStatement object, the subordinate object and a preset statement obtaining rule.

3. The information processing method according to claim 1, characterized by, The step of inserting the target ID into the target region in the original SQL statement to obtain the modified SQL statement comprises: obtaining an insert statement in the original SQL statement; obtaining list information in the insert statement, and adding a new list to the list information to obtain target list information; inserting the target ID into the target list information to obtain the modified SQL statement.

4. The information processing method according to any one of claims 1 to 3, characterized by, The step of inserting the target ID into the target region in the original SQL statement comprises: inserting the target ID into the target region in the original SQL statement through a reflection technology.

5. An information processing apparatus, characterized by comprising: The method comprises the following steps: a statement obtaining module is configured to intercept a current SQL statement, and parse the current SQL statement through a preset parsing method to obtain an original SQL statement; an ID obtaining module is configured to obtain a target ID corresponding to the original SQL statement through a preset ID obtaining method; an ID inserting module is configured to insert the target ID into a target region in the original SQL statement to obtain a modified SQL statement; a statement executing module is configured to execute the modified SQL statement to obtain a target information table; wherein the ID obtaining module comprises: An ID determining unit is configured to obtain a first classification ID and a second classification ID from a configuration file, and determine a type ID corresponding to an object in the original SQL statement; A last object ID obtaining unit is configured to determine a current area based on the first classification ID and the second classification ID through an INCR command of Redis, and obtain a last object ID of the current area; A first object ID determining unit is configured to determine a preset initial value as the object ID if the current area does not exist the last object ID; A second object ID determining unit is configured to add one to the last object ID to obtain the object ID if the current area exists the last object ID; A target ID obtaining unit is configured to combine the first classification ID, the second classification ID, the type ID and the object ID corresponding to the original SQL statement based on a preset ID combination method to obtain the target ID.

6. An electronic device, comprising: Comprise: A memory for saving a computer program; A processor for executing the computer program to realize the steps of the information processing method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, For storing a computer program; wherein the computer program is executed by the processor to realize the information processing method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Table division method and device based on hibernate interceptor, electronic equipment and storage medium

    CN115203209A