Method, device and terminal for managing associated data, and readable storage medium

By using aspect-oriented programming components and Java reflection mechanisms to parse data attributes in the platform software and performing synchronous management based on the association logic configuration table, the problem of complex processing of associated data during the deletion of business data is solved, achieving efficient data management and improved user experience.

CN115794770BActive Publication Date: 2026-03-20SHENZHEN KANGBIDA CONTROL TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-21
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

The existing platform software involves complex and labor-intensive processing of associated data during the deletion of business data, and the existing deletion method suffers from performance issues and a poor user experience.

Method used

By using aspect-oriented programming components to weave in predefined annotations, and parsing the target business data attributes through the JAVA reflection mechanism, synchronous management operations are performed based on the associated logic configuration table, reducing development complexity.

Benefits of technology

It enables synchronized management of business data and its related data, reducing development workload, improving code usability, and enhancing user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115794770B_ABST
    Figure CN115794770B_ABST
Patent Text Reader

Abstract

The application provides a management method and device of associated data, a terminal and a readable storage medium, and the method comprises the following steps: when a management operation is performed on target service data, if an operation of the target service data is added with a predefined annotation, an associated data management method matched with the predefined annotation is woven into an execution method of the target service data based on an aspect programming component; an attribute of the target service data is acquired; the attribute comprises a table and / or a field; the associated data management method is executed based on the attribute of the target service data, and the associated data management method is used for synchronously performing a management operation on the target service data and service data corresponding to associated attributes of the target service data. The application implements a synchronous associated data management method of service data and associated data in the aspect programming mode, and complex data association logic does not need to be written in the service layer, so that development workload is saved, and the availability of code is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of software development, and in particular to a management method and device of associated data, a terminal and a readable storage medium. BACKGROUND

[0002] In the process of deleting business data, the existing platform software often has problems of data deletion and associated data being affected. Many times, developers will handle database data deletion from the following aspects:

[0003] 1. Logical deletion is performed to maintain the loss of associated data and to prevent lookup failure or invalidation;

[0004] 2. The external association key of the database is used to perform associated deletion, and the associated business is deleted together at the database level;

[0005] 3. The business code is analyzed to determine whether deletion is possible, and an associated deletion script is written logically;

[0006] The above-mentioned deletion methods of the database association all have different disadvantages. Logical deletion can cause pressure on the database, and invalid data that is not needed by the user exists in the database, which causes performance problems of IO operation. External association deletion directly deletes associated data from the database level, which causes poor user experience, and the data association is too strong, and the use of the external association key can cause inconvenience in the addition, deletion and modification of the database. Each business logic increases the judgment to write a database associated deletion script, which also brings repeated and troublesome logic processing to the developers. SUMMARY

[0007] Therefore, the present application provides a management method and device of associated data, a terminal and a readable storage medium, which can solve the problem of complex and large workload in the process of processing associated data of business data in the management process.

[0008] In a first aspect, an embodiment of the present application provides a management method of associated data, comprising:

[0009] When a management operation is performed on target business data, if the operation of the target business data adds a predefined annotation, a corresponding associated data management method is woven into the execution method of the target business data based on an aspect programming component, which matches the predefined annotation;

[0010] An attribute of the target business data is obtained; the attribute includes a table and / or a field;

[0011] The associated data management method is executed based on the attribute of the target business data, and the associated data management method is used to perform a management operation on the target business data and the business data corresponding to the associated attribute of the target business data.

[0012] In a second aspect, an embodiment of the present application provides a management device for associated data, comprising:

[0013] An association logic starting module is configured to, when a management operation is performed on target business data, if a predefined annotation is added to the operation of the target business data, based on an aspect programming component, weaving an associated data management method matching the predefined annotation into an execution method of the target business data.

[0014] An attribute acquisition module is configured to acquire attributes of the target business data, wherein the attributes include tables and / or fields.

[0015] An associated data management operation module is configured to execute the associated data management method, wherein the associated data management method is configured to perform a management operation on the target business data and business data corresponding to associated attributes of the target business data.

[0016] In a third aspect, an embodiment of the present application provides a terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements steps of the method according to any possible implementation manner of the first aspect.

[0017] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executable on a processor to implement steps of the method according to any possible implementation manner of the first aspect.

[0018] Compared with the prior art, the embodiment of the present application has the following beneficial effects:

[0019] Firstly, when a management operation is performed on target business data, if a predefined annotation is added to the operation of the target business data, based on an aspect programming component, an associated data management method matching the predefined annotation is woven into an execution method of the target business data; attributes of the target business data are acquired, wherein the attributes include tables and / or fields; and based on the attributes of the target business data, the associated data management method is executed, wherein the associated data management method is configured to perform a management operation on the target business data and business data corresponding to associated attributes of the target business data. The embodiment of the present application implements a synchronous associated data management method for business data and associated data by using an aspect programming mode, and does not need to write complex data association logic in a business layer, thereby saving development workload and improving code usability. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the drawings in the following description only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor.

[0021] Figure 1 is the implementation flowchart of the management method of the associated data provided by the embodiments of the present application;

[0022] Figure 2 is the schematic diagram of the code program provided by the embodiments of the present application;

[0023] Figure 3 is the schematic diagram of the associated logic configuration table provided by the embodiments of the present application;

[0024] Figure 4 is the overall flowchart of the management method of the associated data provided by the embodiments of the present application;

[0025] Figure 5 is the structural schematic diagram of the management device of the associated data provided by the embodiments of the present application;

[0026] Figure 6 is the schematic diagram of the terminal provided by the embodiments of the present application. DETAILED DESCRIPTION

[0027] In the following description, specific details are set forth in order to provide a thorough understanding of the embodiments of the present application. However, persons skilled in the art will understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary details.

[0028] In order to make the objects, technical solutions and advantages of the present application clearer, the following will be described by specific embodiments in conjunction with the drawings.

[0029] Referring to Figure 1 , which shows the implementation flowchart of the management method of the associated data provided by the embodiments of the present application, the method is applied to the service layer of the terminal, and the details are as follows:

[0030] S101: When performing a management operation on target service data, if the operation of the target service data is added with a predefined annotation, the aspect programming component is used to weave the associated data management method matched with the predefined annotation into the execution method of the target service data.

[0031] Specifically, the method provided in this application is mainly applied to data service-based methods, which mainly involve adding, modifying, deleting, and querying data in a database.

[0032] When performing business data management operations, the terminal device obtains the attributes of the target business data and performs management operations on the business data corresponding to the attributes of the target business data.

[0033] Aspect-Oriented Programming (AOP) primarily aims to extract aspects of a business process, focusing on a specific step or stage to achieve low coupling and isolation between different parts of the logic. In practice, this can be achieved by using a dynamic proxy class to intercept the behavior of an object and add the necessary functionalities.

[0034] This embodiment employs aspect-oriented programming, inserting a pointcut before the execution method to weave annotations into it. This execution method performs management operations on the target business data. The annotation is a user-defined API (Application Programming Interface), very simple to use; simply add the associated data management method annotation to the business data operation. The annotation includes the category of the management operation, which can include delete and modify. That is, if the management operation is delete, a delete operation is performed on the target business data; if the management operation is modify, a modify operation is performed on the target business data.

[0035] like Figure 2 As shown, Figure 2 The example code demonstrates a specific implementation, annotated with `@ModelSumbit(flagDelete = true)`. The operation category is `Delete`, and this annotation is inserted before the execution method `int delete(@Param(“ids”)String ids)`, where `ids` represents the target business data.

[0036] Specifically, each annotation corresponds to a related data management method, which is used to perform synchronous management operations on the target business data and its related data.

[0037] S102: Obtain the attributes of the target business data; the attributes include tables and / or fields;

[0038] In one possible implementation, the specific implementation process of S102 includes:

[0039] The JAVA reflection mechanism is used to inversely analyze the corresponding attribute from the target business data, and the attribute includes a table or a field.

[0040] Specifically, the JAVA reflection mechanism can determine the class to which an arbitrary object belongs at runtime, construct an object of an arbitrary class at runtime, determine the member variables and methods of an arbitrary class at runtime, and invoke the method of an arbitrary object at runtime. Through the JAVA reflection mechanism, the embodiment can inversely analyze the corresponding attribute from the query statement containing the target business data.

[0041] In the embodiment, if the target business data and the associated data are to be deleted from the database, the table and the field corresponding to the target business data can be first analyzed by the JAVA reflection mechanism to determine the table and the field to be deleted.

[0042] S103: Perform the associated data management method based on the attribute of the target business data, and the associated data management method is used to synchronously perform a management operation on the business data corresponding to the target business data and the associated attribute.

[0043] In one possible implementation, the specific implementation process of S103 includes:

[0044] Determine the associated attribute and the synchronous management instruction corresponding to the attribute based on the associated logic configuration table corresponding to the attribute;

[0045] If the synchronous management instruction is yes, synchronously manage the business data corresponding to the target business data and the associated attribute;

[0046] If the synchronous management instruction is no, only delete the target business data.

[0047] In one possible implementation, the management operation includes deletion and modification.

[0048] In the embodiment, the associated attribute includes a table and a field. The database stores a user-advanced configured associated logic configuration table, and the associated logic configuration table includes an associated deletion logic configuration table, as shown in the following table: Figure 3 The attribute corresponding to the target business data includes a deleted table and a deleted outer associated field, and the associated attribute corresponding to the attribute of the target business data is the field of the associated table and the outer associated table. If the value of whether to synchronously delete the outer associated data is yes, the synchronous management instruction is yes, and if the value of whether to synchronously delete the outer associated data is no, the synchronous management instruction is no. The specific execution method of the configuration can also be described in detail in the associated logic configuration table.

[0049] For example, if the target business data is an alarm level and the attribute is an alarm mode, the detailed description is as follows:Figure 3 As shown: Alarm level deletion, it is determined whether the alarm methods are related. If they are related, the related data will not be deleted.

[0050] In this embodiment, the attributes of the target business data may include multiple associated attributes, and each associated attribute corresponds to a synchronization management instruction, which is used to determine whether the target business data corresponding to the associated attribute needs to be synchronized.

[0051] In one possible implementation, prior to S103, the method provided in this embodiment further includes:

[0052] Determine whether the associated data management method is enabled;

[0053] If the associated data management method is enabled, then the associated data management method is executed;

[0054] If the associated data management method is not enabled, then management operations are performed on the target business data.

[0055] In this embodiment, as Figure 3 As shown, the association logic configuration table also records information on whether the association data management method is enabled. If the information in the association logic configuration table indicates that the method is enabled, the association data management method will be executed; if the information indicates that the method is not enabled, the association data management method will not be executed.

[0056] In one possible implementation, if there is no associated attribute corresponding to the target business data in the associated logic configuration table, the associated data management method will not be executed.

[0057] In this embodiment, Figure 4 This embodiment shows an overall flowchart of the business data and its associated data, as follows: Figure 4 As shown, the associated data management method is encapsulated into a package, which can be easily inserted into any data operation. During the execution of the deletion operation of business data, if there is an annotation, the util package of the associated data management method is called. This util package is used to obtain the table and field to be deleted in the business layer, and to obtain the associated logic configuration table pre-stored in the MySQL database. From the associated logic configuration table, the associated tables and external associated fields of the table and field to be deleted are determined. If the associated tables and external associated fields of the table and field to be deleted exist in the associated logic configuration table, the business data of the table and field to be deleted and the business data corresponding to the associated attributes are deleted. If the associated tables and external associated fields of the table and field to be deleted do not exist in the associated logic configuration table, the execution flow of the associated data management method ends.

[0058] The management method of associated data provided by the embodiment can solve the complexity of the separate processing of the logical deletion of the developer, and the operation of whether the associated data needs to be deleted can be uniformly configured without coding. As long as the business layer triggers the deletion button, the data associated with other tables can be processed by the shared aspect programming code to determine whether the associated data needs to be deleted, thereby saving the development workload and flexibly configuring the operation logic of the associated data, improving the availability of the code and reducing the repeated work of the developer.

[0059] It should be understood that the size of the serial number of each step in the above embodiment does not mean the order of execution, and the execution order of each process should be determined according to its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the application.

[0060] The following is a device embodiment of the application, and for details not described in detail, reference can be made to the corresponding method embodiments described above.

[0061] Figure 5 A structure diagram of the management device of associated data provided by the embodiment of the application is shown, only the parts related to the embodiment of the application are shown for the convenience of description, and the details are as follows:

[0062] As shown in Figure 5 The management device of associated data 100 includes:

[0063] The association logic starting module 110 is configured to, when a management operation is performed on target business data, if the operation of the target business data is added with a predefined annotation, weave an association data management method matched with the predefined annotation into an execution method of the target business data based on an aspect programming component.

[0064] The attribute acquisition module 120 is configured to acquire attributes of the target business data; the attributes include tables and / or fields.

[0065] The associated data management operation module 130 is configured to execute the association data management method, and the association data management method is configured to synchronously perform a management operation on the target business data and the business data corresponding to the associated attributes of the target business data.

[0066] In one possible implementation, the attribute acquisition module 120 includes:

[0067] The corresponding attributes are inversely parsed from the target business data by using a JAVA reflection mechanism.

[0068] In one possible implementation, the associated data management operation module 130 includes:

[0069] Based on the associated logic configuration table corresponding to the attribute, determine the associated attribute and synchronization management instructions corresponding to the attribute;

[0070] If the synchronization management instruction is yes, then the target business data and the business data corresponding to its associated attributes are synchronized and managed.

[0071] If the synchronization management instruction is not specified, then only the target business data will be deleted.

[0072] In one possible implementation, the management operations include deletion and modification.

[0073] In one possible implementation, the device 100 further includes an enable determination module for:

[0074] Determine whether the associated data management method is enabled;

[0075] If the associated data management method is enabled, then the associated data management method is executed;

[0076] If the associated data management method is not enabled, then management operations are performed on the target business data.

[0077] The data management device provided in this embodiment solves the complexity of handling logical deletion separately for developers. It eliminates the need to implement the deletion operation for related data in each business layer; instead, it only requires unified configuration without further coding. Currently, whenever the business layer triggers the delete button, if this data is related to data in other tables, the deletion of related data can be handled through shared aspect-oriented programming code, saving development workload and allowing for flexible configuration of the operation logic for related data. This improves code usability and reduces repetitive work for developers.

[0078] The associated data management device provided in this embodiment can be used to execute the above-described associated data management method embodiment. Its implementation principle and technical effect are similar, and will not be described again here.

[0079] Figure 6 This is a schematic diagram of a terminal provided in an embodiment of the present invention. For example... Figure 6 As shown, the terminal 6 in this embodiment includes: a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and executable on the processor 60. When the processor 60 executes the computer program 62, it implements the steps in the above-described embodiments of the methods for managing associated data, for example... Figure 1 Steps S101 to S103 are shown. Alternatively, when the processor 60 executes the computer program 62, it implements the functions of each module / unit in the above-described device embodiments, for example... Figure 5 The functions of modules 110 to 130 are shown.

[0080] By way of example, the computer program 62 can be segmented into one or more modules / units stored in the memory 61 and executed by the processor 60 to accomplish the present application. The one or more modules / units can be a series of computer program instruction segments capable of accomplishing a specific function, which are used to describe the execution process of the computer program 62 in the terminal 6.

[0081] The terminal 6 can be a computing device such as a desktop computer, a notebook computer, a palm computer, a cloud server, etc. The terminal 6 can include, but is not limited to, the processor 60 and the memory 61. Those skilled in the art can understand that the terminal 6 can include more or fewer components, or combine certain components, or include different components, such as input / output devices, network access devices, buses, etc. Figure 6 The terminal 6 is merely an example and does not constitute a limitation on the terminal 6, which can include more or fewer components than shown, or combine certain components, or include different components, such as input / output devices, network access devices, buses, etc.

[0082] The processor 60 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic components, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0083] The memory 61 can be an internal storage unit of the terminal 6, such as a hard disk or a memory of the terminal 6. The memory 61 can also be an external storage device of the terminal 6, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the memory 61 can include both an internal storage unit and an external storage device of the terminal 6. The memory 61 is used to store the computer program and other programs and data required by the terminal. The memory 61 can also be used to temporarily store data that has been output or will be output.

[0084] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be realized in the form of hardware or software. In addition, the specific names of each functional unit and module are only for easy distinction, and do not limit the protection scope of the present application. The specific working process of the units and modules in the above system can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

[0085] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can be referred to the related description of other embodiments.

[0086] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0087] In the embodiments provided by the present application, it should be understood that the disclosed apparatus / terminal and method can be implemented by other ways. For example, the above-mentioned apparatus / terminal embodiments are only schematic, and the division of the modules or units is only a logical function division, and there can be another division way in actual implementation, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0088] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0089] In addition, each function unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function unit.

[0090] The integrated module / unit, if realized in the form of a software function unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above-mentioned embodiment methods can also be completed by a computer program instructing related hardware, and the computer program can be stored in a computer-readable storage medium. When the processor executes the computer program, the steps of the above-mentioned various related data management method embodiments can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate forms, etc. The computer-readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0091] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A method for managing associated data, characterized in that, include: When performing management operations on target business data, if the operation on the target business data has predefined annotations, then the execution method of the target business data is woven with an associated data management method that matches the predefined annotations based on the aspect programming component; the management operations include deletion and modification; Obtain the attributes of the target business data; the attributes include tables and / or fields; The associated data management method is executed based on the attributes of the target business data. The associated data management method is used to synchronously manage the target business data and the business data corresponding to its associated attributes. The execution of the associated data management method based on the attributes of the target business data includes: Based on the associated logic configuration table corresponding to the attribute, determine the associated attribute and synchronization management instructions corresponding to the attribute; If the synchronization management instruction is yes, then the target business data and the business data corresponding to its associated attributes are synchronized and managed. If the synchronization management instruction is not specified, then only the target business data will be managed.

2. The method for managing associated data according to claim 1, characterized in that, The attributes for acquiring the target business data include: The corresponding attributes are extracted from the target business data using Java reflection.

3. The method for managing associated data according to claim 1, characterized in that, Prior to executing the associated data management method, the method further includes: Determine whether the associated data management method is enabled; If the associated data management method is enabled, then the associated data management method is executed; If the associated data management method is not enabled, then management operations are performed on the target business data.

4. A device for managing associated data, characterized in that, include: The association logic initiation module is used to weave an association data management method that matches the predefined annotation into the execution method of the target business data based on the aspect programming component when performing management operations on the target business data. The management operations include deletion and modification. An attribute acquisition module is used to acquire attributes of the target business data; the attributes include tables and / or fields. The associated data management operation module is used to execute the associated data management method based on the attributes of the target business data. The associated data management method is used to synchronously manage the target business data and the business data corresponding to its associated attributes. The associated data management operation module includes: Based on the associated logic configuration table corresponding to the attribute, determine the associated attribute and synchronization management instructions corresponding to the attribute; If the synchronization management instruction is yes, then the target business data and the business data corresponding to its associated attributes are synchronized and managed. If the synchronization management instruction is not specified, then only the target business data will be managed.

5. The data management device according to claim 4, characterized in that, The attribute acquisition module includes: The corresponding attributes are extracted from the target business data using Java reflection.

6. A terminal, characterized in that, It includes a processor and a memory, the memory being used to store a computer program, and the processor being used to call and run the computer program stored in the memory to perform the method as described in any one of claims 1 to 3.

7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 3 above.

Citation Information

Patent Citations

  • Method for realizing custom cache annotation based on redis

    CN111596922A

  • Information management by object-oriented database

    JP2003280977A