A data persistence method and a data persistence system

By establishing a unified standardized model interface and a standardized persistent model tree for each abstract service, the complex problems of developers in the existing technology for the persistence technology of different business in different business are solved, and the reliability of the system and code reuse are improved. simplifies the development process.

CN117390101BActive Publication Date: 2024-12-10SHANGHAI YILEAD INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311333601.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-16
Publication Date
2024-12-10
Estimated Expiration
2043-10-16

AI Technical Summary

Technical Problem

Existing persistence solutions require business developers to have high development capabilities, and different businesses correspond to different persistence technologies, resulting in inefficiency of developers and lack of standardized system models and interface designs.

Method used

Establish a unified standardized model interface for each abstract service, and standardize the standardized model interface and the persistent model tree modeled by the model abstract parent class. Select the corresponding standardized model interface according to the business type of the input data, establish a business model and encapsulate it. , and finally persist it to the database.

Benefits of technology

It improves the reliability and code reuse rate of the persistent system, reduces the learning cost and workload of developers, simplifies the establishment of business models, and enhances the compatibility and user experience of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117390101B_ABST
    Figure CN117390101B_ABST
Patent Text Reader

Abstract

The present invention discloses a data persistence method and a persistence system, which comprises: establishing a unified standardized model interface for each abstract service; standardizing the persistence model tree modeled by the standardized model interface and the model abstract parent class; selecting the corresponding standardized model interface according to the business type of the input data, and establishing the corresponding business model according to the persistence model tree; encapsulating the business model; and persisting the encapsulated business model to a database. By standardizing the system model design and interface, the reliability of the persistence system and the code reuse rate are improved, and the workload of developers is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data persistence, and further to a data persistence method and a persistence system. Background Art

[0002] Existing persistence solutions require business developers to be familiar with specific solutions, have the ability to develop corresponding solutions, and apply one (or a combination of multiple) persistence technologies, combined with business needs, to ultimately achieve persistence operations. This places high demands on business developers. Moreover, it is very complicated that different businesses correspond to different persistence technologies, resulting in low developer efficiency. Existing persistence system model designs and interface designs are varied and not standardized. Summary of the invention

[0003] In order to solve the above technical problems, the present invention provides a data persistence method and a persistence system, which improve the reliability and code reuse rate of the persistence system and reduce the workload of developers.

[0004] Specifically, the technical solution of the present invention is as follows:

[0005] A data persistence method includes the following steps:

[0006] Establish a unified standardized model interface for each abstract service;

[0007] Standardize the model interface and model abstract parent class modeling to create a persistent model tree;

[0008] Select the corresponding standardized model interface according to the business type of the input data, and establish the corresponding business model based on the persistent model tree;

[0009] Encapsulating the business model;

[0010] The encapsulated business model can be persisted in the database.

[0011] By establishing a unified standardized model interface for each abstract service and standardizing the persistent model tree modeled by the standardized model interface and the model abstract parent class, the reliability and code reuse rate of the persistent system are improved. According to the business type of the input data, the corresponding standardized model interface is selected, and the corresponding business model is established according to the persistent model tree. Then, the business model is encapsulated and persisted to the database. The business model established according to the standardized persistent model tree is relatively simple, which reduces the learning cost and reduces the workload of developers.

[0012] In some implementations, encapsulating the business model specifically includes the steps of:

[0013] The business model corresponding to the input data is encapsulated as a business model in RawData data format.

[0014] By encapsulating the business model corresponding to the input data into a business model in the RawData data format, the reliability of the persistent system is further improved.

[0015] In some embodiments, the steps are further included:

[0016] An AOP behavior mechanism is set, and when the business model in the RawData data format executes the AOP behavior, an annotation of the AOP behavior is added.

[0017] By setting the AOP behavior mechanism and adding annotations of the AOP behavior when the business model in the RawData data format executes the AOP behavior, the persistent system is expanded, thereby improving the compatibility and user experience of the persistent system.

[0018] In some implementations, the encapsulated business model may be persisted to a database, specifically comprising the steps of:

[0019] Verifying the business model parameters in the RawData data format;

[0020] The verified business model in the RawData data format is converted into an entity object.

[0021] In some implementations, after converting the verified business model in the RawData data format into an entity object, the step of:

[0022] When the business model in the RawData data format triggers a preset characteristic Handler mechanism, the business model in the RawData data format is service expanded.

[0023] In some implementations, after persisting the encapsulated business model to a database, the process further includes the following steps:

[0024] The associated objects of the business model can be persisted to the database according to preset configuration rules.

[0025] In some embodiments, the steps are further included:

[0026] In the process of persisting the business model in the RawData data format to the database, the encoding of the business model in the RawData data format is automatically generated according to the preset model encoding rules.

[0027] In some implementations, after persisting the encapsulated business model to a database, the process further includes the following steps:

[0028] A mapping is established between each attribute of the business model in the RawData data format and a corresponding front-end component, and the business model in the RawData data format is displayed to the user interface of the persistent system according to the mapping.

[0029] A persistent system, comprising:

[0030] A client sends data to the encapsulation layer;

[0031] An encapsulation layer, which is used to establish a unified standardized model interface for each abstract service;

[0032] The encapsulation layer is also used to standardize the model interface and the persistent model tree modeled by the model abstract parent class;

[0033] The encapsulation layer selects a corresponding standardized model interface according to the business type of the data sent by the client, and establishes a corresponding business model according to the persistent model tree;

[0034] The encapsulation layer encapsulates the business model and sends the encapsulated business model to the business layer;

[0035] The business layer stores the encapsulated business model persistently in a database;

[0036] The data layer is used to verify the data that can be persisted in the database.

[0037] In some implementations, the business layer specifically includes:

[0038] The business layer is used to verify the encapsulated business model parameters;

[0039] The business layer is also used to convert the verified business model into an entity object.

[0040] Compared with the prior art, the present invention has at least one of the following beneficial effects:

[0041] 1. By establishing a unified standardized model interface for each abstract service and standardizing the persistent model tree modeled by the standardized model interface and the model abstract parent class, the reliability and code reuse rate of the persistent system are improved. Select the corresponding standardized model interface according to the business type of the input data, and establish the corresponding business model according to the persistent model tree. Then, encapsulate the business model and persist it to the database. The business model established according to the standardized persistent model tree is relatively simple, which reduces the learning cost and reduces the workload of developers.

[0042] 2. By encapsulating the business model corresponding to the input data into a business model in the RawData data format, the reliability of the persistent system is further improved.

[0043] 3. By setting the AOP behavior mechanism and adding annotations of the AOP behavior when the business model in the RawData data format executes the AOP behavior, the persistent system is expanded, thereby improving the compatibility and user experience of the persistent system. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The preferred implementation modes will be described below in a clear and understandable manner with reference to the accompanying drawings to further illustrate the above-mentioned characteristics, technical features, advantages and implementation methods of the present invention.

[0045] Figure 1 is a flow chart of an embodiment of a data persistence method of the present invention;

[0046] Figure 2 is a flow chart of an embodiment of a data persistence method of the present invention;

[0047] Figure 3 is a flow chart of another embodiment of a data persistence method of the present invention;

[0048] Figure 4 The system structure diagram of an embodiment of a data persistence method of the present invention. DETAILED DESCRIPTION

[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the specific implementation methods of the present invention will be described below with reference to the accompanying drawings. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings and other implementation methods can be obtained based on these drawings without creative work.

[0050] In order to simplify the drawings, only the parts related to the invention are schematically shown in each figure, and they do not represent the actual structure of the product. In addition, in order to simplify the drawings and facilitate understanding, in some figures, only one of the parts with the same structure or function is schematically drawn or marked. In this article, "one" not only means "only one", but also means "more than one".

[0051] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0052] In this document, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0053] In addition, in the description of the present application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0054] It should be noted that the above embodiments can be freely combined as needed. The above are only preferred embodiments of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention.

[0055] In one embodiment, Figure 1 As shown, the present invention provides a data persistence method, comprising the steps of:

[0056] S100, establish a unified standardized model interface for each abstract service.

[0057] S110, standardizes the model interface and the persistent model tree modeled by the model abstract parent class.

[0058] Specifically, the persistence system defines a corresponding abstract service interface for each model abstract parent class, and each model abstract parent class has a corresponding inherited subclass. The interface classes called by different subclasses are standardized, and the parent class and subclasses constitute the persistence model tree modeled by the model abstract parent class.

[0059] Furthermore, a general CRUD interface is provided, and basic functions can be applied as long as modeling is done when developing functions.

[0060] S120, selecting a corresponding standardized model interface according to the business type of the input data, and establishing a corresponding business model according to the persistent model tree.

[0061] Specifically, the corresponding standardized model interface is called according to the business type of the input data, and the corresponding business model is established according to the persistent model tree, in which the typical business model directly inherits the typical parent class, and the atypical business model implements the standardized model interface corresponding to the business type by itself.

[0062] S130, encapsulate the business model.

[0063] S140, persist the encapsulated business model to the database.

[0064] Specifically, the persistent system encapsulates the data format of the business model of the input data, wherein the input parameters used for the general interface are passed with attributes as the minimum element.

[0065] Furthermore, the encapsulated business model can be persisted to the database.

[0066] In this embodiment, the persistent system defines a corresponding abstract service interface for each model abstract parent class, and each model abstract parent class has a corresponding inherited subclass. The interface classes called by different subclasses are standardized, and the parent class and subclasses constitute a persistent model tree for modeling the model abstract parent class. Simplify the model definition, and define the model abstract parent class modeling only by finding the parent class inheritance. Unify configuration maintenance, extract the configuration to page maintenance, and maintain the corresponding configuration during modeling. Standardize the extension design, define AOP for model operations, and the extension only needs to implement the pre-behavior and post-behavior of each operation.

[0067] Furthermore, a general CRUD interface is provided, and basic functions can be applied as long as modeling is done when developing functions.

[0068] Furthermore, the type configuration, attribute configuration, icon rule configuration, layout configuration, attribute group configuration, and data type definition of the input data business model are constructed.

[0069] Furthermore, the type configuration settings of the object model include: for confirming the child-parent relationship of the model, the microservice where the model is located, the encoding generation rules of the model, and the icon generation rules of the model; and for defining the life cycle template of the model.

[0070] The model child-parent relationship settings are: used to unify modeling standards, establish a unified model abstract parent class, typical models directly inherit the abstract parent class, atypical models implement feature interfaces by themselves, and for child models to inherit parent class attributes;

[0071] Furthermore, the attribute configuration settings include: setting the data type of the attribute; setting the relationship between the attribute and the front-end component; setting the constraint of the attribute; setting the relationship between the attribute and VOL to achieve data conversion before data is returned.

[0072] Furthermore, the icon rule configuration settings include: being used to configure the relationship between different conditions and icons; and being used by the basic query interface to query icons according to the configured conditions.

[0073] Furthermore, the layout configuration settings include: for configuring the layout of the model adding, editing and detail pages; for configuring the display constraints of different components of the interface layout and the adaptation rules of the basic behavior interface.

[0074] The adaptation rules of the basic behavior interface are set as follows: the rules for acquiring parameter data of the new and edit interfaces, and the rules for setting component data after the basic query interface returns data.

[0075] Furthermore, the attribute group configuration settings include: settings for list search attributes and attribute data ranges that can be used as search conditions.

[0076] Furthermore, the data type definition is set up to: configure the range of data types that can be selected for model attributes; and configure front-end components, and the association between data types and components.

[0077] Furthermore, the corresponding standardized model interface is called according to the business type of the input data, and the corresponding business model is established according to the persistent model tree, where the typical business model directly inherits the typical parent class, and the atypical business model implements the standardized model interface corresponding to the business type. The standardized model interface is as follows:

[0078]

[0079]

[0080]

[0081] Furthermore, the persistence system encapsulates the data format of the business model of the input data, wherein the input parameters for the common interface are passed with attributes as the minimum element.

[0082] Furthermore, the encapsulated business model can be persisted to the database.

[0083] In one embodiment, the present invention provides a data persistence method, wherein the encapsulation of the business model specifically comprises the steps of:

[0084] S130-1, encapsulate the business model corresponding to the input data into a business model in the RawData data format.

[0085] Specifically, after the persistence system builds the corresponding business model according to the business type of the input data, the business model is encapsulated, and the business model is encapsulated into a business model in the RawData data format, which can be persisted to the database.

[0086] Furthermore, after the persistence system persists the business model in the RawData data format to the database, it converts the business model in the RawData data format into the initial business model data.

[0087] In this embodiment, the persistent system establishes a business model corresponding to the business type of the input data according to the standardized interface and the persistent model tree, and encapsulates the established business model into a business model in the RawData data format. Among them, the RawData processing class factory is provided with: an implementation class for defining attribute value types, such as data dictionaries and enumerations; an implementation class for defining specific attribute names, such as containerRef managed by containers; a uniform conversion of model objects into the RawData data format; a verification of the correctness of input parameters and processing of output parameter formats; a uniform conversion of the input parameter RawData format into the data type required by the model entity.

[0088] Furthermore, the business model is encapsulated as a business model in the RawData data format and can be persisted to the database.

[0089] Furthermore, after the persistence system persists the business model in the RawData data format to the database, it converts the business model in the RawData data format into the initial business model data.

[0090] In one embodiment, the present invention further provides a data persistence method, which, based on the above embodiment, further includes the following steps:

[0091] When setting the AOP behavior mechanism and the business model in the RawData data format executes AOP behavior, add annotations for the AOP behavior.

[0092] Specifically, the AOP behavior mechanisms are AOP pre-interception and AOP post-interception, which are set before and after the business layer of the persistent system starts and ends respectively. In essence, they are to annotate the common operations in the persistent process.

[0093] Furthermore, public operations are abstracted into services, and each operation method is annotated with @OperationalApi, defining the unique operation name of the method -name, and each public operation method defines aop. When the service starts, the AOP implementation of each operation method is collected, supporting the interface to extend the pre-behavior and post-behavior.

[0094] Furthermore, the public AbstractPersistableService interface is provided with: methods for defining basic behaviors, standardizing operations such as creating models, modifying models, deleting models, querying by primary key, and querying by list.

[0095] Furthermore, the public AbstractElementService interface is set up with: methods for defining common behaviors, standardizing save as, renaming, setting status, setting life cycle, reallocating life cycle, generating team instances, maintaining team members, setting container context, setting folder, setting owner, determining permissions, locking, unlocking, saving attachments, type-related, generating encoding, starting processes, and other operation methods.

[0096] The public AbstractItemRevisionService interface is set up to define common behaviors, standardize checkout, checkin, undo checkout, revision, query the latest version, baseline, set security level, change and other operation methods.

[0097] The public AbstractItemMasterService interface is set up with the following methods: methods for defining common behaviors, standardizing the editing of common properties, querying all historical versions based on the master object, and querying the latest major version.

[0098] In one embodiment, the present invention provides a data persistence method. Based on the above embodiment, the encapsulated business model can be persisted to a database, specifically comprising the steps of:

[0099] S140-1, verify the business model parameters of the RawData data format.

[0100] S140-2, convert the verified business model in the RawData data format into an entity object.

[0101] Specifically, after verifying the business model parameters in the RawData data format, the verified business model in the RawData data format is converted into an entity object.

[0102] In one embodiment, the present invention provides a data persistence method. Based on the above embodiment, after converting the verified business model in the RawData data format into an entity object, the method further includes the following steps:

[0103] When the business model of the RawData data format triggers the preset feature Handler mechanism, the business model of the RawData data format is expanded.

[0104] Specifically, the feature Handler mechanism is used to extend the business model of the RawData data format to extend the business logic. The extension is performed in the middle of the business execution, that is, the business extension of a business model attribute (such as editing, deleting, and modifying). The feature Handler executor will be called before and after persistence. Whether it will be executed depends on the code control of the handler and the matching result of the Matcher.

[0105] The specific implementation is as follows:

[0106] First, define the top-level interface class IFeatureHandler; interface behaviors include: specifying the processing of a certain attribute; specifying that only a certain interface or a certain model class is processed; execution order, the execution order of the Handler; executing the processor, returning false indicates that the execution is not successful, and it will be executed again the next time it is called; whether it can be executed repeatedly, by default, it can only be executed once per request. Returning true will execute it every time it is called; getting the matcher, by default, it is only executed when it is created; the Matcher class mechanism controls whether it needs to be executed;

[0107] Furthermore, the implementation class is defined according to the characteristic behavior interface, the basic behavior interface is implemented by default, the life cycle handler sets the life cycle template for the business object, sets the state, and starts the process. The coding management handler applies for coding for the business object, and the business object can customize the handler to achieve business expansion;

[0108] Furthermore, when business object persistence is used as an entry point, the entry point is not a pre-entry or a post-entry. The pre-entry can be used for special processing of object attribute values, and the post-entry can be used for processing the business relationship object of the object.

[0109] Furthermore, the ErdMethodMatcher mechanism is defined. Each Handler class specifies a Matcher class, which determines whether the execution conditions are met. By default, the interface is created for execution.

[0110] In one embodiment, Figure 2 As shown, the present invention provides a data persistence method. Based on the above embodiment, after the encapsulated business model is persisted to the database, the method further includes the following steps:

[0111] S250, objects associated with the business model may be persisted to the database according to preset configuration rules.

[0112] Specifically, the preset model configuration rule settings are: when the persistent system is used for calling the general behavior operation interface, it uses the unified configuration management agent to obtain configuration information and execute the configuration rules to persist the associated object data of the business model of the input data to the database; it is also used to support the current microservice execution and cross-service execution.

[0113] In this embodiment, the persistent system establishes a business model corresponding to the business type of the input data according to the standardized interface and the persistent model tree, and encapsulates the established business model into a business model in the RawData data format. Among them, the RawData processing class factory is provided with: an implementation class for defining attribute value types, such as data dictionaries and enumerations; an implementation class for defining specific attribute names, such as containerRef managed by containers; a uniform conversion of model objects into the RawData data format; a verification of the correctness of input parameters and processing of output parameter formats; a uniform conversion of the input parameter RawData format into the data type required by the model entity.

[0114] Furthermore, the business model is encapsulated as a business model in the RawData data format and can be persisted to the database.

[0115] Furthermore, after the persistence system persists the business model in the RawData data format to the database, it converts the business model in the RawData data format into the initial business model data.

[0116] Furthermore, the persistent system can also persist the associated objects of the business model in the RawData data format to the database. That is, when the persistent system is used to call the general behavior operation interface, it uses the unified configuration management agent to obtain configuration information and execute configuration rules to persist the associated object data of the business model in the RawData data format to the database.

[0117] In one embodiment, the present invention provides a data persistence method, which, based on the above embodiment, further includes the following steps:

[0118] In the process of persisting the business model in the RawData data format to the database, the encoding of the business model in the RawData data format is automatically generated according to the preset model encoding rules.

[0119] Specifically, define the service where the type model is located, the encoding rules of the model object, the child-parent relationship of the model object, the icon rules, etc. When used for data persistence, the object code can be automatically generated according to the configured encoding rules.

[0120] Furthermore, the child-parent relationship of the model object is set up to inherit the attributes and behavior interface of the parent type.

[0121] Furthermore, the model service is set up with: a proxy for the service interface, and a proxy for the dubbo interface call to the corresponding microservice.

[0122] Furthermore, icon rules are set to obtain corresponding icons by setting query conditions. Icon rules can be set to control the object icon to display different icons in different states and different pages. Icons can be uploaded, including resource packages or pictures.

[0123] In one embodiment, Figure 3 As shown, the present invention provides a data persistence method. Based on the above embodiment, after the encapsulated business model is persisted to the database, the method further includes the following steps:

[0124] S350, mapping each attribute of the business model in the RawData data format with the corresponding front-end component, and displaying the business model in the RawData data format to the user interface of the persistent system according to the mapping.

[0125] Specifically, each attribute of the business model in the RawData data format is mapped to the corresponding front-end component, wherein the internationalization of the attribute, attribute data type, attribute constraint and component can be configured through the interface, and the design is integrated with the front-end component.

[0126] Furthermore, the internationalization of attribute information includes: attribute display for layout interface, and display of list column names.

[0127] The attribute data types are: used for data persistence, data verification and attribute component association display. The associated components are used to display the attribute control type of the object layout interface.

[0128] Attribute categories are: used to identify the storage method of attribute data, mainly including:

[0129] Model attributes: hard-coded attributes in the model definition, required attributes supported by the model.

[0130] Standard attributes: Commonly used attributes extended by users on the page, stored in the database table of the current model.

[0131] Soft attributes: uncommon attributes extended by users on the page, stored in a separate Iba value table.

[0132] Virtual attribute: An attribute that does not actually store values. The value obtained by combining and calculating certain rules is used for display.

[0133] In one embodiment, Figure 4 As shown, the present invention provides a data persistence method, comprising:

[0134] Unified persistence, unified interface standard MDI, unified business layer AOP behavior mechanism, and unified business layer feature Handler mechanism.

[0135] The unified persistence setting is used to provide a general CRUD interface. When developing functions, as long as modeling is done, basic functions can be applied, reducing the development and testing workload of function delivery.

[0136] The unified interface standard MDI is configured as follows: the input parameter of the general interface is passed with the attribute as the minimum element, encapsulating the RawData data format; and defining the RawData processing class factory;

[0137] The RawData processing class factory is set up with: for each attribute and feature interface to implement their own processing logic, using proxy execution, uniformly converting model objects into RawData data format, and RawData data format into model objects. It is used to uniformly convert model objects into RawData data format; to verify the correctness of input parameters and process the output parameter format; to uniformly convert the input parameter RawData format into the data type required by the model entity;

[0138] The unified business layer AOP behavior mechanism is provided with: for executing basic behaviors and public behavior interfaces, extensions before and after execution, such as special permission judgment and data filtering; AOP implementation principle is as follows Figure 2 As shown, the specific implementation is as follows:

[0139] First, define the top-level interface class IPersistableService of the business layer;

[0140] Furthermore, add a custom annotation @ErdAopServicePointcut and add the annotation to the IPersistableService interface to define the Spring aspect entry point;

[0141] Furthermore, define the Spring aspect entry point. ErdAopPointcut is the defined aspect entry point, which points to @ErdAopServicePointcut. All interfaces, implementation classes, and subclasses that add this annotation will be intercepted.

[0142] Furthermore, define the Spring method interceptor, ErdAopMethodInterceptor intercepts ErdAopPointcut, executes the built-in interceptor, supports Matcher matching, and ErdAopMethodInterceptor is the entry point of aop behavior. It will automatically execute all aop behaviors in sequence before and after executing the business code. ErdAopMethodInterceptor will encapsulate the ErdAopInvocation object, which provides the ability to access process data parameters and provide data interaction between multiple aop behaviors;

[0143] Furthermore, the built-in interceptor implementation is customized: the ErdInterceptor interceptor interface is customized. All built-in interceptors must implement this interface. The built-in interceptors are automatically registered and collected when instantiated. The interceptor signature @ErdAopSignature is customized to specify the interception of a method of a class.

[0144] Furthermore, the Matcher class mechanism: after the interceptor matches the built-in interceptor according to the business layer service class, method, and input parameter type, the matches method of the Matcher class will be executed before pointing to the built-in interceptor. If the method returns false, the interceptor will not be executed.

[0145] The unified business layer feature Handler mechanism is set up as follows: used to extend business logic, expand in the middle of business execution, and call the feature Handler executor before and after persisting the database. Whether it will be executed depends on the handler code control and the matcher matching result. The specific implementation is as follows Figure 3 As shown, the specific implementation is as follows;

[0146] First, define the top-level interface class IFeatureHandler; interface behaviors include: specifying the processing of a certain attribute; specifying that only a certain interface or a certain model class is processed; execution order, the execution order of the Handler; executing the processor, returning false indicates that the execution is not successful, and it will be executed again the next time it is called; whether it can be executed repeatedly, by default, it can only be executed once per request. Returning true will execute it every time it is called; getting the matcher, by default, it is only executed when it is created; the Matcher class mechanism controls whether it needs to be executed;

[0147] Furthermore, the implementation class is defined according to the characteristic behavior interface, the basic behavior interface is implemented by default, the life cycle handler sets the life cycle template for the business object, sets the state, and starts the process. The coding management handler applies for coding for the business object, and the business object can customize the handler to achieve business expansion;

[0148] Furthermore, when business object persistence is used as an entry point, the entry point is not a pre-entry or a post-entry. The pre-entry can be used for special processing of object attribute values, and the post-entry can be used for processing the business relationship object of the object.

[0149] Furthermore, the ErdMethodMatcher mechanism is defined. Each Handler class specifies a Matcher class, which determines whether the execution conditions are met. By default, the interface is created for execution.

[0150] After the data is persisted in the database, it also includes configuring the rule application.

[0151] When saving as a business object, you need to copy the associated objects through the source business object and update the data of the new business object; when deleting a business object, its child objects and related objects become garbage data and should be deleted together; there are many other operations that require these in actual scenarios, such as checkout and undo checkout.

[0152] The unified configuration rule settings are: used to define configuration rules according to the data model dimension in the configuration table. Configuration rules can be defined in different operations for each model. For example, when deleting an object, the configuration to be associated with the deletion needs to be associated; when copying / saving as an object, the configuration to be copied synchronously needs to be associated with the copy of the configuration; when checking out, checking in, and revising a version-controlled object, the configuration to copy the associated data in the historical version needs to be configured; when used for unified behavior interface execution, the proxy mode is used to uniformly execute configuration rules, which can be called in the current service or support cross-service call interfaces to perform associated data processing.

[0153] The unified interface MDI specifically includes:

[0154] Unify modeling standards and establish unified model abstract classes: persistent objects (AbstractPersistable), business base objects (BaseObject), management objects (SystemAdminObject), versionless business objects (Element), version master objects (ItemMaster), version detail objects (ItemRevision), relational models (Relation), and forms (Form). Define model attribute fields: whether it is business data, whether it needs to extend soft types, extended attributes, whether version control is required, whether it is an association relationship; define model constraints: whether there is a uniqueness check, whether it needs to distinguish tenants, whether it needs to distinguish applications, required attributes, read-only attributes, etc. Each base model not only implements various feature interfaces, but also has attributes that implement feature behavior interfaces. Inheriting the base model automatically has these attribute fields.

[0155] Unified cache standardization: A two-level cache framework based on J2Cache encapsulation, with the first-level cache using memory (Caffeine) and the second-level cache using Redis. Reading order rule: first-level cache -> second-level cache -> DB. Cache update rule: read the latest data from the database, update the first-level cache -> second-level cache in sequence, send a broadcast to clear a certain cache information, receive a broadcast (manually clear the cache & the first-level cache is automatically invalidated), and clear the specified cache information from the first-level cache. Cache unified configuration file: j2cache.properties J2Cache core configuration file, which can configure two-level caches, Redis servers, connection pools, and cache broadcast methods. This configuration is located in the underlying component package, and each business system does not need to be configured without special requirements; caffeine.properties uses Caffeine for the first-level cache. This file is used to configure the first-level cache information, including cache capacity and cache time. Business cache data needs to be shared with each microservice to reduce the frequency of cross-service calls. The design of a multi-level cache framework is also to relieve the pressure on redis. Load commonly used cache data into the service first-level cache.

[0156] Unified attribute definition: Attributes are divided into model attributes, standard attributes, soft attributes, and virtual attributes. Model attributes are registered by scanning the hard-coded attributes, while standard attributes and soft attributes are attributes dynamically extended by the page. Virtual attributes can be hard-coded or dynamically extended by the page. Each type of attribute has a unique data persistence method and interface:

[0157] Model attributes: consistent with the attributes defined in the model entity class, the database column name is mapped by mybatis;

[0158] Standard attributes: vertically expand columns in the database table corresponding to the model entity. The mapping relationship between the database column and the attribute definition needs to be saved and queried together when querying the model entity data. The model inherits the FlexTyped interface, and the model that implements this interface must have the FlexedDataInfo flexedDataInfo attribute to access standard attribute values;

[0159] Soft attributes: Vertically expand columns to store data in the xxIbaValue public model table. It is necessary to save the mapping relationship between database columns and attribute definitions. The model inherits the IbaTyped interface, and the basic query interface automatically accesses soft attribute values.

[0160] Virtual attribute: no database column, no data stored by itself. Just a value calculated in some way for front-end display. Hard-coded virtual attribute implementation method: First, when using join annotation in the model, you can define the virtual attribute to reference the field of the join table; second, add @unrealField annotation to the virtual attribute, pointing to a method with no parameters and return value. When querying the model entity, the bottom layer automatically calls the specified method to set the value of the virtual attribute.

[0161] Dynamically created virtual attributes on the page: Use a formula to define the rules for virtual attribute values. The formula rule is: {attrName1},{attrName2}-{attrName3}({attrName4}). Replace {xx} with the value corresponding to the attribute in the curly brackets.

[0162] The attribute definition function configures the data type, whether it can be empty, length and data format of the attribute, and is responsible for unifying the data verification basis of the behavioral interface.

[0163] Unified behavior interface definition: define common basic and public behavior interfaces to SDK. Business services can obtain the basic / public behavior interfaces of all models by relying on the SDK. Each basic abstract model has corresponding basic behavior capabilities and public behavior capability definitions. Design abstract service definitions and implement common behavior capabilities, and provide customized capabilities [aspect AOP, dynamic proxy interceptor];

[0164] The general basic behavior interface includes: creating models, modifying models, deleting models individually, deleting models in batches, querying by primary key, querying by list, adding or modifying in batches, etc.

[0165] The public behavior interface includes: save as, rename, list data interface, set status, set life cycle, reallocate life cycle, generate team instance, maintain team members, set container context, set folder, set owner, determine permissions, lock, unlock, save attachments, type related, generate code, start process, check out, check in, undo check out, revise, query the latest version, edit public properties, query all historical versions based on the main object, query the latest major version, etc.

[0166] In one embodiment, the present invention provides a persistent system, comprising:

[0167] Client, the client sends data to the encapsulation layer.

[0168] Encapsulation layer: The encapsulation layer is used to establish a unified standardized model interface for each abstract service.

[0169] The encapsulation layer is also used to standardize the model interface and the persistent model tree modeled by the model abstract parent class.

[0170] The encapsulation layer selects the corresponding standardized model interface according to the business type of the data sent by the client, and establishes the corresponding business model based on the persistent model tree.

[0171] The encapsulation layer encapsulates the business model and sends the encapsulated business model to the business layer.

[0172] Business layer: The business model encapsulated in the business layer can be persisted to the database.

[0173] The data layer is used to verify the data that can be persisted in the database.

[0174] Specifically, the client sends the data that needs to be persisted to the database to the encapsulation layer, where the encapsulation layer is essentially a unified MDI interface standard. The encapsulation layer defines a corresponding abstract service interface for each model abstract parent class, and each model abstract parent class has a corresponding inherited subclass. The interface classes called by different subclasses are standardized, and the parent class and subclasses constitute a persistable model tree modeled by the model abstract parent class.

[0175] Furthermore, the encapsulation layer provides a universal CRUD interface. When developing functions, as long as modeling is done, basic functions can be applied.

[0176] Furthermore, the encapsulation layer calls the corresponding standardized model interface according to the business type of the input data, and establishes the corresponding business model according to the persistent model tree, in which the typical business model directly inherits the typical parent class, and the atypical business model implements the standardized model interface corresponding to the business type by itself.

[0177] Furthermore, the business layer encapsulates the data format of the business model of the input data, wherein the input parameters for the common interface are passed with attributes as the minimum element.

[0178] Furthermore, the business layer can persist the encapsulated business model to the database.

[0179] Furthermore, the data layer is used to process, convert, and verify data that can be persisted in the database.

[0180] The data persistence method used in this embodiment has been described in detail in the above embodiments and will not be repeated here.

[0181] In one embodiment, the present invention provides a persistent system. Based on the above embodiment, the business layer specifically includes:

[0182] The business layer is used to verify the encapsulated business model parameters.

[0183] The business layer is also used to convert the verified business model into entity objects.

[0184] The data persistence method used in this embodiment has been described in detail in the above embodiments and will not be repeated here.

[0185] In one embodiment, the present invention provides a computer medium having a computer program stored thereon, and when the computer program is executed by a processor, the data persistence method as described in the aforementioned embodiment can be implemented. That is, when part or all of the technical solutions that contribute to the prior art in the aforementioned embodiment of the present invention are embodied in the form of a computer software product, the aforementioned computer software product is stored in a computer-readable storage medium. The computer-readable storage medium can be any physical device or equipment that can carry computer program codes, such as a USB flash drive, a mobile disk, a magnetic disk, an optical disk, a computer memory, a read-only memory, a random access memory, etc.

[0186] It should be noted that the above embodiments can be freely combined as needed. The above are only preferred embodiments of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention.

Claims

1. A data persistence method, characterized in that: Includes steps: Establish a unified standardized model interface for each abstract service; Standardize the model interface and model abstract parent class modeling to create a persistent model tree; Selecting a corresponding standardized model interface according to the business type of the input data, and establishing a corresponding business model according to the persistent model tree, wherein the persistent model tree modeled by the model abstract parent class includes a parent class and a child class, a typical business model directly inherits a typical parent class, and an atypical business model selects the corresponding standardized model interface according to the business type of the input data; Encapsulating the business model; The encapsulated business model can be persisted to a database; The above-mentioned standardized model interface and the persistable model tree modeled by the model abstract parent class specifically include: Define the corresponding abstract service interface for each model abstract parent class, and standardize the interface class called by the inherited subclass corresponding to each model abstract parent class, where each model abstract parent class and its corresponding inherited subclass constitute a persistent model tree modeled by the model abstract parent class.

2. The data persistence method according to claim 1, characterized in that: The encapsulation of the business model specifically includes the steps of: The business model corresponding to the input data is encapsulated as a business model in RawData data format.

3. The data persistence method according to claim 2, characterized in that: Also includes the steps: An AOP behavior mechanism is set, and when the business model in the RawData data format executes the AOP behavior, an annotation of the AOP behavior is added.

4. The data persistence method according to claim 2, characterized in that: The encapsulated business model can be persisted to the database, specifically including the steps of: Verifying the business model parameters in the RawData data format; The verified business model in the RawData data format is converted into an entity object.

5. The data persistence method according to claim 4, characterized in that: After converting the verified business model in the RawData data format into an entity object, the method further includes the following steps: When the business model in the RawData data format triggers a preset characteristic Handler mechanism, the business model in the RawData data format is service expanded.

6. The data persistence method according to claim 1, characterized in that: After the encapsulated business model is persisted in the database, the method further includes the following steps: The associated objects of the business model can be persisted to the database according to preset configuration rules.

7. The data persistence method according to claim 4, characterized in that: Also includes the steps: In the process of persisting the business model in the RawData data format to the database, the encoding of the business model in the RawData data format is automatically generated according to the preset model encoding rules.

8. The data persistence method according to claim 2, characterized in that: After the encapsulated business model is persisted in the database, the method further includes the following steps: A mapping is established between each attribute of the business model in the RawData data format and a corresponding front-end component, and the business model in the RawData data format is displayed to the user interface of the persistent system according to the mapping.

9. A persistent system, characterized in that: include: A client sends data to the encapsulation layer; An encapsulation layer, which is used to establish a unified standardized model interface for each abstract service; The encapsulation layer is also used to standardize the model interface and the persistent model tree modeled by the model abstract parent class; The encapsulation layer selects a corresponding standardized model interface according to the business type of the data sent by the client, and establishes a corresponding business model according to a persistent model tree, wherein the persistent model tree modeled by the model abstract parent class includes a parent class and a child class, a typical business model directly inherits a typical parent class, and an atypical business model selects the corresponding standardized model interface according to the business type of the input data; The encapsulation layer encapsulates the business model and sends the encapsulated business model to the business layer; The business layer stores the encapsulated business model persistently in a database; A data layer, the data layer is used to verify the data that can be persisted in the database; The encapsulation layer is also used to define a corresponding abstract service interface for each model abstract parent class, and to standardize the interface class called by the inherited subclass corresponding to each model abstract parent class, wherein each model abstract parent class and its corresponding inherited subclass constitute a persistent model tree modeled by the model abstract parent class.

10. The persistent system according to claim 9, characterized in that: The business layer specifically includes: The business layer is used to verify the encapsulated business model parameters; The business layer is also used to convert the verified business model into an entity object.