Data table acquisition method and related equipment

The method of class inheritance abstract classes is implemented through data tables, which simplifies data table acquisition, solves the problems of redundant configuration files and SQL injection risks, and improves system maintenance efficiency and security.

CN119149142APending Publication Date: 2024-12-17MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411125398.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

When processing a large number of associated data tables, the prior art requires a large number of configuration files, which makes the system maintenance difficult and occupy storage space, and there is a risk of SQL injection, which violates security specifications.

Method used

Encapsulate the first abstract class through implementation class inheritance of data tables, create the inheritance relationship between implementation class and abstract class of data table, simplify the data table acquisition method, avoid the use of structured query language, and reduce the risk of SQL injection.

Benefits of technology

No additional configuration files are required, simplifying data table acquisition, reducing storage space requirements, avoiding SQL injection risks, and improving system maintenance efficiency and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149142A_ABST
    Figure CN119149142A_ABST
Patent Text Reader

Abstract

The invention discloses a data table obtaining method and related equipment, and the method comprises the steps: packaging a first interface, and obtaining a first abstract class; inheriting the first abstract class through an implementation class of a data table, and creating an inheritance relationship between the implementation class of the data table and the first abstract class; and obtaining the data table according to an inheritance relationship between the implementation class of the data table and the first abstract class. According to the method, the implementation class of the data table inherits and encapsulates the first abstract class of the first interface, and the inheritance relationship between the implementation class of the data table and the first abstract class is created, so that when a method defined in the first interface is implemented, the data table can be directly and quickly obtained through the inheritance relationship, and the implementation efficiency of the data table is improved. No additional configuration file needs to be added to the data table, and the requirement for the storage space is lowered while the data table obtaining mode is simplified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a data table acquisition method and related equipment. Background Art

[0002] At present, with the iteration of business systems, there will be more and more data tables in the system. In this case, in order to ensure the execution efficiency of the business in the system, it is necessary to associate the data table where the data required by the method in the business is located with the method, so that when the method is executed, the relevant data table can be quickly obtained. At present, the commonly used method is to configure a configuration file that stores the table name of the associated data table in the business, and then when executing the relevant method, the table name of the data table associated with the method is determined through the configuration file to quickly obtain the associated data table.

[0003] However, when there are a large number of associated data tables, this method will generate a large number of configuration files, resulting in high system maintenance efficiency and dimensionality difficulties, and will occupy a large amount of storage space. At the same time, in the above method, since the data table is dynamic, when using Structured Query Language (SQL) to process the data in the associated data table, it is necessary to use the "${}" statement to execute, which has the risk of SQL injection and does not meet the security specifications and requirements of the system. Summary of the invention

[0004] The present application provides a data table acquisition method and related devices, which do not require adding additional configuration files for the data table, can simplify the data table acquisition method, reduce the demand for storage space, and avoid the risk of SQL injection.

[0005] In a first aspect, a data table acquisition method provided in an embodiment of the present application includes:

[0006] Encapsulate the first interface to obtain the first abstract class;

[0007] Inheriting the first abstract class through the implementation class of the data table, and creating an inheritance relationship between the implementation class of the data table and the first abstract class;

[0008] The data table is obtained according to the inheritance relationship between the implementation class of the data table and the first abstract class.

[0009] It can be seen that this method creates an inheritance relationship between the implementation class of the data table and the first abstract class by making the implementation class of the data table inherit and encapsulate the first abstract class of the first interface. Then, when implementing the method defined in the first interface, the data table can be quickly obtained directly through the inheritance relationship without adding additional configuration files for the data table. This simplifies the method of obtaining the data table and reduces the demand for storage space. At the same time, it also avoids the injection risk caused by using structured query language to call the data table.

[0010] In a second aspect, a data table acquisition device provided in an embodiment of the present application includes:

[0011] An inheritance module, used for encapsulating the first interface, obtaining a first abstract class, inheriting the first abstract class through the implementation class of the data table, and establishing an inheritance relationship between the implementation class of the data table and the first abstract class;

[0012] An acquisition module is used to acquire the data table according to the inheritance relationship between the implementation class of the data table and the first abstract class.

[0013] A third aspect is an electronic device provided for an embodiment of the present application, comprising a processor, a memory, and a computer program or instructions stored on the memory, wherein the processor executes the computer program or instructions to implement the steps in the method designed in the first aspect above.

[0014] In a fourth aspect, a computer-readable storage medium is provided for an embodiment of the present application, wherein a computer program or instruction is stored therein, and when the computer program or instruction is executed, the steps in the method designed in the first aspect are implemented. For example, the computer program or instruction is executed by a processor.

[0015] In a fifth aspect, a computer program product provided by an embodiment of the present application includes a computer program or an instruction, wherein when the computer program or the instruction is executed, the steps in the method designed in the first aspect are executed. For example, the computer program or the instruction is executed by a processor.

[0016] The beneficial effects brought about by the technical solutions of the second to fifth aspects can be referred to the technical effects brought about by the technical solution of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some implementation methods recorded in one or more of the present specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0018] Figure 1 is a schematic diagram of a data table acquisition system proposed in an embodiment of the present application;

[0019] Figure 2 A flowchart of a method for obtaining a data table proposed in an embodiment of the present application;

[0020] Figure 3 A flowchart of another data table acquisition method proposed in an embodiment of the present application;

[0021] Figure 4 This is a schematic diagram of a user deleting first data or making a request to delete data associated with the first data, as proposed in an embodiment of the present application;

[0022] Figure 5 It is a schematic diagram of an example of a cleaning process for implementing a method for acquiring a data table proposed in an embodiment of the present application;

[0023] Figure 6 It is a functional module composition block diagram of a data table acquisition device proposed in an embodiment of the present application;

[0024] Figure 7 It is a structural schematic diagram of an electronic device proposed in an embodiment of the present application. DETAILED DESCRIPTION

[0025] It should be understood that the terms "first", "second", etc. involved in the embodiments of the present application are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, software, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products, or devices.

[0026] The "implementation method" involved in the embodiments of the present application means that the specific features, structures or characteristics described in conjunction with the implementation method may be included in at least one implementation method of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same implementation method, nor is it an independent or alternative implementation method that is mutually exclusive with other implementation methods. It is explicitly and implicitly understood by those skilled in the art that the implementation methods described herein may be combined with other implementation methods.

[0027] The “and / or” in the implementation manner of the present application describes the association relationship of the associated objects, indicating that three types of relationships may exist.

[0028] In the implementation manner of the present application, the symbol " / " can indicate that the previously associated objects are in an "or" relationship.

[0029] "At least one item" or similar expressions in the embodiments of the present application refers to any combination of these items, including any combination of single items or plural items, and refers to one or more, and multiple refers to two or more.

[0030] In the embodiments of the present application, "higher than" can be expressed as the same concept as "greater than", "lower than" can be expressed as the same concept as "less than", "not lower than" can be expressed as the same concept as "higher than or equal to" or "greater than or equal to", and "not higher than" can be expressed as the same concept as "lower than or equal to" or "less than or equal to". In the present application, for the same scheme, "equal to" can be used in conjunction with "less than", and can also be used in conjunction with "greater than", but not used in conjunction with "less than" and "greater than" at the same time. When "equal to" is used in conjunction with "less than", it is applicable to the technical scheme adopted by "less than". When "equal to" is used in conjunction with "greater than", it is applicable to the technical scheme adopted by "greater than".

[0031] In the embodiments of the present application, the terms "of", "corresponding / relevant", "corresponding", "indicated", "associated", etc. may be used interchangeably.

[0032] In the implementation manner of this application, the words "associated", "corresponding", "corresponding", "is", "of", "for", "belonging to", "as", and "regarded as" can sometimes be used interchangeably.

[0033] The "connection" in the embodiments of the present application refers to various connection methods such as direct connection or indirect connection to achieve communication between devices, and there is no limitation on this.

[0034] The "network" in the implementation manner of the present application can be expressed as the same concept as the "system", and the communication system is the communication network.

[0035] The following is an explanation of the relevant contents, concepts, meanings, technical issues, technical solutions and beneficial effects involved in the implementation of the present application.

[0036] First, see Figure 1 , Figure 1 Schematic diagram of a data table acquisition system proposed in the embodiment of the present application. Figure 1As shown, the data table acquisition system may include a terminal device and a database. The terminal device encapsulates a first interface having a method defined therein to obtain a first abstract class. Then, the implementation class of the data table associated with the method inherits the first abstract class, and an inheritance relationship between the implementation class of the data table and the first abstract class is created. Thus, when the method is implemented, the data table can be quickly acquired in the database through the inheritance relationship between the first abstract class and the implementation class of the data table.

[0037] Understandably, Figure 1 The form and quantity of the terminal devices and databases shown in the figure are for example only and do not constitute a limitation on the implementation methods of the present application.

[0038] In this embodiment, the terminal device may be a device with a communication function, which may be referred to as a terminal, user equipment (UE), mobile station (MS), mobile terminal (MT), access terminal equipment, vehicle-mounted terminal equipment, industrial control terminal equipment, UE unit, UE station, mobile station, remote station, remote terminal equipment, mobile equipment, UE terminal equipment, wireless communication equipment, UE agent or UE device, etc. The terminal device may be fixed or mobile. It should be noted that the terminal device may support at least one wireless communication technology, such as LTE, new radio (NR), wideband code division multiple access (WCDMA), etc. For example, the terminal device may be a mobile phone, a tablet computer (pad), a desktop computer, a laptop computer, an all-in-one computer, a vehicle-mounted terminal, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, a cellular phone, a cordless phone, a session initiation protocol (SIP) phone, a wireless local loop (WLL) station, a personal digital assistant (PDA), a handheld device with wireless communication function, a computing device or other processing device connected to a wireless modem, a wearable device, a terminal device in a future mobile communication network, or a terminal device in a future evolved public mobile land network (PLMN), etc. In some implementations of the present application, the terminal device may also be a device with transceiver functions, such as a chip system, wherein the chip system may include a chip and may also include other discrete devices.

[0039] In this embodiment, the terminal device may also be a server, for example, it may be an independent server, or it may be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. This application does not make any specific limitations on this.

[0040] In this embodiment, the database may also be a server, or a memory that provides data storage services, such as: a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk storage medium or other magnetic storage devices, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, and this application does not make any specific limitations on this.

[0041] In this implementation, the server may also be a storage unit integrated in the terminal device, and is a component of the terminal device.

[0042] See also Figure 2 , Figure 2 A flow chart of a data table acquisition method proposed in the embodiment of the present application, which is applied to Figure 1 The data table acquisition system shown in the figure can be implemented by a terminal device in the data table acquisition system. Figure 2 As shown, the method includes:

[0043] S201: Encapsulate the first interface to obtain a first abstract class.

[0044] In this implementation, the method that needs to call the data table can be defined in the system through the top-level abstract interface to obtain the first interface. The method can be defined according to the actual business scenario and requirements. For example, if the actual business scenario is a data cleaning scenario and the requirement is to clean up the associated data based on the unique key of the master data, the method can be a method for cleaning up the associated data based on the unique key.

[0045] In this embodiment, after obtaining the first interface, the first interface can be encapsulated into a first abstract class to abstract the method defined in the first interface. Then, in the scenario where the method is applicable, the method in the first interface can be called by calling the first abstract class. There is no need to rewrite the relevant method based on the scenario, thereby improving the reusability of the method and avoiding repeated definition.

[0046] S202: Inheriting the first abstract class through the implementation class of the data table, and creating an inheritance relationship between the implementation class of the data table and the first abstract class.

[0047] In this embodiment, the data table may be a data table that needs to be called when executing the method defined in the first interface in the scenario determined according to the actual application scenario. Taking the data cleaning scenario as an example, if the method is a method for cleaning the associated data of a certain data, then the data table is a data table in the database for storing the associated data.

[0048] It should be noted that the data table may also be any data table, or a data table determined by other methods in the art, and the present application does not impose any limitation on this.

[0049] In this implementation, after the data table is determined, the class name of the first abstract class can be added after the class name of the implementation class of the data table to obtain a new class name of the implementation class of the data table. Specifically, the class name of the first abstract class can be added after the class name of the Service implementation class of the data table using the extends keyword, for example:

[0050] @Service

[0051] public class 001 extends 002 {

[0052] / / Custom method

[0053] }

[0054] The class name of the Service implementation class of the data table is "001", and the class name of the first abstract class is "002". In this implementation, the new class name of the implementation class of the data table is defined as "001extends 002".

[0055] Then, by adding the new class name of the implementation class of the data table as an instance of the first abstract class, an inheritance relationship between the implementation class of the data table and the first abstract class is created. Specifically, the implementation class of the data table that inherits the first abstract class can be added to the instance list of the first abstract class, or in other words, the new class name of the implementation class of the data table that inherits the first abstract class is registered in the instance list of the first abstract class to create an inheritance relationship between the implementation class of the data table and the first abstract class.

[0056] S203: Acquire the data table according to the inheritance relationship between the implementation class of the data table and the first abstract class.

[0057] In this implementation, since the first abstract class cannot be called directly, it is necessary to create a corresponding first service in combination with the actual operating environment, so that the first service depends on the first abstract class, and then the call to the first abstract class is implemented by instantiating the first service. In this case, the implementation class of the data table can be configured as the injection instance of the first service according to the inheritance relationship between the first abstract class and the implementation class of the data table. Exemplarily, in the first service, the implementation class of the data table can be configured as the injection instance of the first service through the annotation @Autowired.

[0058] After the configuration is completed, when the first service is instantiated, the implementation class of the data table will be injected into the first service through instance injection, and then the data table can be directly obtained through the injected injection instance.

[0059] Specifically, the injection method can be a map structure, for example:

[0060] Map<String,IRemoveByUniqueueKeyService>

[0061] Among them, String is a string that can uniquely identify the data table, such as the table name of the data table, and IRemoveByUniqueueKeyService is the interface name of the first interface. Then, by traversing the Map, the data table can be obtained.

[0062] Therefore, this implementation method makes the implementation class of the data table inherit and encapsulate the first abstract class of the first interface, and creates an inheritance relationship between the implementation class of the data table and the first abstract class. Then, when implementing the method defined in the first interface, the data table can be quickly obtained directly through the inheritance relationship without adding additional configuration files for the data table. This simplifies the method of obtaining the data table and reduces the demand for storage space. At the same time, it also avoids the injection risk caused by using structured query language to call the data table.

[0063] It should be noted that the data table acquisition method provided by the implementation method of the present application can be applied to most scenarios for processing data tables, for example: cleaning, updating, replacing, synchronizing, and other scenarios for data in a data table. Below, in combination with the above-mentioned data table acquisition system, taking the scenario of cleaning up data in a data table as an example, a data table acquisition method proposed in the present application is clearly and completely described. Obviously, the described implementation method is only a part of the implementation method of the present application, not all of the implementation methods. Based on the implementation methods in the present application, all other implementation methods obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0064] In addition, the data table acquisition method in other scenarios is similar to the data table acquisition method in the scenario of cleaning the data in the data table, and will not be repeated here.

[0065] In this embodiment, when the business scenario is a scenario for cleaning related data, the method defined in the first interface is a related data cleaning method, for example: a method for cleaning the related data of the data according to the unique key of the data. Correspondingly, the first service is a related data cleaning service.

[0066] Based on this, see Figure 3 , Figure 3 This is a flow chart of another data table acquisition method proposed in an embodiment of the present application. The method can be applied to a terminal device in the above data table acquisition system. The data table acquisition method includes:

[0067] S301: Encapsulate the first interface to obtain a first abstract class.

[0068] S302: Inheriting the first abstract class through the implementation class of the data table, and creating an inheritance relationship between the implementation class of the data table and the first abstract class.

[0069] S303: Acquire the data table according to the inheritance relationship between the implementation class of the data table and the first abstract class.

[0070] S304: Obtain a unique key of the first data.

[0071] In this embodiment, the first data may be data in the main business table, and the unique key may be a string in the data table that can uniquely identify the first data. Exemplarily, the unique key may be a column value of the first data, or a unique identifier given to the first data due to the data's own attributes. For example, if the first data is project data, the unique key may be a string that can uniquely identify the project, such as the project ID or project number.

[0072] In this embodiment, a monitoring module can be created to monitor the cleanup event of the first data, and then when the cleanup event is monitored by the monitoring module, the unique key of the first data is obtained. Exemplarily, the cleanup event is used to indicate that the first data is cleaned, or that data related to the first data is requested to be cleaned. Specifically, the indication that the first data is cleaned in the cleanup event can be understood as when the user cleans the first data itself through the terminal device, the terminal device will generate the cleanup event; the related data of the first data in the cleanup event is requested to be cleaned, which can be understood as when the user issues a cleanup request for data related to the first data through the terminal device, the terminal device will generate the cleanup event.

[0073] It should be noted that, in this embodiment, the terminal device can adopt the three-layer architecture of Model-View-Controller (MVC), combining the management layer (x-manage) module, the service layer (x-service) module, the data layer (x-dao) module and the event monitoring layer (x-message-event) module to build the software. Among them, the x-message-event module is the above-mentioned monitoring module, which is used as a common module to monitor various events generated in the terminal device, and its monitoring mechanism can adopt Spring's event publishing monitoring mechanism. Based on this, the x-mwessage-event module needs to be introduced in the POM (Project Object Model) files of the x-manage module, the x-service module and the x-dao module.

[0074] In the above framework, if Figure 4 As shown, when the user wants to clean up the first data or the associated data of the first data, the user can submit a request to delete the first data to the terminal device by manipulating the View to provide a visual interface. For example, the request is triggered by selecting the first data in the visual interface and clicking the "Delete" / "Delete associated data" control. After receiving the request, the Controller calls the corresponding Model to perform the deletion action and enables the View to display the deletion result of the first data.

[0075] In this embodiment, the deletion action on the first data can be performed by the x-service module calling the corresponding Model. Taking the event of deleting the first data itself as an example, after the user selects the first data in the visual interface and clicks "Clean", the Controller sends the received request to the x-service module, so that the x-service module calls the corresponding Model to perform the deletion action on the first data. After executing the deletion of the first data, the x-service module can call ApplicationContext.publishEvent to publish ApplicationEvent, declaring that the first data has been deleted. At this time, a MessageEvent can be generated as a deletion event, which then triggers the listening module to obtain the unique key of the first data.

[0076] In this embodiment, the monitoring mode of the above-mentioned monitoring module can be asynchronous monitoring, thereby realizing asynchronous decoupling of the system module, so that the cleaning process of the first data and the deletion process of the related data of the first data are executed asynchronously, thereby avoiding waiting and error problems caused by too much idle data leading to a long data table acquisition process.

[0077] In this implementation, the deletion event may include the unique key of the first data. For example, the deletion event MessageEvent may be as follows:

[0078] public class MessageEvent extends ApplicationEvent{

[0079] String caseNo;

[0080] …

[0081] }

[0082] Among them, caseNo is the unique key of the first time. Therefore, when monitoring the deletion event, the deletion event can be obtained, and then the unique key of the first data can be obtained from the deletion event.

[0083] In this implementation, the above-mentioned monitoring module may be an x-message-event module. Specifically, the x-message-event module may monitor the cleanup event by setting an asynchronous monitoring handler and annotating @EventListener therein.

[0084] S305: Traverse the data table according to the unique key and delete the associated data of the first data.

[0085] In this implementation, after the unique key of the first data is obtained, the unique key can be passed to the obtained data table implementation class. The data table implementation class calls the data deletion method in the first abstract class it inherits, traverses the data table based on the unique key, and deletes the associated data of the first data when it is determined that the data table contains the associated data of the first data.

[0086] Specifically, the unique key of each data in the data table can be obtained to determine whether there is an association relationship between the key value of the unique key of each data and the key value of the unique key of the first data. The association relationship may refer to: the key value of the unique key of the associated data of the first data is determined based on the key value of the unique key of the first data, for example: the key value of the unique key of the associated data of the first data is equal to the key value of the unique key of the first data, or the difference, product, quotient, sum, etc. between the key value of the unique key of the associated data of the first data and the key value of the unique key of the first data is equal to the first threshold. If there is data in the data table that has an association relationship with the key value of the unique key of the first data, it is determined that the data table contains the associated data of the first data, and the data that has an association relationship with the key value of the unique key of the first data is the associated data of the first data.

[0087] In this embodiment, after determining the associated data of the first data, the field value of the associated data deletion field of the first data can be updated from the first value to the second value to delete the associated data of the first data. Specifically, the first value is used to identify that the data status of the associated data of the first data is not deleted, and the second value is used to identify that the data status of the associated data of the first data is deleted. After the field value of the deletion field is marked as the second value, the associated data of the first data will no longer be displayed when querying, but the data still remains in the data table, and can be redisplayed by modifying the field value of the deletion field to the first value.

[0088] In an optional implementation, in addition to the key value of the unique key of the associated data of the first data being determined based on the key value of the unique key of the first data, the field value of the deleted field also needs to be the first value. This is to identify and filter only the undeleted data, thereby reducing the amount of data to be identified and filtered, and further improving the cleaning efficiency.

[0089] It should be noted that the relevant principles of steps S301-S303 can refer to the relevant explanations of steps S201-S203 in the above implementation mode, and can solve the same technical problems and achieve the same technical effects, which will not be repeated here.

[0090] It can be seen that by making the data table implementation class inherit the first abstract class that encapsulates the first interface, an inheritance relationship between the data table implementation class and the first abstract class is created. Then, when implementing the method defined in the first interface, the data table can be quickly obtained directly through the inheritance relationship, and the method encapsulated by the first abstract class can be directly called through the first abstract class inherited by the data table implementation class to implement the call to the data table. Then, there is no need to use structured query language to call the data table, avoiding the injection risk brought by structured query language.

[0091] In an optional implementation manner, the cleaning event MessageEvent may also include scene information of the first data, as follows:

[0092]

[0093] Among them, caseNo represents the unique key of the data, and scene represents the scene information of the data.

[0094] In this embodiment, the scenario information is information reflecting the application scenario and / or deletion scenario of the data. Specifically, the application scenario is the scenario information of the data when it is applied. For example, if the first data is real data generated during sales, the application scenario information of the first data can be a real sales scenario; if the first data is simulated data generated during testing, the application scenario information of the first data can be a virtual test scenario. The deletion scenario is the scenario information of the data when it is deleted, which may include the deleter and the reason for deletion. For example, if the first data is order data, the scenarios for deleting the first data can be divided into: user canceling the order and order timeout and non-payment. Among them, the clearing person for user canceled order is the user, and the reason is that the user actively canceled; the clearing person for order timeout and non-payment is the system, and the reason is that the timeout and non-payment. Based on the scenario information, the original application environment and / or the reason for deletion of the first data can be determined. In actual applications, due to the different application environments and / or reasons for deletion of the data, different deletion logics will be adopted to delete the data.

[0095] Based on this, in this implementation, a corresponding deletion method can be defined for each deletion logic through a top-level abstract interface to obtain a first interface corresponding to each deletion logic. Then, each first interface is encapsulated, and based on the first abstract class corresponding to each deletion logic obtained after encapsulation, a corresponding deletion service is generated for each deletion logic. The above method of generating the first interface, the first abstract class and the deletion service can refer to the relevant description in the above implementation, and can solve the same technical problem and achieve the same technical effect, which will not be repeated here.

[0096] Therefore, in this embodiment, each deletion logic in the system has a corresponding deletion service, and relevant policies can be pre-configured to associate different deletion logics with different scenario information. Then, after listening to the deletion event ApplicationEvent, the unique key and scenario information of the first data can be obtained. Then, based on the scenario information query configuration of the relevant policies, determine the deletion logic of the associated data of the first data, and then call the deletion service corresponding to the deletion logic. Finally, the unique key is passed to the deletion service, and by instantiating the deletion service, the associated data of the first data is deleted, thereby achieving more refined data deletion. The above method of deleting the associated data of the first data based on the unique key of the first data can also refer to the relevant explanations in the above embodiment, and can solve the same technical problems and achieve the same technical effects, which will not be repeated here.

[0097] Below, a data table acquisition method provided by the present application will be described in detail with a specific example. The example is implemented based on the combination framework of Mybatis+MybatisPlus. Of course, other frameworks can also be applied to the present application. The following example does not limit the present application to the combination framework of Mybatis+MybatisPlus.

[0098] First, the Mybatis and MybatisPlus frameworks will be described separately:

[0099] Mybatis: A persistence layer framework, an open source framework used to connect to the database and perform addition, modification and query operations on it. The underlying layer is a component encapsulated by the Java language to connect to the database (Java DataBase Connectivity, JDBC). The SQL statements for accessing the database are stored in the Extensible Markup Language (XML) configuration file under the mapper (Mapper) or data access object (Data Access Object, DAO).

[0100] MybatisPlus: An enhancement tool for MyBatis. MyBatisPlus provides the IService interface and IServiceImpl implementation class, and encapsulates some Create-Read-Update-Delete (CRUD) methods. There is no need to write XML. Most CRUD operations of a single table can be implemented through a small amount of configuration. These methods can be called directly when used.

[0101] The following is a detailed description of this example:

[0102] 1. Pre-configuration processing:

[0103] 1.1. For cleaning methods and data tables:

[0104] First, define a method removeByUniqueueKey() for obtaining a data table based on the unique key of the data. Then, further encapsulate the IService interface in MybatisPlus, provide a top-level abstract interface (first interface) named IRemoveByUniqueueKeyService, and make IRemoveByUniqueueKeyService include the removeByUniqueueKey(). Then, encapsulate IRemoveByUniqueueKeyService in the ServiceImpl implementation class to obtain a top-level abstract class (first abstract class) named AbstractCommonServiceImpl, and implement the removeByUniqueueKey() method. Finally, make the service implementation classes of all associated data tables in the system inherit the AbstractCommonServiceImpl so that each associated data table can implement the IRemoveByUniqueueKeyService interface.

[0105] 1.2. For monitoring:

[0106] Define an Event event that inherits ApplicationEvent, as follows:

[0107] public class MessageEvent extends ApplicationEvent{

[0108] String caseNo;

[0109] String scene;

[0110] …

[0111] }

[0112] Among them, caseNo represents the unique key of the data, and scene represents the scene information of the data.

[0113] 2. Deletion process:

[0114] like Figure 5 As shown, in this embodiment, when the first data is deleted, or when a request is made to delete the associated data of the first data, the x-service sends an ApplicationEvent:

[0115] applicationContext.publishEvent(new MessageEvent(xxx))

[0116] At this time, a deletion event MessageEvent may be generated, which includes the unique key caseNo of the first data and the scene information scene according to the definition of MessageEvent in 1.2.

[0117] Then, the x-message-event module monitors MessageEvent by setting the unified asynchronous monitoring handler MessageHandler. The MessageHandler configuration is as follows:

[0118] public class MessageHandler {

[0119] @Async

[0120] @EventListener({MessageEvent.class})

[0121] public void handle(MessageEvent messageEvent){

[0122] messageConsumeProxyService.consume(messageEvent)

[0123] }}

[0124] Among them, @Async indicates that the monitoring is asynchronous monitoring, and MessageHandler uses the preset strategy to call the service class of the deletion service RemoveByUniqueueComsumeService corresponding to the scene information through the scene information in the messageEvent to execute the deletion method in the cleanup service.

[0125] In this embodiment, the deletion service RemoveByUniqueueComsumeService includes a deletion method removeByUniqueueKey(). When RemoveByUniqueueComsumeService is instantiated, it will inject all beans that implement the IRemoveByUniqueueKeyService interface through Spring's bean injection method. Specifically, since the service class of the associated data table inherits AbstractCommonServiceImpl in the above 1.1, the associated data table can be regarded as implementing the methods in the IRemoveByUniqueueKeyService interface encapsulated by AbstractCommonServiceImpl. Therefore, through the bean injection method, all associated data tables that inherit AbstractCommonServiceImpl, or implement the IRemoveByUniqueueKeyService interface, can be obtained.

[0126] In this implementation, the injection method is a Map structure:

[0127] Map<String,IRemoveByUniqueueKeyService>

[0128] Among them, String is the table name of the associated data table or other string that can uniquely identify the associated data table, and IRemoveByUniqueueKeyService is the interface name.

[0129] Finally, the associated data tables in the Map structure are traversed, and the unique key is passed into the implementation class of each associated data table, so as to execute the removeByUniqueueKey() method in the IRemoveByUniqueueKeyService interface in each associated data table, that is, to determine whether each associated data table contains associated data of the first data according to the unique key, and if so, delete the determined associated data.

[0130] Specifically, the removeByUniqueueKey() method can use Lambda to write UpdateWrapper update statements, obtain the mapper corresponding to the service through this.getBaseMapper, and execute UpdateWrapper to delete the associated data in the associated data table that implements the IRemoveByUniqueueKeyService interface. Therefore, the definition of 1.1AbstractCommonServiceImpl above is as follows:

[0131] public abstract class AbstractCommonServiceImpl <M extends BaseMapper <t>,T extends BaseEntity>

[0132] extends ServiceImpl<M,T>implements IRemoveByUniqueueKeyService{

[0133] @Override

[0134] public int removeByUniqueueKey(String uniqueueKey){

[0135] UpdateWrapper <t>updateWrapper=new UpdateWrapper<>();

[0136] updateWrapper.set("deleted",1)

[0137] .eq(this.caseNo,caseNo)

[0138] .eq("deleted",0);

[0139] return this.getBaseMapper().update(null,updateWrapper);}}

[0140] First, AbstractCommonServiceImpl is declared as an abstract class, which has two generic parameters, M and T, which represent the Mapper type and entity class type of the data access layer respectively. Then, through the extends keyword, the AbstractCommonServiceImpl class inherits the ServiceImpl class. The ServiceImpl class is a basic service class provided by the MyBatis-Plus framework, which is used to provide basic database operation methods. And through the implements keyword, the AbstractCommonServiceImpl class implements the IRemoveByUniqueueKeyService interface. This interface defines a method removeByUniqueueKey(), which is used to delete data based on the business unique key. @Override is an annotation that indicates that the method overrides or rewrites the method in the parent class or interface. Then, the removeByUniqueueKey() method is declared to receive the String type parameter uniqueueKey (that is, the unique key caseNo) to execute the removeByUniqueueKey() method.

[0141] In this method, an UpdateWrapper object is first created to construct the conditions for the update operation. The update operation is set and the value of the deleted field is set to 1, indicating that the data is marked as deleted. At the same time, conditions are added. The updated data needs to meet the following conditions: (1) The this.caseNo of the updated data is required to be equal to caseNo, so that only the data with the same caseNo as the first data, that is, the related data, will be deleted; (2) The value of the deleted field of the updated data is required to be equal to 0, indicating that only the data that has not been marked for deletion will be deleted. Finally, the getBaseMapper() method is called to obtain the basic Mapper object, and its update() method is called to apply the update operation to the associated data table.

[0142] Therefore, when the removeByUniqueueKey() method is executed, the data in the data table whose unique key is the same as the unique key of the first data and whose deletion field is 0 is selected as the associated data of the first data, and its deletion field is changed to 1 to delete the associated data of the first data. This avoids the SQL injection risk caused by using SQL to perform cleanup by splicing the table name of the associated data table through the ${} method.

[0143] The above mainly introduces the scheme of the implementation method of the present application from the perspective of the method side. It is understandable that in order to realize the above functions, the terminal device includes a hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the implementation method disclosed in this article, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can 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.

[0144] The implementation method of the present application can divide the functional units of the terminal device according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one functional module. The above integrated module can be implemented in the form of hardware or in the form of a software program module. It should be noted that the division of modules in the implementation method of the present application is schematic and is only a logical function division, and there may be other division methods in actual implementation.

[0145] In the case of integrated modules, Figure 6 The data table acquisition device 600 includes an inheritance module 601 and an acquisition module 602 .

[0146] In this implementation, the inheritance module 601 and the acquisition module 602 may be a module for receiving and processing signals, information, etc. or determining a monitoring mechanism, and there is no specific limitation on this.

[0147] In this embodiment, the data table acquisition device 600 may further include a storage module for computer program codes or instructions executed by the data table acquisition device 600. The storage module may be a memory.

[0148] In this embodiment, the data table acquisition device 600 may be a chip or a chip module.

[0149] In this embodiment, the inheritance module 601 and the acquisition module 602 may be integrated into a communication module, wherein the communication module may be a communication interface, a transceiver, a transceiver circuit, and the like.

[0150] In this implementation, the inheritance module 601 and the acquisition module 602 may be integrated into the processing module.

[0151] It should be noted that the processing module can be a processor or a controller, for example, a baseband processor, a baseband chip, a central processing unit (CPU), a general processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processing module can also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0152] In this embodiment, the data table acquisition device 600 is used to execute any step executed by the terminal device / chip / chip module, etc. in the above method implementation.

[0153] In specific implementation, the inheritance module 601 and the acquisition module 602 are used to execute any step in the above method implementation, and when executing actions such as sending, other modules can be selectively called to complete corresponding operations.

[0154] An inheritance module 601 is used to encapsulate the first interface, obtain a first abstract class, inherit the first abstract class through the implementation class of the data table, and create an inheritance relationship between the implementation class of the data table and the first abstract class;

[0155] The acquisition module 602 is used to acquire the data table according to the inheritance relationship between the implementation class of the data table and the first abstract class.

[0156] In this implementation, in terms of creating an inheritance relationship between the implementation class of the data table and the first abstract class by inheriting the first abstract class through the implementation class of the data table, the inheritance module 601 is specifically used to:

[0157] Add the class name of the first abstract class after the class name of the implementation class of the data table to obtain a new class name of the implementation class of the data table;

[0158] By adding the new class name of the implementation class of the data table as an instance of the first abstract class, an inheritance relationship between the implementation class of the data table and the first abstract class is created.

[0159] In this implementation, in the aspect of acquiring the data table according to the inheritance relationship between the implementation class of the data table and the first abstract class, the acquisition module 602 is specifically used to:

[0160] Creating a first service, wherein the first service depends on the first abstract class;

[0161] According to the inheritance relationship, configuring the implementation class as an injection instance of the first service;

[0162] The data table is obtained according to the injection instance.

[0163] In this embodiment, the data table acquisition device 600 further includes a deletion module, which is used to execute the following method after acquiring the data table according to the inheritance relationship between the implementation class of the data table and the first abstract class:

[0164] Get the unique key of the first data;

[0165] The data table is traversed according to the unique key, and the associated data of the first data is deleted.

[0166] In this implementation, in the aspect of traversing the data table according to the unique key and deleting the associated data of the first data, the deletion module is specifically used to:

[0167] When the unique key is passed into the implementation class of the data table, the data table is traversed according to the unique key, and if it is determined that the data table contains associated data of the first data, the associated data of the first data is deleted.

[0168] In this implementation, after traversing the data table according to the unique key, the deletion module is further used to:

[0169] In a case where the key value of the unique key of the associated data of the first data is determined based on the key value of the unique key of the first data, it is determined that the data table includes the associated data of the first data.

[0170] In this implementation, in the aspect of deleting the associated data of the first data, the deletion module is specifically used to:

[0171] The associated data of the first data is deleted by updating the field value of the associated data deletion field of the first data from a first value to a second value, wherein the first value is used to identify that the data status of the associated data of the first data is not deleted, and the second value is used to identify that the data status of the associated data of the first data is deleted.

[0172] In this implementation, in the aspect of obtaining the unique key of the first data, the deletion module is specifically used to:

[0173] Creating a monitoring module for monitoring a cleanup event of the first data, wherein the deletion event is used to indicate that the first data is deleted, or that data associated with the first data is requested to be deleted;

[0174] When the cleaning event is monitored by the monitoring module, a unique key of the first data is obtained.

[0175] See also Figure 7 , Figure 7 7 is a schematic diagram of a structure of an electronic device proposed in an embodiment of the present application. The electronic device 700 may include a processor 710, a memory 720, and a communication bus for connecting the processor 710 and the memory 720.

[0176] Optionally, the memory 720 includes but is not limited to random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) or portable read-only memory (CD-ROM), and the memory 720 is used to store the program code executed by the electronic device 700 and the transmitted data.

[0177] In this embodiment, the electronic device 700 further includes a communication interface for receiving and sending data.

[0178] In this implementation, the processor 710 may be one or more CPUs. When the processor 710 is a CPU, the CPU may be a single-core CPU or a multi-core CPU.

[0179] In this embodiment, the processor 710 can be a baseband chip, a chip, a CPU, a general-purpose processor, a DSP, an ASIC, an FPGA or other programmable logic devices, transistor logic devices, hardware components or any combination thereof.

[0180] In a specific implementation, the processor 710 in the electronic device 700 is used to execute the computer program or instruction 721 stored in the memory 720 to perform the following operations:

[0181] Encapsulate the first interface to obtain the first abstract class;

[0182] Inheriting the first abstract class through the implementation class of the data table, and creating an inheritance relationship between the implementation class of the data table and the first abstract class;

[0183] The data table is obtained according to the inheritance relationship between the implementation class of the data table and the first abstract class.

[0184] It should be noted that Figure 7 The specific implementation of each operation in the implementation method can be found in the description of the method implementation method shown above, and will not be described in detail here.

[0185] The present application also provides a computer-readable storage medium storing a computer program or instructions, which implements the steps described in the above method implementation when executed.

[0186] The embodiment of the present application also provides a computer program product, including a computer program or instructions, which implement the steps described in the above method embodiment when executed.

[0187] It should be noted that, for the above-mentioned various embodiments, for the sake of simple description, they are all expressed as a series of action combinations. Those skilled in the art should be aware that the present application is not limited by the described order of actions, because some steps in the embodiments of the present application can be performed in other orders or simultaneously. In addition, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions, steps, modules or units involved are not necessarily required for the embodiments of the present application.

[0188] In the above-mentioned embodiments, the description of each embodiment of the present application has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0189] The steps of the method or algorithm described in the embodiments of the present application can be implemented in hardware or by executing software instructions by a processor. The software instructions can be composed of corresponding software modules, and the software modules can be stored in RAM, flash memory, ROM, EPROM, electrically erasable programmable read-only memory (electrically EPROM, EEPROM), registers, hard disks, mobile hard disks, read-only compact disks (CD-ROMs) or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a terminal device or a management device. Of course, the processor and the storage medium can also be present in a terminal device or a management device as discrete components.

[0190] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiments of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital video disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).

[0191] The modules / units included in the devices and products described in the above embodiments may be software modules / units or hardware modules / units, or may be partially software modules / units and partially hardware modules / units. For example, for the devices and products applied to or integrated in the chip, the modules / units included therein may all be implemented in the form of hardware such as circuits, or at least some of the modules / units may be implemented in the form of software programs, which run on the processor integrated inside the chip, and the remaining (if any) modules / units may be implemented in the form of hardware such as circuits; for the devices and products applied to or integrated in the chip module, the modules / units included therein may all be implemented in the form of hardware such as circuits, and different modules / units may be located in the same component (such as a chip, circuit module, etc.) or in different components of the chip module, or at least some of the modules / units may be implemented in the form of software programs. The software programs run on the processor integrated inside the chip, and the remaining (if any) modules / units may be implemented in the form of hardware such as circuits. It is implemented in the form of a software program, which runs on a processor integrated inside the chip module, and the remaining (if any) modules / units can be implemented in hardware such as circuits; for various devices and products applied to or integrated in the terminal equipment, the various modules / units contained therein can be implemented in hardware such as circuits, and different modules / units can be located in the same component (for example, chip, circuit module, etc.) or in different components in the terminal equipment, or, at least some modules / units can be implemented in the form of a software program, which runs on a processor integrated inside the terminal equipment, and the remaining (if any) modules / units can be implemented in hardware such as circuits.

[0192] The specific implementation methods described above further illustrate the purpose, technical solutions and beneficial effects of the implementation methods of the present application. It should be understood that the above description is only the specific implementation method of the implementation method of the present application and is not intended to limit the protection scope of the implementation method of the present application. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the implementation methods of the present application should be included in the protection scope of the implementation methods of the present application.< / t> < / t>

Claims

1. A data table acquisition method, characterized in that: The method comprises: Encapsulate the first interface to obtain the first abstract class; Inheriting the first abstract class through the implementation class of the data table, and creating an inheritance relationship between the implementation class of the data table and the first abstract class; The data table is obtained according to the inheritance relationship between the implementation class of the data table and the first abstract class.

2. The method according to claim 1, characterized in that The step of inheriting the first abstract class through the implementation class of the data table and creating an inheritance relationship between the implementation class of the data table and the first abstract class includes: Add the class name of the first abstract class after the class name of the implementation class of the data table to obtain a new class name of the implementation class of the data table; By adding the new class name of the implementation class of the data table as an instance of the first abstract class, an inheritance relationship between the implementation class of the data table and the first abstract class is created.

3. The method according to claim 2, characterized in that The acquiring the data table according to the inheritance relationship between the implementation class of the data table and the first abstract class includes: Creating a first service, wherein the first service depends on the first abstract class; According to the inheritance relationship, configuring the implementation class as an injection instance of the first service; The data table is obtained according to the injection instance.

4. The method according to claim 3, characterized in that After acquiring the data table according to the inheritance relationship between the implementation class of the data table and the first abstract class, the method further includes: Get the unique key of the first data; The data table is traversed according to the unique key, and the associated data of the first data is deleted.

5. The method according to claim 4, characterized in that The traversing the data table according to the unique key and deleting the associated data of the first data includes: When the unique key is passed into the implementation class of the data table, the data table is traversed according to the unique key, and if it is determined that the data table contains associated data of the first data, the associated data of the first data is deleted.

6. The method according to claim 5, characterized in that After traversing the data table according to the unique key, the method further includes: In a case where the key value of the unique key of the associated data of the first data is determined based on the key value of the unique key of the first data, it is determined that the data table includes the associated data of the first data.

7. The method according to any one of claims 4 to 6, characterized in that: The deleting the associated data of the first data includes: The associated data of the first data is deleted by updating the field value of the deletion field of the associated data of the first data from a first value to a second value, wherein the first value is used to identify that the data status of the associated data of the first data is not deleted, and the second value is used to identify that the data status of the associated data of the first data is deleted.

8. The method according to any one of claims 4 to 7, characterized in that: The obtaining the unique key of the first data includes: Creating a monitoring module for monitoring a deletion event of the first data, wherein the deletion event is used to indicate that the first data is deleted, or that data associated with the first data is requested to be deleted; When the deletion event is monitored by the monitoring module, a unique key of the first data is obtained.

9. A data table acquisition device, characterized in that: The device comprises: An inheritance module, used for encapsulating the first interface, obtaining a first abstract class, inheriting the first abstract class through the implementation class of the data table, and creating an inheritance relationship between the implementation class of the data table and the first abstract class; An acquisition module is used to acquire the data table according to the inheritance relationship between the implementation class of the data table and the first abstract class.

10. An electronic device comprising a processor, a memory and a computer program or instruction stored in the memory, characterized in that: The processor executes the computer program or instructions to implement the steps of the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program or instructions, and when the computer program or instructions are executed, the steps of the method according to any one of claims 1 to 8 are performed.