A method and system for constructing a low-code model

By building an enhanced business model and combining caching and permission metadata, the problem of insufficient caching strategies and permission configuration in low-code platforms was solved, achieving efficient and secure CRUD API generation and multi-role data access control, thus improving the performance and security of low-code platforms.

CN123114433APending Publication Date: 2026-11-17INSPUR GENERSOFT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611189895.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-06
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

The existing low-code platform's JSON model cannot effectively support caching strategies and permission configurations, resulting in poor performance of the generated CRUD APIs, which cannot meet the enterprise-level requirements for high-frequency access and multi-role, multi-level data security access.

Method used

By building an enhanced business model that includes cached metadata and permission metadata, and designing an adaptive caching mechanism, we can achieve flexible mapping between the model and the database, generate efficient and secure CRUD APIs, bind cache key rules to field definitions, bind operation permissions to CRUD operation types, and deploy using an incremental update mechanism.

Benefits of technology

It improves the development efficiency and security of low-code platforms, ensures that caching and permission configurations do not require additional manual intervention, achieves API-level permission control and high-frequency query response speed, and avoids runtime exceptions and downtime risks during full deployment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123114433A_ABST
    Figure CN123114433A_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for constructing a low-code model, relating to the field of low-code development technology. The method includes: defining an enhanced business model, comprising basic metadata, mapping metadata, cache metadata, and permission metadata; generating cache key rules in the cache metadata based on field definitions in the basic metadata, and binding operation permissions in the permission metadata to corresponding CRUD operation types; performing legality verification on the enhanced business model, and after successful verification, parsing each metadata element to generate a model parse tree; generating CRUD interfaces based on the model parse tree, allocating operation permissions according to the permission metadata, and generating permission interception and verification logic; managing the cache of interface-returned data according to a caching strategy; identifying model changes during deployment, and using an incremental update mechanism to update only the database tables and interfaces corresponding to the changed content. This improves the development efficiency, API performance, and system security of the low-code platform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of low-code development technology, specifically to a method and system for constructing a low-code model. Background Technology

[0002] With the acceleration of digital transformation, low-code platforms, with their core advantages of rapid development and lower barriers to entry, are widely used in building various business systems. Model-driven architecture, as the core architecture of low-code platforms, automatically generates database structures and API interfaces through abstract business model descriptions, and deeply integrates with permissions, thereby reducing manual coding workload. CRUD (Create, Read, Update, Delete) are general abbreviations for the four basic operations of databases or persistent layers. Low-code platforms automatically generate corresponding CRUD APIs through model-driven architecture to realize CRUD operations on business data.

[0003] Currently, there are existing model-driven low-code solutions, some of which use JSON format to describe the model, realize the mapping between the model and the database table, and automatically generate CRUD APIs. However, the following technical shortcomings still exist: The existing JSON model can only describe basic fields, types, and simple constraints, lacking support for core enterprise-level requirements such as caching strategies and permission configuration. Caching strategies are typically hard-coded by developers in the code or configured independently through middleware, and permission control also requires additional manual coding. This results in a large amount of manual modification to the generated API and database structure, violating the core goal of low-code rapid development. The generated CRUD APIs lack targeted optimization, especially for frequently accessed query interfaces, and do not incorporate configurable caching mechanisms to improve response speed. They typically only support coarse-grained menu or page-level permission control, making it difficult to achieve fine-grained API-level permission management for data creation, deletion, modification, and query operations. This fails to meet the multi-role, multi-level data security access requirements of enterprise applications, impacting system security. Summary of the Invention

[0004] To address the limitations of JSON models in terms of description capabilities, mapping flexibility, and API generation performance, this paper presents a low-code model building method and system. By constructing an enhanced model and employing an adaptive caching mechanism, it achieves flexible mapping between the model and the database, provides an efficient and secure CRUD API, and improves the development efficiency, performance, and security of low-code platforms.

[0005] In a first aspect, the present invention provides a method for constructing a low-code model, comprising the following steps: Define an enhanced business model, which includes basic metadata, mapping metadata, cache metadata, and permission metadata. The cache metadata is used to define the caching strategy for model data. The cache key rules in the cache metadata are generated based on the field definitions in the basic metadata. The operation permissions in the permission metadata are bound to the corresponding CRUD operation types. The enhanced business model is validated for legality, including at least the matching validation of cache key rules and field definitions, and the compatibility validation of the operation permissions and CRUD operation types; after the validation is passed, the metadata is parsed to generate a model parse tree. Based on the model parsing tree, a CRUD interface is generated, and operation permissions are allocated according to the permission metadata, and permission interception and verification logic is generated. The caching strategy defined by the cache metadata is used to manage the cache of the data returned by the CRUD interface, and different models are configured with independent caching strategies. When deploying CRUD interfaces, identify changes to the model and use an incremental update mechanism to update only the database tables and interfaces corresponding to the changes.

[0006] By building an enhanced business model, caching strategies and access control are directly integrated into the model definition, eliminating the need for manual addition of cache configuration and permission code after API generation. Cache key rules are bound to field definitions, and operation permissions are bound to CRUD operation types, making caching and permissions no longer independent configuration items, but rather organic links in the model-driven chain.

[0007] As a preferred embodiment of the technical solution of the present invention, the steps for verifying the matching between cache key rules and field definitions include: Retrieve all cache key field names referenced in the cache key rule; Iterate through the cache key field names and match them one by one in the field definition list of the basic metadata to see if there is a field definition with the same name; If any cache key field name does not exist in the field definition list, the validation fails and a missing field exception report is output. If all cache key field names exist in the field definition list, the verification passes, confirming that the cache key rule matches the field definition.

[0008] The validation phase verifies that all fields referenced in the cache key rules exist in the field definition list, thus advancing the detection of cache key configuration errors from runtime to the model validation phase. By outputting the names of missing fields, developers can quickly locate configuration errors, avoiding runtime exceptions caused by cache keys referencing invalid fields, thereby enhancing the robustness and maintainability of the model.

[0009] As a preferred embodiment of the technical solution of the present invention, the step of verifying the compatibility between operation permissions and CRUD operation types includes: Retrieve all permission items configured in the permission metadata. Each permission item contains an operation type field and a permission expression field. The operation type field is used to identify the CRUD operation type corresponding to the permission item, and the permission expression field is used to define the permission conditions required to access the operation type. Obtain all CRUD operation types defined in the permission metadata and generate a set of operation types to be verified. Iterate through the permission items and verify whether the operation type field of each permission item belongs to the set of operation types to be verified. If the operation type field of any permission item does not belong to the set of operation types to be verified, the verification fails and a permission configuration exception report is output, indicating the operation type that cannot be matched. If the operation type field of all permission items belongs to the set of operation types to be verified, then the operation permission is confirmed to be compatible with the CRUD operation type, and a verification pass instruction is output.

[0010] During the validation phase, the operation type of each permission item in the permission metadata is verified to ensure it belongs to the set of CRUD operation types supported by the model. This prevents runtime permission validation errors caused by configuring invalid operation types for permission items. It can explicitly output unmatched operation types, helping developers to promptly identify and correct permission configuration errors and ensuring semantic consistency between permission metadata and model definitions.

[0011] As a preferred embodiment of the technical solution of the present invention, the step of generating the model parse tree includes: Construct the root node of the parse tree, and set the model name and version number from the basic metadata in the root node; The basic metadata, mapping metadata, cache metadata, and permission metadata are parsed sequentially to generate field definition sub-nodes, mapping rule sub-nodes, cache strategy sub-nodes, and permission control sub-nodes, respectively. Define nodes for each field, bind corresponding field mapping rules, associated permission operation items, and adapted cache effective scope; After performing the parse tree integrity check, the model parse tree is output.

[0012] The four types of metadata are parsed into a unified tree structure, clearly expressing the relationships between the various metadata modules. The parse tree serves as a unified intermediate representation, allowing subsequent interface generation and cache management to directly extract the required information without repeatedly parsing the original model. Fields are defined with nodes bound to corresponding mapping rules, permission operations, and cache scope, ensuring that the complete attribute chain at the field level is preserved in the intermediate representation. Integrity checks further ensure that all metadata is correctly mounted.

[0013] As a preferred embodiment of the technical solution of the present invention, the specific steps for allocating operation permissions based on permission metadata and generating permission interception and verification logic include: Parse the permission metadata and extract permission items containing operation type field and permission expression field; Iterate through each generated CRUD interface, identify its operation type, and match the corresponding permission items; Assign the permission expression field in the matched permission item to the corresponding interface as the access permission condition for that interface, and generate permission interception and verification logic that includes interface path matching rules and no-permission handling logic.

[0014] The API automatically matches the corresponding permission expression for each interface during API generation, eliminating the need to manually write permission validation code. Permission rules are centrally defined in the permission metadata and are automatically distributed to each interface through parsing and matching mechanisms, achieving unified management and automatic synchronization of permission policies and avoiding omissions and errors caused by manual coding.

[0015] As a preferred embodiment of the technical solution of the present invention, the execution process of the generated permission interception and verification logic during user access includes: When accessing the CRUD interface through the API gateway, the gateway intercepts the current request; Extract the user's identity information and the set of permissions granted from the request context; Based on the target interface path requested, match and obtain the access permission conditions bound to that interface; Determine whether the current user's permission set satisfies the access permission conditions; If the conditions are met, the request is allowed, permitting the invocation of the target CRUD interface; If the conditions are not met, access is denied, and an error response indicating that access is not permitted is returned.

[0016] All CRUD interface requests are uniformly intercepted through the API gateway, ensuring that permission checks are enforced at the request entry point. Access permission conditions are dynamically matched based on the request interface path, and real-time judgment is performed in conjunction with the user's permission set. If permission verification fails, a clear denial response is returned, providing a unified error feedback format for the frontend.

[0017] As a preferred embodiment of the technical solution of the present invention, determining whether the current user's permission set satisfies the access permission condition includes: Parse the access permission conditions and extract the corresponding permission expressions. The permission expressions may contain a single permission identifier or a compound permission expression containing logical operators. When the permission expression is a single permission identifier, it is determined whether there is a permission in the current user's permission set that matches the single permission identifier. If there is, it is determined that the permission is satisfied. When the permission expression is a composite permission expression, the composite permission expression is split into multiple sub-permission conditions according to the logical operator, and it is determined whether the current user's permission set satisfies each sub-permission condition. Logical operations are then performed on the judgment results of each sub-permission condition according to the logical operator to obtain the final permission verification result.

[0018] It supports compound permission expressions containing logical operators, enabling multi-dimensional permission combination control requirements. The compound expression is broken down into multiple sub-conditions based on logical operators, each evaluated separately before being combined to determine the final result. This ensures the accuracy of compound permission judgments, making it suitable for both simple and complex permission scenarios.

[0019] As a preferred embodiment of the technical solution of the present invention, the steps of managing the cache of data returned by the CRUD interface according to the caching strategy include: Load the cache metadata of the enhanced business model, and extract the cache key rules, cache validity period, cache update mechanism and cache invalidation policy; Generate a cache key according to the cache key rules, and query whether the cache key corresponds to cache data in the cache; If the cache exists and its validity period has not expired, the cached data is returned directly. If the cache does not exist or its validity period has expired, the business logic that calls the interface retrieves the returned data, associates the returned data with the cache key, stores it in the cache, and records the cache entry time. Monitor source data change events, and based on the cache update mechanism and cache invalidation policy, perform proactive refresh or mark invalidation on the associated cache data.

[0020] By employing a caching mechanism, high-frequency query requests that hit the cache directly return results without requiring database queries, effectively reducing interface response time. Actively refreshing or invalidating corresponding caches by monitoring source data change events ensures consistency between cached and source data. Different models are configured with independent caching strategies, matching caching behavior to the data access characteristics of each model, thus improving cache hit rate and resource utilization efficiency.

[0021] As a preferred embodiment of the technical solution of the present invention, the steps of employing an incremental update mechanism include: Differential comparison of the current version and the previous version of the model metadata snapshot identifies field-level change points and version iteration change points, and generates a model change list; Based on the model change list and the mapping metadata, the changes are mapped to database table structure adjustment items, interface input parameter adjustment items, and output parameter adjustment items; The table structure adjustment items, input parameter adjustment items, and output parameter adjustment items are packaged into an incremental update package, and the structure of the database tables associated with the changes is updated and the code is hot-released for the corresponding interfaces.

[0022] By performing differential comparisons between snapshots of the old and new models, field-level changes can be accurately identified, enabling updates only to the changed portions and avoiding full deployment. Field-level changes are simultaneously mapped to database table structure adjustments and API input / output parameter adjustments, achieving synchronized updates between the storage layer and the API service layer. This avoids runtime errors caused by asynchrony between table structure changes and API parameters. Hot code deployment is performed on the APIs associated with the changes, while unaffected APIs continue to run, achieving zero-downtime service during deployment.

[0023] Secondly, the present invention also provides a low-code model building system, comprising: The model definition module is used to define an enhanced business model. The enhanced business model includes basic metadata, mapping metadata, cache metadata, and permission metadata. The cache metadata is used to define the caching strategy for model data. The cache key rules in the cache metadata are generated based on the field definitions in the basic metadata. The operation permissions in the permission metadata are bound to the corresponding CRUD operation types. The verification and parsing module is used to perform legality verification on the enhanced business model. The legality verification includes at least the matching verification of cache key rules and field definitions, and the compatibility verification of operation permissions and CRUD operation types. After the verification is passed, the metadata is parsed to generate a model parse tree. The interface generation module is used to generate CRUD interfaces based on the model parse tree, allocate operation permissions according to the permission metadata, and generate permission interception and verification logic. The cache management module is used to manage the cache of data returned by the CRUD interface according to the cache strategy defined by the cache metadata. Different models can be configured with cache strategies independently. The incremental update module is used to identify model changes when deploying CRUD interfaces. It uses an incremental update mechanism to update only the database tables and interfaces corresponding to the changes.

[0024] As can be seen from the above technical solutions, this application has the following advantages: During the verification phase, the existence of the cache key field and the legality of the permission operation type are verified simultaneously, ensuring the integrity and consistency of the reference relationships between various modules of the model and avoiding runtime exceptions caused by configuration errors. After successful verification, a parse tree is constructed, and an association link is established between each field and the mapping, permissions, and cache, so that subsequent code generation does not require repeatedly reading the original model definition.

[0025] During API generation, the system automatically matches permission expressions and generates interception logic for each interface. When a user accesses the API, the system verifies permissions in real time and returns a clear denial response, achieving API-level access control. Different models are configured with independent cache keys, expiration dates, and update strategies. When a query hits, the cached result is returned directly. When data changes, cache refresh is triggered by monitoring events, improving the response speed of high-frequency queries and ensuring consistency between cached and source data. By using differential comparison of snapshots of old and new models, field-level changes are accurately located. These changes are simultaneously mapped to table structure adjustments and interface input / output parameter adjustments. Updates and hot deployments are performed only on the changed parts, avoiding downtime and deployment risks associated with full deployment. Attached Figure Description

[0026] To more clearly illustrate the technical solution of this application, the accompanying drawings used in the description will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0027] Figure 1 A flowchart of a method provided in an embodiment of the present invention.

[0028] Figure 2 A block diagram of a system provided in an embodiment of the present invention. Detailed Implementation

[0029] To make the purpose, features, and advantages of this application more apparent and understandable, specific embodiments and accompanying drawings will be used to clearly and completely describe the technical solution protected by this application. Obviously, the embodiments described below are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0030] Unless otherwise defined, all technical and scientific terms used in this application have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used in this application and in the specification of this invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.

[0031] like Figure 1 As shown, this embodiment of the invention provides a method for constructing a low-code model, including the following steps: S1. Define an enhanced business model, including basic metadata, mapping metadata, cache metadata, and permission metadata; the cache key rules in the cache metadata are generated based on the field definitions in the basic metadata, and the operation permissions in the permission metadata are bound to the corresponding CRUD operation types. Basic metadata defines the model's identification information and field composition, including the model name, model version, and a list of field definitions. The field definition list describes all the data fields contained in the model in a list format, with each field including at least a field name, data type, and constraints.

[0032] Mapping metadata defines the naming conversion rules between the model and the underlying physical storage, including table name mapping rules and field name mapping rules. Table name mapping rules convert model names into database table names, and field name mapping rules convert model field names into database column names, achieving automatic mapping from business models to the underlying database structure.

[0033] Cache metadata defines the caching strategy for model data, including cache key rules, cache expiration, cache update mechanism, and cache invalidation policy. Cache key rules define how cache keys are generated to uniquely identify a cached piece of data; cache expiration sets the validity period for cached data, after which it automatically expires; the cache update mechanism defines the triggering method and execution logic for updating cached data when the source data changes; and the cache invalidation policy defines the triggering scenarios and handling rules for cache invalidation. Cache key rules must be generated based on field definitions in the basic metadata.

[0034] Permission metadata is used to define access control rules related to the model, including operation permission configuration. Operation permissions are based on data operations, controlling various operation permissions such as adding, deleting, modifying, and querying data for the model, and operation permissions are bound one-to-one with the operation types of the subsequently generated CRUD interfaces.

[0035] In a preferred embodiment, the enhanced business model is described using JSON format, with four types of metadata nested hierarchically and constrained by a preset JSON Schema to ensure the standardization and completeness of the model definition. The four types of metadata are defined independently yet interconnected. The cache key rules for cached metadata depend on the field definitions of the basic metadata. The operation permissions of the permission metadata correspond to the CRUD operation types, and the mapping metadata maps the field definitions of the basic metadata to database columns.

[0036] S2. Perform legality verification on the enhanced business model, including at least the matching verification of cache key rules and field definitions, and the compatibility verification of the operation permissions and CRUD operation types; after the verification is passed, parse each metadata and generate a model parse tree; In a specific verification process, the first step is to verify the matching between the cache key rule and the field definition. The specific steps are as follows: obtain all cache key field names referenced in the cache key rule, then iterate through these cache key field names, matching them one by one in the field definition list of the basic metadata to see if a field definition with the same name exists. If any cache key field name does not exist in the field definition list, the verification fails, and a missing field exception report is output; if all cache key field names exist in the field definition list, the verification passes, confirming that the cache key rule matches the field definition. In a preferred embodiment, after all cache key field names exist in the field definition list, it is possible to further verify whether the data type of each cache key field is a serializable type. If it is a non-serializable type, a data type mismatch exception report is output; it is also possible to further verify whether each cache key field is a unique field. If it is a non-unique field, a unique constraint exception report is output, to further improve the reliability of the cache key and cache hit efficiency.

[0037] Verify the compatibility between operation permissions and CRUD operation types. Retrieve all permission items configured in the permission metadata. Each permission item contains an operation type field and a permission expression field. The operation type field identifies the CRUD operation type corresponding to this permission item, and the permission expression field defines the permission conditions required to access this operation type. Retrieve all CRUD operation types defined in the permission metadata to generate a set of operation types to be verified. Iterate through the permission items, verifying whether the operation type field of each permission item belongs to the set of operation types to be verified. If the operation type field of any permission item does not belong to the set of operation types to be verified, the verification fails, and a permission configuration exception report is output, indicating the unmatched operation type; if the operation type field of all permission items belongs to the set of operation types to be verified, the operation permissions are confirmed to be compatible with the CRUD operation types, and a verification pass command is output.

[0038] After both of the above checks pass, the metadata is parsed and a model parse tree is generated. Specifically, a root node is constructed, and the model name and version number from the basic metadata are set as globally unique identifiers for the model. The field list of the basic metadata, the naming rules for mapping metadata, the policy configuration for caching metadata, and the rule configuration for permission metadata are parsed sequentially, generating field definition sub-nodes, mapping rule sub-nodes, caching policy sub-nodes, and permission control sub-nodes respectively. Then, the corresponding field mapping rule, associated permission operation item, and adapted cache scope are bound to each field definition node, forming a complete attribute chain at the field level. A parse tree integrity check is performed to confirm that all metadata is mounted and the node relationships are correct, and then the model parse tree is output.

[0039] This parse tree serves as a unified data source for subsequent interface generation, cache management, and access control. It encapsulates all information of the four types of metadata and the relationships between them. Subsequent processing modules can directly extract the required information from the parse tree without repeatedly reading the original model definition.

[0040] S3. Based on the model parsing tree, generate CRUD interfaces, allocate operation permissions according to permission metadata, and generate permission interception and verification logic; In this step, generating CRUD interfaces based on the model parse tree specifically includes: First, reading the interface template bound to the current model version based on the model version number in the basic metadata of the model parse tree. This interface template includes query, add, modify, and delete interface templates. Second, populating the input and output parameter definitions of each interface template according to the field definition list and field constraints in the basic metadata of the model parse tree, generating CRUD interface code that matches the model's field structure. For example, mapping each field name in the field definition list to the parameter field name of the interface input parameter, mapping the data type of the field to the data type of the interface input parameter, and mapping the field constraints to the validation annotations of the interface input parameter; mapping each field name in the field definition list to the field name of the interface output parameter, and mapping the data type of the field to the data type of the interface output parameter, generating the interface output parameter structure. Finally, deploying the generated CRUD interface code to the API gateway completes interface registration and publishing.

[0041] While generating CRUD interfaces, operation permissions are assigned based on permission metadata, and permission interception and verification logic is generated. Specifically, the permission metadata is parsed to extract permission items containing operation type and permission expression fields; each generated CRUD interface is traversed, its operation type is identified, and the corresponding permission item is matched; the permission expression field in the matched permission item is assigned to the corresponding interface as the access permission condition for that interface, and permission interception and verification logic containing interface path matching rules and no-permission handling logic is generated. The generated permission interception and verification logic is injected into the corresponding CRUD interface code in the form of annotations, completing the generation and binding of permission interception and verification logic.

[0042] The generated permission interception and verification logic is executed as follows when a user accesses the CRUD interface: When a user accesses the CRUD interface through the API gateway, the gateway intercepts the current request; extracts the user's identity information and the set of granted permissions from the request context; matches and obtains the access permission conditions bound to the interface based on the target interface path of the request; determines whether the current user's permission set meets the access permission conditions; if it does, the request is allowed, and the target CRUD interface is permitted to be called; if it does not, access is denied, and an error response indicating that access is not permitted is returned.

[0043] When determining whether the current user's permission set meets the access permission conditions, the access permission conditions are parsed, and the corresponding permission expressions are extracted. Permission expressions include two forms: single permission identifiers and compound permission expressions containing logical operators. When the permission expression is a single permission identifier, it is directly checked whether there is a permission in the current user's permission set that matches the single permission identifier; if so, it is considered satisfied. When the permission expression is a compound permission expression, it is broken down into multiple sub-permission conditions using logical operators (such as AND, OR, NOT, etc.). Each sub-permission condition is checked to see if the current user's permission set meets it, and logical operations are performed on the results of the sub-permission condition checks using logical operators to obtain the final permission verification result.

[0044] S4. Manage the cache of CRUD interface returned data according to the caching strategy, and configure the caching strategy independently for different models; During cache management, different models can be configured with different caching strategies independently. Each model's cache metadata independently stores its own cache key rules, validity period, update mechanism, and expiration policy.

[0045] Specifically, when the CRUD interface is called, the cache metadata of the current model is loaded, and the cache key rules, cache expiration time, cache update mechanism, and cache invalidation policy are extracted. A cache key is generated based on the cache key rules, and the cache is checked to see if the corresponding cache data exists. If the cache data exists and has not exceeded its expiration time, the cache data is returned directly without calling the interface's business logic. If the cache data does not exist or has exceeded its expiration time, the interface's business logic is called to retrieve the returned data, which is then associated with the cache key and stored in the cache, with the cache entry time recorded.

[0046] Meanwhile, the system continuously monitors source data change events corresponding to the model. When any change in add, delete, or modify operations is detected, the system locates all cached data associated with the change according to the cache key rules based on the cache update mechanism, and performs proactive refresh or marks it as invalid.

[0047] In a specific example of cache key generation, the cache key is generated as follows: A cache key template string defined in the cache metadata is obtained. This template string contains a fixed prefix and at least one variable placeholder. The variable placeholders are parsed to determine the field name corresponding to each placeholder. The input parameters corresponding to the field names are extracted from the current request's input parameters. If a corresponding value exists in the input parameters, the variable placeholder is replaced with that input parameter value. If a corresponding value does not exist in the input parameters, a default value or an empty value is used to replace the variable placeholder. The replaced fixed prefix and each variable value are concatenated using a preset connector to generate a complete cache key string.

[0048] The cache processor loads the cache metadata configuration for the corresponding model, and matches cache rules differently based on the model's data access characteristics. This avoids the resource consumption of a uniform strategy and accurately improves cache hit rate and data access efficiency. Different models configure cache strategies independently in their respective cache metadata. The cache processor generates cache keys according to the cache key rules of each model and controls the cache lifecycle according to its respective cache validity period. The cache strategies of each model take effect independently at runtime without interfering with each other.

[0049] S5. When deploying CRUD interfaces, identify model changes and use an incremental update mechanism to update only the database tables and interfaces corresponding to the changes. This step specifically includes: Obtain the first model metadata snapshot of the current deployment version and the second model metadata snapshot of the previous deployment version. Using the second model metadata snapshot as a baseline, iterate through the basic metadata in the first model metadata snapshot, differentially comparing the field definition lists of the two versions to identify field-level change points. Field-level change points include adding fields, deleting fields, and modifying field attributes, where modifying field attributes includes at least changes in field data type and constraints. Using the second model metadata snapshot as a baseline, iterate through the model version numbers in the first model metadata snapshot to identify version iteration change points. Summarize all change points to generate a model change list.

[0050] When comparing the field definition lists of the two versions, the following judgment logic is adopted: Using the field definition list in the second model metadata snapshot as the base set, the field definition list in the first model metadata snapshot is traversed. If a field exists in the first model metadata snapshot but not in the second model metadata snapshot, it is marked as a newly added field. If a field does not exist in the first model metadata snapshot but exists in the second model metadata snapshot, it is marked as a deleted field. If a field with the same name exists in both versions, the attribute values ​​of that field are compared, including data type, NOT NULL constraints, and unique constraints. If any attribute value changes, it is marked as a modified field attribute, and the attribute values ​​before and after the change are recorded.

[0051] After identifying the changes, based on the model change list and mapping metadata, the changes are mapped to database table structure adjustment items, interface input parameter adjustment items, and output parameter adjustment items. The specific mapping process is as follows: All change points in the model change list are obtained; according to the table name mapping rules and field name mapping rules in the mapping metadata, each field-level change in the change point is mapped to a database table structure adjustment item; if a field is added, a corresponding table add column statement is generated; if a field is deleted, a corresponding table delete column statement is generated; if a field attribute is modified, a corresponding table modify column statement is generated; simultaneously, based on each field-level change in the change point, it is mapped to CRUD interface input parameter adjustment items and output parameter adjustment items; if a field is added, the corresponding parameter field and validation annotation are added to the interface input parameter structure, and the corresponding return field is added to the interface output parameter structure; if a field is deleted, the corresponding field is removed from the interface input parameter structure and output parameter structure; if a field attribute is modified, the data type or validation annotation of the interface input parameter and the data type of the output parameter are updated synchronously. The table structure adjustment items, input parameter adjustment items, and output parameter adjustment items are categorized and packaged to generate an incremental update package.

[0052] The specific steps for updating only the database tables and interfaces corresponding to the changes include: obtaining the table structure adjustment items from the incremental update package, executing structure update statements only on the data tables associated with the changes, and performing no operations on the unchanged data tables. Obtaining the input parameter adjustment items and output parameter adjustment items from the incremental update package, performing hot deployment of the interface code only on the CRUD interfaces associated with the changes, and keeping the unchanged interfaces running without restarting or redeploying. After the update is complete, the first model metadata snapshot is saved as a new snapshot of the previous deployment version for differential comparison during the next deployment.

[0053] The specific process of hot deployment of API code is as follows: the modified API code is dynamically loaded into the API gateway's runtime environment, replacing the original API implementation. During the replacement process, currently processed requests continue to be handled by the original implementation, while new requests are handled by the modified implementation. After the API replacement is complete, the API gateway's routing table is updated to bind the modified API path to the new implementation. This incremental update mechanism enables zero service downtime during deployment, ensuring business continuity.

[0054] The legality verification steps are further explained in detail below: In a specific validation process, the validity checks are performed in the following order: syntax validation, conflict validation, matching validation, and adaptation validation. Syntax validation verifies whether the JSON format of the enhanced business model conforms to the preset JSON Schema. Validation dimensions include the validity of the JSON text format, the integrity of the metadata module, the matching of field data types, and the compliance of required field non-null constraints. Conflict validation verifies the uniqueness of field names in the field definition list and the uniqueness of table name mapping results in the mapping metadata. The specific steps for matching and adaptation validation are consistent with those described in Example 1.

[0055] The above checks are executed sequentially according to their dependencies. If any check fails, the process terminates and the corresponding exception report is output. Only after all checks pass can the parse tree generation step begin.

[0056] When performing cached data read or update operations, various cache exceptions may be encountered. This embodiment provides a corresponding cache exception degradation handling mechanism: When performing cached data read or update operations, cache operation exceptions are caught. If the exception type is cache connection timeout or cache service unavailable, the cache read is skipped, and the interface business logic is directly called to obtain the returned data, ensuring the normal availability of business functions. If the exception type is cache data write failure, a cache write failure log is recorded, and the returned data is directly returned to the caller without being written to the cache. If the exception type is cache data refresh failure, the corresponding cache is marked as invalid according to the cache invalidation policy, waiting to be reloaded on the next read, thereby avoiding the return of outdated cached data.

[0057] The aforementioned degradation mechanism ensures that core business functions can still operate normally when the caching service encounters anomalies, thereby improving the system's availability and robustness.

[0058] In some embodiments, the specific process of linkage mapping in the incremental deployment update step is as follows.

[0059] When a field-level change occurs in the model, the same change needs to be reflected simultaneously in the database table structure and the input and output parameters of the CRUD interface. Taking adding a field as an example, when a new field is detected in the current version compared to the previous version, the system performs the following three levels of change operations simultaneously: At the database level, according to the field name mapping rules in the mapping metadata, the new field name is converted into a database column name, and a corresponding ALTER TABLE ADD COLUMN statement is generated, which includes the name, data type, and constraints of the new column; At the interface input parameter level, the parameter field definition of this field is added to the input parameter structure of the corresponding add and modify interfaces, and corresponding validation annotations (such as NOT NULL checks, length checks, etc.) are added to ensure that the data passed by the caller can be correctly received and validated; At the interface output parameter level, the return field definition of this field is added to the output parameter structure of the query interface to ensure that the query results can correctly contain the value of this field.

[0060] Through the above-mentioned linkage mapping mechanism, a model change can be automatically synchronized to the storage layer and service layer without the need for manual modification of the database and API code. This avoids runtime errors caused by table structure changes and interface parameter inconsistencies, and improves the development efficiency and deployment reliability of the low-code platform.

[0061] The low-code model construction method provided in this embodiment is applied to a multi-tenant low-code platform in a cloud service environment. Multiple tenants each define their own business models and deploy them to a shared low-code platform environment. The platform allocates independent model storage space and caching resources to each tenant.

[0062] Each tenant defines its own enhanced business model through the model definition module. The model definition independently configures basic metadata, mapping metadata, cache metadata, and permission metadata. Each tenant's caching strategy is executed in isolation within the cache management module, and cached data for each model is stored in independent namespaces without interference. Each tenant's interface is distinguished by different routing prefixes in the API gateway, and permission interception and verification logic is executed independently for each tenant.

[0063] When the platform undergoes version upgrades or model changes, the incremental update module processes the model changes for each tenant one by one, avoiding the impact of full deployment on tenants that have not made changes, and ensuring the independence and continuity of each tenant's business in a multi-tenant environment.

[0064] This invention also provides a system for building low-code models. For example... Figure 2 As shown, the system includes a model definition module, a verification and parsing module, an interface generation module, a cache management module, and an incremental update module.

[0065] The model definition module is used to define enhanced business models, which include basic metadata, mapping metadata, cache metadata, and permission metadata. The cache key rules in the cache metadata are generated based on the field definitions in the basic metadata, and the operation permissions in the permission metadata are bound to the corresponding CRUD operation types.

[0066] The validation and parsing module is used to perform legality validation on the enhanced business model. The legality validation includes at least the matching validation of cache key rules and field definitions, and the compatibility validation of operation permissions and CRUD operation types. After the validation passes, the metadata is parsed to generate the model parse tree.

[0067] The interface generation module is used to generate CRUD interfaces based on the model parse tree, allocate operation permissions according to permission metadata, and generate permission interception and verification logic.

[0068] The cache management module is used to manage the cache of data returned by the CRUD interface according to the caching strategy. Different models can be configured with independent caching strategies.

[0069] The incremental update module is used to identify model changes when deploying CRUD interfaces. It uses an incremental update mechanism to update only the database tables and interfaces corresponding to the changes.

[0070] The specific functional implementation of each module is the same as the execution method of each step in the above embodiments, and will not be repeated here.

[0071] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for constructing a low-code model, characterized in that, Includes the following steps: Define an enhanced business model, which includes basic metadata, mapping metadata, cache metadata, and permission metadata. Cache metadata is used to define the caching strategy for model data. The cache key rules in the cache metadata are generated based on the field definitions in the basic metadata. The operation permissions in the permission metadata are bound to the corresponding CRUD operation types. The enhanced business model shall be validated for legality, including at least the matching validation of cache key rules and field definitions, and the compatibility validation of the operation permissions and CRUD operation types. After successful verification, the metadata is parsed to generate a model parse tree. Based on the model parsing tree, a CRUD interface is generated, and operation permissions are allocated according to the permission metadata, and permission interception and verification logic is generated. The caching strategy defined by the cache metadata is used to manage the cache of the data returned by the CRUD interface, and different models are configured with independent caching strategies. When deploying CRUD interfaces, identify changes to the model and use an incremental update mechanism to update only the database tables and interfaces corresponding to the changes.

2. The method for constructing a low-code model according to claim 1, characterized in that, The steps for verifying the match between cache key rules and field definitions include: Retrieve all cache key field names referenced in the cache key rule; Iterate through the cache key field names and match them one by one in the field definition list of the basic metadata to see if there is a field definition with the same name; If any cache key field name does not exist in the field definition list, the validation fails and a missing field exception report is output. If all cache key field names exist in the field definition list, the verification passes, confirming that the cache key rule matches the field definition.

3. The method for constructing a low-code model according to claim 1, characterized in that, The steps for verifying the compatibility between operation permissions and CRUD operation types include: Retrieve all permission items configured in the permission metadata. Each permission item contains an operation type field and a permission expression field. The operation type field is used to identify the CRUD operation type corresponding to the permission item, and the permission expression field is used to define the permission conditions required to access the operation type. Obtain all CRUD operation types defined in the permission metadata and generate a set of operation types to be verified. Iterate through the permission items and verify whether the operation type field of each permission item belongs to the set of operation types to be verified. If the operation type field of any permission item does not belong to the set of operation types to be verified, the verification fails and a permission configuration exception report is output, indicating the operation type that cannot be matched. If the operation type field of all permission items belongs to the set of operation types to be verified, then the operation permission is confirmed to be compatible with the CRUD operation type, and a verification pass instruction is output.

4. The method for constructing a low-code model according to claim 1, characterized in that, The steps to generate a model parse tree include: Construct the root node of the parse tree, and set the model name and version number from the basic metadata in the root node; The basic metadata, mapping metadata, cache metadata, and permission metadata are parsed sequentially to generate field definition sub-nodes, mapping rule sub-nodes, cache strategy sub-nodes, and permission control sub-nodes, respectively. Define nodes for each field, bind corresponding field mapping rules, associated permission operation items, and adapted cache effective scope; After performing the parse tree integrity check, the model parse tree is output.

5. The method for constructing a low-code model according to claim 1, characterized in that, The specific steps for allocating operation permissions based on permission metadata and generating permission interception and verification logic include: Parse the permission metadata and extract permission items containing operation type field and permission expression field; Iterate through each generated CRUD interface, identify its operation type, and match the corresponding permission items; Assign the permission expression field in the matched permission item to the corresponding interface as the access permission condition for that interface, and generate permission interception and verification logic that includes interface path matching rules and no-permission handling logic.

6. The method for constructing a low-code model according to claim 5, characterized in that, The execution process of the generated permission interception and verification logic when a user accesses the site includes: When accessing the CRUD interface through the API gateway, the gateway intercepts the current request; Extract the user's identity information and the set of permissions granted from the request context; Based on the target interface path requested, match and obtain the access permission conditions bound to that interface; Determine whether the current user's permission set satisfies the access permission conditions; If the conditions are met, the request is allowed, permitting the invocation of the target CRUD interface; If the conditions are not met, access is denied, and an error response indicating that access is not permitted is returned.

7. The method for constructing a low-code model according to claim 6, characterized in that, The step of determining whether the current user's permission set satisfies the access permission condition includes: Parse the access permission conditions and extract the corresponding permission expressions. The permission expressions may contain a single permission identifier or a compound permission expression containing logical operators. When the permission expression is a single permission identifier, it is determined whether there is a permission in the current user's permission set that matches the single permission identifier. If there is, it is determined that the permission is satisfied. When the permission expression is a composite permission expression, it is split into multiple sub-permission conditions according to logical operators. The current user's permission set is then judged to see if each sub-permission condition is met. Logical operations are then performed on the judgment results of each sub-permission condition according to the logical operators to obtain the final permission verification result.

8. The method for constructing a low-code model according to claim 1, characterized in that, The steps for managing the cache of CRUD interface returned data according to the caching strategy include: Load the cache metadata of the enhanced business model, and extract the cache key rules, cache validity period, cache update mechanism and cache invalidation policy; Generate a cache key according to the cache key rules, and query whether the cache key corresponds to cache data in the cache; If the cache exists and its validity period has not expired, the cached data is returned directly. If the cache does not exist or its validity period has expired, the business logic that calls the interface retrieves the returned data, associates the returned data with the cache key, stores it in the cache, and records the cache entry time. Monitor source data change events, and based on the cache update mechanism and cache invalidation policy, perform proactive refresh or mark invalidation on the associated cache data.

9. The method for constructing a low-code model according to claim 1, characterized in that, The steps for using an incremental update mechanism include: Differential comparison of the current version and the previous version of the model metadata snapshot identifies field-level change points and version iteration change points, and generates a model change list; Based on the model change list and the mapping metadata, the changes are mapped to database table structure adjustment items, interface input parameter adjustment items, and output parameter adjustment items; The table structure adjustment items, input parameter adjustment items, and output parameter adjustment items are packaged into an incremental update package, and the structure of the database tables associated with the changes is updated and the code is hot-released for the corresponding interfaces.

10. A system for building a low-code model, characterized in that, include: The model definition module is used to define the enhanced business model, which includes basic metadata, mapping metadata, cache metadata, and permission metadata. The cache metadata is used to define the caching strategy for model data. The cache key rules in the cache metadata are generated based on the field definitions in the basic metadata. The operation permissions in the permission metadata are bound to the corresponding CRUD operation types. The verification and parsing module is used to perform legality verification on the enhanced business model. The legality verification includes at least the matching verification of cache key rules and field definitions, and the adaptation verification of operation permissions and CRUD operation types. After successful verification, the metadata is parsed to generate a model parse tree. The interface generation module is used to generate CRUD interfaces based on the model parse tree, allocate operation permissions according to the permission metadata, and generate permission interception and verification logic. The cache management module is used to manage the cache of data returned by the CRUD interface according to the cache strategy defined by the cache metadata. Different models can be configured with cache strategies independently. The incremental update module is used to identify model changes when deploying CRUD interfaces. It uses an incremental update mechanism to update only the database tables and interfaces corresponding to the changes.