CRUD implementation method and device and readable storage medium
By parsing and generating executable statements through the CRUD scheduling engine, the problem of being unable to handle complex business logic in existing technologies is solved, enabling zero-programming CRUD operations and meeting the needs of complex business scenarios.
Patent Information
- Application Number
- CN202411008745.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-11-12
AI Technical Summary
Existing CRUD implementation methods can only achieve simple CRUD through hard coding or configuration, and cannot handle complex call relationships and complex business logic, thus failing to meet the needs of complex business scenarios.
The CRUD scheduling engine obtains the business configuration data corresponding to the business identifier, parses the business rule data and execution order, generates executable statements, and executes them through the database to achieve complex CRUD operations, replacing hard coding and achieving zero programming.
It enables the sequential execution of pre-configured business rules and corresponding CRUD statements without zero programming, meeting the needs of complex business scenarios and overcoming the shortcomings of existing technologies.
Smart Images

Figure CN118939236A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software development, and in particular to a CRUD implementation method, device and readable storage medium. Background Art
[0002] Traditional software development usually requires writing relevant CRUD (Create, Read, Update, Delete) codes according to the actual business scenarios and a certain calling sequence and business processing logic to meet business needs.
[0003] However, the existing CRUD implementation method can only implement simple CRUD through hard coding or configuration. It does not have the ability to handle complex call relationships and complex business logic. It only supports simple data table queries or independent addition, deletion and modification capabilities. Actual business scenarios still require coding to support. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a CRUD implementation method, device and readable storage medium in view of the above-mentioned deficiencies in the prior art, so as to solve the problem that the existing CRUD implementation method can only implement simple CRUD by hard coding or configuration, and has no ability to handle complex call relationships and complex business logic.
[0005] In a first aspect, the present invention provides a CRUD implementation method, the method comprising:
[0006] Obtaining a service request sent by a user, wherein the service request carries a service identifier;
[0007] Obtaining the business configuration data corresponding to the business identifier through the CRUD scheduling engine;
[0008] Parsing the business configuration data to obtain corresponding business rule data and execution sequence;
[0009] Generate executable statements according to the CRUD statements and parameters in the business rule data and the execution sequence;
[0010] Execute the executable statement and return the execution result data.
[0011] Furthermore, after obtaining the service request sent by the user, the method further includes:
[0012] The service request is subjected to security filtering.
[0013] Furthermore, before obtaining the service configuration data corresponding to the service identifier through the CRUD scheduling engine, the method further includes:
[0014] Cache the business configuration data corresponding to the business identifier configured by the configuration personnel, and refresh the cache;
[0015] The obtaining of the business configuration data corresponding to the business identifier through the CRUD scheduling engine specifically includes:
[0016] The business configuration data corresponding to the business identifier is obtained from the cache pool through the CRUD scheduling engine.
[0017] Further, the parsing of the business configuration data to obtain corresponding business rule data and execution sequence specifically includes:
[0018] The business configuration data is parsed by a business rule parser to obtain corresponding business rule data and an execution sequence.
[0019] Furthermore, the business request also carries operation data, and the executable statements are generated according to the CRUD statements and parameters in the business rule data and the execution sequence, specifically including:
[0020] The CRUD statements and parameters are preprocessed according to the operation data by a preprocessing module, and the executable statements are generated according to the preprocessed statements and the execution sequence.
[0021] Furthermore, the CRUD statement has a special tag as a placeholder, and the preprocessing module preprocesses the CRUD statement and parameters according to the operation data, specifically including:
[0022] The special tags in the CRUD statement are parsed by the preprocessing module, and corresponding parameters in the CRUD statement are replaced with the operation data according to the parsing result, and / or some fragments in the CRUD statement are deleted.
[0023] Further, executing the executable statement and returning the execution result data specifically includes:
[0024] Executing the executable statement through a database;
[0025] The execution result data is encrypted by the CRUD scheduling engine and returned to the front end.
[0026] In a second aspect, the present invention provides a CRUD implementation device, the device comprising:
[0027] A service request acquisition module, used to acquire a service request sent by a user, wherein the service request carries a service identifier;
[0028] A business configuration data acquisition module, connected to the business request acquisition module, for acquiring the business configuration data corresponding to the business identifier through the CRUD scheduling engine;
[0029] A business configuration data parsing module, connected to the business configuration data acquisition module, for parsing the business configuration data to obtain corresponding business rule data and execution sequence;
[0030] An executable statement generation module, connected to the business configuration data parsing module, for generating executable statements according to the CRUD statements and parameters in the business rule data and the execution sequence;
[0031] The CRUD implementation module is connected to the executable statement generation module, and is used to execute the executable statement and return execution result data.
[0032] In a third aspect, the present invention provides a CRUD implementation device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the CRUD implementation method described in the first aspect.
[0033] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the CRUD implementation method described in the first aspect is implemented.
[0034] The CRUD implementation method, device and readable storage medium provided by the present invention. First, a business request sent by a user is obtained, and the business request carries a business identifier; then the business configuration data corresponding to the business identifier is obtained through the CRUD scheduling engine; and the business configuration data is parsed to obtain the corresponding business rule data and the execution sequence; then an executable statement is generated according to the CRUD statements and parameters in the business rule data and the execution sequence; and the executable statement is executed, and the execution result data is returned. The present application replaces hard coding to implement complex CRUD by prior database configuration. By sending a business request carrying a business identifier, the user can execute the pre-configured business rules in sequence to call the corresponding CRUD statements to achieve the purpose of zero programming, thereby meeting complex business scenarios. It solves the problem that the existing CRUD implementation method can only implement simple CRUD through hard coding or configuration, and does not have the ability to handle complex calling relationships and complex business logic. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 This is a flow chart of a CRUD implementation method of Example 1 of the present invention;
[0036] Figure 2This is a flow chart of the working principle of the CRUD implementation method of Example 1 of the present invention;
[0037] Figure 3 This is a logic diagram of the CRUD implementation method of Example 1 of the present invention;
[0038] Figure 4 This is a flowchart of another CRUD implementation method of Example 1 of the present invention;
[0039] Figure 5 This is a schematic diagram of the structure of a CRUD implementation device according to Embodiment 2 of the present invention;
[0040] Figure 6 This is a structural diagram of a CRUD implementation device according to Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0041] In order to enable those skilled in the art to better understand the technical solution of the present invention, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0042] It should be understood that the specific embodiments and drawings described herein are only used to explain the present invention rather than to limit the present invention.
[0043] It can be understood that, in the absence of conflict, the various embodiments of the present invention and the various features in the embodiments can be combined with each other.
[0044] It can be understood that, for the convenience of description, the drawings of the present invention only show the parts related to the present invention, while the parts irrelevant to the present invention are not shown in the drawings.
[0045] It can be understood that each unit and module involved in the embodiments of the present invention may correspond to only one physical structure, or may be composed of multiple physical structures, or multiple units and modules may be integrated into one physical structure.
[0046] It can be understood that the terms "first", "second", etc. in the embodiments of the present invention are used to distinguish different objects, or to distinguish different processing of the same object, rather than to describe a specific order of objects.
[0047] It can be understood that, without conflict, the functions and steps marked in the flowcharts and block diagrams of the present invention may occur in an order different from that marked in the drawings.
[0048] It is understood that the flowcharts and block diagrams of the present invention illustrate the possible architectures, functions, and operations of the systems, devices, equipment, and methods according to the various embodiments of the present invention. Each box in the flowchart or block diagram may represent a unit, module, program segment, or code, which contains executable instructions for implementing the specified functions. Moreover, each box or combination of boxes in the block diagram and flowchart may be implemented by a hardware-based system that implements the specified functions, or may be implemented by a combination of hardware and computer instructions.
[0049] It can be understood that the units and modules involved in the embodiments of the present invention can be implemented by software or hardware. For example, the units and modules can be located in a processor.
[0050] Embodiment 1:
[0051] This embodiment provides a CRUD implementation method, such as Figure 1 As shown, the method includes:
[0052] Step S101: Acquire a service request sent by a user, where the service request carries a service identifier.
[0053] In this embodiment, the service identifier is an identifier corresponding to the service being processed, and is used to distinguish different requirements for implementing different service scenarios.
[0054] Optionally, after obtaining the service request sent by the user, the method further includes:
[0055] The service request is subjected to security filtering.
[0056] In this embodiment, the business request also carries operation data. In order to prevent SQL (Structured Query Language) injection, unauthorized operation, etc., the business request is securely filtered through a security filter.
[0057] Step S102: Acquire the business configuration data corresponding to the business identifier through the CRUD scheduling engine.
[0058] In this embodiment, the configuration personnel perform database configuration in advance and configure the service configuration data corresponding to the service identifier into the database.
[0059] Optionally, before obtaining the service configuration data corresponding to the service identifier through the CRUD scheduling engine, the method further includes:
[0060] Cache the business configuration data corresponding to the business identifier configured by the configuration personnel, and refresh the cache;
[0061] The obtaining of the business configuration data corresponding to the business identifier through the CRUD scheduling engine specifically includes:
[0062] The business configuration data corresponding to the business identifier is obtained from the cache pool through the CRUD scheduling engine.
[0063] In this embodiment, the configuration personnel configure the business configuration data corresponding to the business identifiers in all business scenarios, and then cache them. After refreshing, the cache takes effect immediately. The CRUD scheduling engine obtains the corresponding business configuration data from the cache pool according to the business identifier.
[0064] Step S103: parsing the business configuration data to obtain corresponding business rule data and execution sequence.
[0065] Specifically, the business configuration data is parsed by a business rule parser to obtain corresponding business rule data and an execution sequence.
[0066] In this embodiment, the CRUD scheduling engine sends the business configuration data to the business rule parser, which parses the business configuration data, parses out the corresponding business rule data and the execution sequence, and returns the parsing result to the CRUD scheduling engine.
[0067] Step S104: generating executable statements according to the CRUD statements and parameters in the business rule data and the execution sequence.
[0068] In this embodiment, the business rule data includes CRUD statements and parameters, and the executable statements are specifically SQL statements, which can be directly executed by the database.
[0069] Optionally, generating executable statements according to the CRUD statements and parameters in the business rule data and the execution sequence specifically includes:
[0070] The CRUD statements and parameters are preprocessed according to the operation data by a preprocessing module, and the executable statements are generated according to the preprocessed statements and the execution sequence.
[0071] In this embodiment, the CRUD scheduling engine transmits the parsed sequence and business rules to the preprocessing module in sequence, and the preprocessing module preprocesses the CRUD statements and parameters in the business rule data to generate executable statements.
[0072] Optionally, the CRUD statement has a special tag as a placeholder, and the preprocessing module preprocesses the CRUD statement and parameters according to the operation data, specifically including:
[0073] The special tags in the CRUD statement are parsed by the preprocessing module, and corresponding parameters in the CRUD statement are replaced with the operation data according to the parsing result, and / or some fragments in the CRUD statement are deleted.
[0074] In this embodiment, the preprocessing module resolves the CRUD statements in the business rule data. The CRUD statements have special tags specified as placeholders. The preprocessing module parses the special tags, performs anti-injection processing, replaces, and reassembles them to generate executable CRUD statements. This process uses special tags: define / ~~ / as the CRUD statement to be parsed segment; {} is the parameter corresponding to the user's operation data; and finally replaces the operation data passed by the user into SQL.
[0075] The rules for parsing are as follows:
[0076] SELECT name
[0077] FROM USER
[0078] WHERE 1=1 / ~AND NAME='${name}'~ / / ~AND CARD_ID='${cardId}'~ / / ~AND AGE='#{age}'~ /
[0079] Whether the segment between / ~ and ~ / is retained depends on whether the first tag (such as ${}) or the second tag (such as #{}) exists in the segment. If ${} exists, the segment is retained and the passed operation data is replaced regardless of whether the user passes a value to the variable inside ${}. Otherwise, it is not retained. If #{} exists, the segment is retained and the passed operation data is replaced only when the user passes a value to the variable inside #{}. Otherwise, it is not retained. The variables inside {} are the variables of the operation data passed by the user.
[0080] For example, in the above statement, the user passes the operation data cardId = 372924, without passing name and age. The final analysis is:
[0081] SELECT name
[0082] FROM USER
[0083] WHERE 1=1AND NAME=''AND CARD_ID='372924'. No data is passed for name. According to the parsing rule "there is ${}, whether the user passes a value for the internal variable of ${}, the fragment is retained and the data for the passing operation is replaced", so "AND NAME=''" is retained; the parsing rule for cardId=372924 is passed, so AND CARD_ID='372924' is retained; no data is passed for age. According to the parsing rule "there is #{}, only when the user passes a value for the internal variable of #{}, the fragment is retained and the data for the passing operation is replaced, otherwise it is not retained." Therefore, AND AGE='#{age}' is not retained.
[0084] Step S105: Execute the executable statement and return the execution result data.
[0085] In this embodiment, the executable statement is executed through the database; the execution result data is encrypted by the CRUD scheduling engine and then returned to the front end.
[0086] It should be noted that the existing methods of implementing simple CRUD through hard coding or configuration cannot execute CRUD in an orderly manner according to specific logic without programming. In the face of complex business scenarios, complex business logic needs to be implemented through additional customized coding. The CRUD implementation method provided by the embodiment of the present invention only replaces hard coding to implement complex CRUD through database configuration, and through the agreement of front-end and back-end input and output parameters, the pre-configured business rules are executed in sequence to call the corresponding CRUD to achieve zero programming to meet complex business scenarios.
[0087] In a specific embodiment, the working principle flow chart of the CRUD implementation method is as follows: Figure 2 As shown in the figure, firstly, the database is configured, then the business rules and execution order are parsed, then the CRUD sequence is scheduled, and finally the specific CRUD is executed. The logic diagram of the CRUD implementation method is as follows Figure 3 As shown, the backend configuration personnel configure the database, the operator inputs the operation data in the browser, the CRUD scheduling engine receives the user's request, and performs configuration rules and sequence analysis according to the database configuration, and then executes CRUD.
[0088] In another specific embodiment, Figure 4 As shown, the CRUD implementation method may include the following steps:
[0089] Step 0: The configuration personnel configure the business configuration data corresponding to the business identifiers in all business scenarios, and then cache them. After refreshing, the cache takes effect immediately.
[0090] Step 1: The user initiates a business request with operation data and business identification, which passes through a security filter to ensure the security of the operation data (decrypting parameters, preventing SQL injection, unauthorized operations, etc.).
[0091] It should be noted that the operational data is the entry point for requirements and changes according to the requirements. The business identifier is an identifier for what business is being processed, and is used to distinguish what requirements are being implemented. For example, to query a student's grades: the student's ID is the operational data, and the business identifier is the identifier corresponding to the logic of querying grades. For another example, when new students are admitted, it is necessary to add a new student's academic information: the student's academic information is the operational data, and the business identifier is the identifier corresponding to the logic of inserting academic information into the database. The query of grades and the addition of a new academic information mentioned above correspond to different business identifiers, which are all configured in advance by the configuration personnel.
[0092] Steps 2-3: The CRUD scheduling engine obtains the corresponding business configuration data from the cache pool according to the business identifier; and returns the business configuration data to the CRUD scheduling engine;
[0093] Steps 4-5: The business rule parser parses the business configuration data, parses out the corresponding business rule data and the execution sequence, and returns the parsing result;
[0094] Step 6: The CRUD scheduling engine transmits the parsed sequence and business rules to the preprocessing module in order. The preprocessing module preprocesses the CRUD statements and parameters in the business rule data to generate executable statements.
[0095] Specifically, the preprocessing module first performs security processing on the input parameters passed in by the front end (for example, if the user enters an illegal command, it will be directly filtered out here) to avoid the risk of SQL injection, and then parses the CRUD statements to be executed through rules and replaces parameters (multiple conditions are pre-configured in CRUD, and each condition has a parameter placeholder. Once data A is entered, condition A will be retained during rule parsing in the preprocessing module, and the parameter placeholder in condition A will be replaced with data A) to generate executable statements. The preprocessing module sends the executable SQL to the database for execution and returns the execution result.
[0096] It should be noted that the business rule data includes CRUD statements and parameters.
[0097] Step 7: The database executes the executable statement, and the preprocessing module calls the persistence layer framework to persist the data to the database or return the query results;
[0098] Steps 8 to 10: Return the execution result data, and return the execution result data to the CRUD scheduling engine. The CRUD scheduling engine then encrypts the result data and returns it to the front end.
[0099] It should be noted that the relationship between operation data, business configuration data, business rules and CRUD statements is as follows:
[0100] Operational data: business data on the user side, such as adding a new piece of data to the database; querying the conditions restricted by a list of data, etc.;
[0101] Business configuration data: business rules + CRUD statements, where a business rule refers to a requirement or an operation, which is broken down into many executable SQL statements corresponding to the business. It has its own execution order, its own operation object (operation data), its own execution conditions, its own return type, and its own business identifier.
[0102] For example: Enter a grade on the page, click the page button to call a request to update the student's A grade, and update his class ranking and grade ranking, and finally return a list of the grade rankings of the students in the class.
[0103] The operation data is the grade and student number of student A;
[0104] Business rules: The first step is to modify the data table storing grades in the database (update the grades in the table, the condition is student A's student number), the second step is to modify the data table storing class rankings (update the ranking data of the class ranking table), the third step is to modify the data table storing grade rankings (update the ranking data of the grade ranking table), and the fourth step is to query the class ranking list data and return to the page. Business rules are the execution steps.
[0105] CRUD statements: update score table; update class ranking table; update grade ranking table; select class ranking table. CRUD statements are executed SQL.
[0106] In the above example, the interface provides an input box and a button, which are implemented through database configuration and do not require additional development work.
[0107] It should be noted that in the above technical solution, steps 2, 3, and 4: the "CRUD scheduling engine" obtains multiple business rule data from the cache through the business identifier; the business rule data is passed to the "business rule parser" to parse the corresponding business rules and obtain the corresponding CRUD statements and execution order of the rules; the "CRUD scheduling engine" executes the corresponding CRUD statements in sequence according to the parsed execution order and binds parameters to CRUD according to the dependency defined in the business rules. After executing multiple business rule data in sequence, the business needs of complex scenarios are realized.
[0108] In another specific embodiment, complex CRUD scheduling is solved by pre-configuring the database: complex business scenarios usually require the execution of multiple CRUD statements to meet business needs, and multiple CRUDs usually have a sequence and dependency relationship. This method pre-configures the business rules, corresponding CRUD operations, and business identifiers involved in the complex business scenario to the database in order, generates multiple business rule data, and makes the business rule data effective immediately by refreshing the cache. Then, through the "CRUD scheduling engine" and "business rule parser", the multiple pieces of information configured in the business scenario are parsed and executed in order to meet business needs.
[0109] Specific solutions include:
[0110] (1) Analyze how many steps are needed in complex scenarios to meet business needs, and sort out the CRUD statements, dependencies, and related business rules for the corresponding steps.
[0111] For example, the content of a scenario can be shown in Table 1, where the scenario is the business requirement, which can correspond to the business identifier. The pre-input parameter is a rule, not specific input data. As shown in Table 1, this scenario requires three steps to complete (support). According to the execution order 1-2-3, first query the data in Table A, then delete the data in Table B, and then update the data in Table C. The premise for executing step 2 (deleting the data in Table B) is that the result of querying the data in step 1 must be greater than 1, otherwise step 2 will not be executed.
[0112] Table 1:
[0113]
[0114] (2) Configure the business rule data in the database through the backend, and manually refresh the configuration to flush the business rule data into the cache so that the business rule data takes effect immediately.
[0115] (3) The “CRUD Scheduling Engine” obtains the business rule data to be executed from the cache based on the delivered scenario.
[0116] (4) Through the "Business Rule Parser", the execution order and the corresponding CRUD statements, dependencies, pre-input parameters and other information are parsed.
[0117] (5) Execute each step sequentially to complete the entire business requirement.
[0118] It should be noted that in the above (4): the preprocessing module solves the CRUD statements in the business rule data. The CRUD statements have designated special tags as placeholders. The preprocessing module parses the special tags, performs anti-injection processing, replaces, reassembles, and generates executable CRUD statements.
[0119] This process uses special tags: define / ~~ / as the fragment to be parsed for the CRUD statement; {} contains the parameters corresponding to the data that the user wants to operate on; and finally, the operation data passed by the user is replaced in the SQL.
[0120] The rules for parsing are as follows:
[0121] SELECT name
[0122] FROM USER
[0123] WHERE 1=1 / ~AND NAME='${name}'~ / / ~AND CARD_ID='${cardId}'~ / / ~AND AGE='#{age}'~ /
[0124] Whether the segment between / ~ and ~ / is retained depends on whether there is ${} or #{} in the segment. If ${} exists, the segment is retained and the data for the operation is replaced regardless of whether the user passes a value to the variable inside ${}. Otherwise, it is not retained. If #{} exists, the segment is retained and the data for the operation is replaced only if the user passes a value to the variable inside #{}. Otherwise, it is not retained. The variables inside {} are the variables for the operation data passed by the user.
[0125] For example, in the above statement, the user passes the operation data cardId = 372924, without passing name and age. The final analysis is:
[0126] SELECT name
[0127] FROM USER
[0128] WHERE 1=1AND NAME=''AND CARD_ID='372924'. No data is passed for name. According to the parsing rule "there is ${}, whether the user passes a value for the internal variable of ${}, the fragment is retained and the data for the passing operation is replaced", so "AND NAME=''" is retained; the parsing rule for cardId=372924 is passed, so AND CARD_ID='372924' is retained; no data is passed for age. According to the parsing rule "there is #{}, only when the user passes a value for the internal variable of #{}, the fragment is retained and the data for the passing operation is replaced, otherwise it is not retained." Therefore, AND AGE='#{age}' is not retained.
[0129] In another specific embodiment, the CRUD implementation method may include the following steps:
[0130] a) Input parameter extraction and preprocessing: The operation data submitted by the user is filtered through security filtering of the incoming data to obtain trusted operation data. The operation data is extracted in the preprocessing stage. The extracted data is consistent with the variables in the specified special tags in CRUD. The final executable statement is generated according to the parsing processing rules.
[0131] b) Establish the relationship between business scenarios and data models: Sort out the business scenarios, sort out the CRUD statements, dependencies and related business rules corresponding to the execution rules; sort out the execution order of CRUD, clarify the transaction scope of CRUD execution and transaction consistency requirements, etc. Configure the business scenario in the database in the form of CRUD language.
[0132] c) Build engine scheduling acceleration processing: For the relationship between business scenarios and data models, load them into memory once before the program starts through the redis memory database, and only query the cache database during scheduling. When the business scenario arrives, match the corresponding model configuration through rule matching. Process the input data and model configuration in step a to generate the corresponding executable SQL statement. Execute all configurations in the current business scenario according to the business rules in step b to complete the business scenario requirements.
[0133] d) Improve concurrency: After a request arrives, the request is instantiated through the strategy mode according to the parsed input parameters, and concurrency problems are solved by starting a new thread.
[0134] The CRUD implementation method provided by the embodiment of the present invention first obtains the business request sent by the user, and the business request carries a business identifier; then obtains the business configuration data corresponding to the business identifier through the CRUD scheduling engine; and parses the business configuration data to obtain the corresponding business rule data and the execution sequence; then generates executable statements according to the CRUD statements and parameters in the business rule data and the execution sequence; and executes the executable statements, and returns the execution result data. The present application replaces hard coding with complex CRUD implementation through prior database configuration. By sending a business request carrying a business identifier, the user can execute the pre-configured business rules in sequence to call the corresponding CRUD statements to achieve the purpose of zero programming, thereby meeting complex business scenarios. It solves the problem that the existing CRUD implementation method can only implement simple CRUD through hard coding or configuration, and does not have the ability to handle complex calling relationships and complex business logic.
[0135] Embodiment 2:
[0136] like Figure 5 As shown, this embodiment provides a CRUD implementation device, which is used to execute the above CRUD implementation method, including:
[0137] A service request acquisition module 11 is used to acquire a service request sent by a user, wherein the service request carries a service identifier;
[0138] A business configuration data acquisition module 12, connected to the business request acquisition module 11, is used to acquire the business configuration data corresponding to the business identifier through a CRUD scheduling engine;
[0139] A business configuration data parsing module 13, connected to the business configuration data acquisition module 12, is used to parse the business configuration data to obtain corresponding business rule data and execution sequence;
[0140] An executable statement generation module 14, connected to the business configuration data parsing module 13, is used to generate executable statements according to the CRUD statements and parameters in the business rule data and the execution sequence;
[0141] The CRUD implementation module 15 is connected to the executable statement generation module 14 and is used to execute the executable statement and return execution result data.
[0142] Optionally, the device further comprises:
[0143] The security filtering module is used to perform security filtering on the service request.
[0144] Optionally, the device further comprises:
[0145] A configuration data cache module is used to cache the business configuration data corresponding to the business identifier configured by the configuration personnel, and refresh the cache;
[0146] The service configuration data acquisition module 12 is specifically used for:
[0147] The business configuration data corresponding to the business identifier is obtained from the cache pool through the CRUD scheduling engine.
[0148] Optionally, the service configuration data parsing module 13 is specifically used for:
[0149] The business configuration data is parsed by a business rule parser to obtain corresponding business rule data and an execution sequence.
[0150] Optionally, the service request also carries operation data, and the executable statement generating module 14 includes:
[0151] A preprocessing unit is used to preprocess the CRUD statements and parameters according to the operation data through a preprocessing module, and generate the executable statements according to the preprocessed statements and the execution sequence.
[0152] Optionally, the CRUD statement has a special tag as a placeholder, and the preprocessing unit includes:
[0153] The tag parsing and replacing unit is used to parse the special tags in the CRUD statement through the preprocessing module, and replace the corresponding parameters in the CRUD statement with the operation data according to the parsing result, and / or delete some fragments in the CRUD statement.
[0154] Optionally, the CRUD implementation module 15 is specifically used for:
[0155] Executing the executable statement through a database; and,
[0156] The execution result data is encrypted by the CRUD scheduling engine and returned to the front end.
[0157] Embodiment 3:
[0158] refer to Figure 6 This embodiment provides a CRUD implementation device, including a memory 21 and a processor 22. The memory 21 stores a computer program, and the processor 22 is configured to run the computer program to execute the CRUD implementation method in Example 1.
[0159] The memory 21 is connected to the processor 22. The memory 21 may be a flash memory, a read-only memory or other memory. The processor 22 may be a central processing unit or a single-chip microcomputer.
[0160] Embodiment 4:
[0161] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the CRUD implementation method in the above-mentioned embodiment 1 is implemented.
[0162] The computer-readable storage medium includes volatile or non-volatile, removable or non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, computer program modules or other data). Computer-readable storage media include, but are not limited to, RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable read only memory), flash memory or other memory technology, CD-ROM (Compact Disc Read-Only Memory), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer.
[0163] In summary, the CRUD implementation method, device and readable storage medium provided by the embodiment of the present invention first obtain the business request sent by the user, and the business request carries a business identifier; then obtain the business configuration data corresponding to the business identifier through the CRUD scheduling engine; and parse the business configuration data to obtain the corresponding business rule data and the execution sequence; then generate executable statements according to the CRUD statements and parameters in the business rule data and the execution sequence; and execute the executable statements, and return the execution result data. The present application replaces hard coding to implement complex CRUD by prior database configuration. By sending a business request carrying a business identifier, the user can execute the pre-configured business rules in sequence to call the corresponding CRUD statements to achieve the purpose of zero programming, thereby meeting complex business scenarios. It solves the problem that the existing CRUD implementation method can only implement simple CRUD through hard coding or configuration, and does not have the ability to handle complex calling relationships and complex business logic.
[0164] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present invention, but the present invention is not limited thereto. For those of ordinary skill in the art, various modifications and improvements can be made without departing from the spirit and essence of the present invention, and these modifications and improvements are also considered to be within the scope of protection of the present invention.
Claims
1. A CRUD implementation method, characterized in that: The method comprises: Obtaining a service request sent by a user, wherein the service request carries a service identifier; Obtaining the business configuration data corresponding to the business identifier through the CRUD scheduling engine; Parsing the business configuration data to obtain corresponding business rule data and execution sequence; Generate executable statements according to the CRUD statements and parameters in the business rule data and the execution sequence; Execute the executable statement and return the execution result data.
2. The method according to claim 1, characterized in that After obtaining the service request sent by the user, the method further includes: The service request is subjected to security filtering.
3. The method according to claim 1, characterized in that Before obtaining the business configuration data corresponding to the business identifier through the CRUD scheduling engine, the method further includes: Cache the business configuration data corresponding to the business identifier configured by the configuration personnel, and refresh the cache; The obtaining of the business configuration data corresponding to the business identifier through the CRUD scheduling engine specifically includes: The business configuration data corresponding to the business identifier is obtained from the cache pool through the CRUD scheduling engine.
4. The method according to claim 1, characterized in that The parsing of the business configuration data to obtain corresponding business rule data and execution sequence specifically includes: The business configuration data is parsed by a business rule parser to obtain corresponding business rule data and an execution sequence.
5. The method according to claim 4, characterized in that The business request also carries operation data, and the executable statements are generated according to the CRUD statements and parameters in the business rule data and the execution sequence, specifically including: The CRUD statements and parameters are preprocessed according to the operation data by a preprocessing module, and the executable statements are generated according to the preprocessed statements and the execution sequence.
6. The method according to claim 5, characterized in that The CRUD statement has a special tag as a placeholder, and the preprocessing module preprocesses the CRUD statement and parameters according to the operation data, specifically including: The special tags in the CRUD statement are parsed by the preprocessing module, and corresponding parameters in the CRUD statement are replaced with the operation data according to the parsing result, and / or some fragments in the CRUD statement are deleted.
7. The method according to claim 6, characterized in that The executing the executable statement and returning the execution result data specifically includes: Executing the executable statement through a database; The execution result data is encrypted by the CRUD scheduling engine and returned to the front end.
8. A CRUD implementation device, characterized in that: The device comprises: A service request acquisition module, used to acquire a service request sent by a user, wherein the service request carries a service identifier; A business configuration data acquisition module, connected to the business request acquisition module, for acquiring the business configuration data corresponding to the business identifier through the CRUD scheduling engine; A business configuration data parsing module, connected to the business configuration data acquisition module, for parsing the business configuration data to obtain corresponding business rule data and execution sequence; An executable statement generation module, connected to the business configuration data parsing module, for generating executable statements according to the CRUD statements and parameters in the business rule data and the execution sequence; The CRUD implementation module is connected to the executable statement generation module, and is used to execute the executable statement and return execution result data.
9. A CRUD implementation device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the CRUD implementation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the CRUD implementation method according to any one of claims 1 to 7 is implemented.
