CN116301774A - Code generation method and device, electronic equipment and medium - Google Patents
Code generation method and device, electronic equipment and medium Download PDFInfo
- Publication number
- CN116301774A CN116301774A CN202310279901.8A CN202310279901A CN116301774A CN 116301774 A CN116301774 A CN 116301774A CN 202310279901 A CN202310279901 A CN 202310279901A CN 116301774 A CN116301774 A CN 116301774A
- Authority
- CN
- China
- Prior art keywords
- target
- code
- node
- nodes
- logic
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/36—Software reuse
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The application provides a code generation method, a code generation device, electronic equipment and a medium, wherein the method comprises the following steps: generating a target flow chart corresponding to target logic based on the low-code platform, wherein the target flow chart comprises at least one type of target nodes and connecting lines, and the types of the target nodes comprise: the system comprises basic nodes belonging to basic program sentences, extension nodes pre-packaged by a low-code platform and custom nodes pre-packaged by a user; generating a code segment corresponding to the target node based on the configured target node in the target flow chart, and determining the combination sequence of the code segments in the target flow chart based on the connecting line; and generating target codes corresponding to the target logic according to the code segmentation and combination sequences, so that a user can visually program a native computer language, logic multiplexing can be realized through the custom nodes, and the logic multiplexing rate is improved.
Description
Technical Field
The present invention relates to the field of computers, and in particular, to a code generation method, a code generation device, an electronic device, and a medium.
Background
In low code platforms on the market, industry has fewer tools for logic orchestration than UI orchestration, and business logic is often scattered in the repository of applications and not easily multiplexed. The existing visual arrangement schemes in the market mainly comprise various low-code platforms and programming tools such as scratch and AWS Step Functions. The former mainly is ui arrangement, and a front page and related components are generated by dragging and providing rich material components; in the latter visual arrangement tool aiming at logic, scratch is game programming, bottom logic is packaged into nodes such as moving, steering, changing size, making sound and the like, bottom codes are generated and operated by contact and nesting arrangement from top to bottom, and finally an operation result is transmitted to game characters in a page, so that the characters trigger actions according to the nodes in the dragging arrangement of a user. Based on the above, the existing low-code platform has the problems of high hand threshold and lack of logic arrangement function or low logic multiplexing rate; visual programming tools such as scratch lack the underlying native keyword statements.
Disclosure of Invention
In view of the foregoing, an object of the present application is to provide a code generation method, apparatus, electronic device, and medium, which enable a user to visually perform programming of a native computer language, and further enable logic multiplexing through a custom node, thereby improving a logic multiplexing rate.
The code generation method provided by the embodiment of the application comprises the following steps:
generating a target flow chart corresponding to the target logic based on the low code platform; the target flow chart comprises at least one type of target nodes and connecting lines; the types of the target node include: the system comprises basic nodes belonging to basic program sentences, extension nodes pre-packaged by a low-code platform and custom nodes pre-packaged by a user;
generating a code segment corresponding to the target node based on the configured target node in the target flow chart, and determining the combination sequence of the code segments in the target flow chart based on the connecting line;
and generating target codes corresponding to the target logic according to the code segmentation and the combination sequence.
In some embodiments, there is also provided a code generating apparatus including:
the first generation module is used for generating a target flow chart corresponding to the target logic based on the low-code platform; the target flow chart comprises at least one type of target nodes and connecting lines; the types of the target node include: the system comprises basic nodes belonging to basic program sentences, extension nodes pre-packaged by a low-code platform and custom nodes pre-packaged by a user;
The second generation module is used for generating code segments corresponding to the target nodes based on the configured target nodes in the target flow chart, and determining the combination sequence of the code segments in the target flow chart based on the connecting lines;
and the third generation module is used for generating target codes corresponding to the target logic according to the code segmentation and the combination sequence.
In some embodiments, there is also provided an electronic device comprising: a processor, a memory and a bus, said memory storing machine readable instructions executable by said processor, said processor and said memory communicating over the bus when the electronic device is running, said machine readable instructions when executed by said processor performing the steps of said code generation method.
In some embodiments, a computer readable storage medium is also provided, on which a computer program is stored, which computer program, when being executed by a processor, performs the steps of the code generation method.
Based on this, in the embodiments of the present application, a code generating method, apparatus, electronic device, and medium are provided, and a target flow chart corresponding to target logic is generated based on a low code platform, where the target flow chart includes at least one type of target nodes and connection lines, and the types of the target nodes include: the system comprises basic nodes belonging to basic program sentences, extension nodes pre-packaged by a low-code platform and custom nodes pre-packaged by a user; generating a code segment corresponding to the target node based on the configured target node in the target flow chart, and determining the combination sequence of the code segments in the target flow chart based on the connecting line; generating target codes corresponding to target logic according to the code segmentation and combination sequences; thus, the basic node directly uses the original keywords and sentences in the programming language, and the logic arrangement function can be realized in the low-code platform based on basic program sentence logic; the method comprises the steps of providing basic nodes, expansion nodes and user-defined nodes for users to flexibly select, and meanwhile, providing basic programming statement nodes of programming languages, the expansion nodes with certain functions in the platform, and encapsulating and expanding functions of usable nodes by the users at an upper layer; the method can enable a user to visually program a native computer language, can use the expansion nodes packaged by the platform to replace complex processes, can use the custom nodes to realize logic multiplexing, and improves the logic multiplexing rate; the flow chart is formed based on the nodes and the connecting lines, so that the layout is clear and the readability is high; the user can package the arranged logic into the custom node, so that logic multiplexing is realized, and the logic multiplexing rate is improved; the logic corresponding flow chart consists of nodes and connecting lines, and supports nesting and automatic layout of the nodes; the node and the connection line can divide the whole process into a plurality of sub-processes, the sub-processes are arranged in a visual mode, and when the service logic changes, the node and the connection line can be added, deleted and modified to cope with the service change; the visualization arrangement can present the complex flow in a simple manner, so that a user can understand the workflow more easily, and the use threshold can be greatly reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered limiting the scope, and that other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 shows a method flow diagram of a code generation method according to an embodiment of the present application;
FIG. 2 illustrates a schematic diagram of a graphical user interface of a low code platform according to an embodiment of the present application;
FIG. 3 is a flowchart of a method to be configured for generating target logic based on a low code platform according to an embodiment of the present application;
FIG. 4 shows a scope diagram of a flowchart according to an embodiment of the present application;
FIG. 5 is a flowchart of a method for generating a target flow diagram corresponding to target logic based on a low code platform according to an embodiment of the present application;
FIG. 6 illustrates 8 basic node schematics in a canvas area according to an embodiment of the present application;
FIG. 7 illustrates a schematic diagram of the contents of a logical canvas of a logic according to an embodiment of the present application;
FIG. 8 illustrates a schematic diagram of error hints as described in an embodiment of the present application;
fig. 9 is a schematic diagram showing the structure of the code generating apparatus in the embodiment of the present application;
fig. 10 shows a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it should be understood that the accompanying drawings in the present application are only for the purpose of illustration and description, and are not intended to limit the protection scope of the present application. In addition, it should be understood that the schematic drawings are not drawn to scale. A flowchart, as used in this application, illustrates operations implemented according to some embodiments of the present application. It should be understood that the operations of the flow diagrams may be implemented out of order and that steps without logical context may be performed in reverse order or concurrently. Moreover, one or more other operations may be added to the flow diagrams and one or more operations may be removed from the flow diagrams as directed by those skilled in the art.
In addition, the described embodiments are only some, but not all, of the embodiments of the present application. The components of the embodiments of the present application, which are generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, as provided in the accompanying drawings, is not intended to limit the scope of the application, as claimed, but is merely representative of selected embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be within the scope of the present application.
It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the presence of the features stated hereinafter, but not to exclude the addition of other features.
In low code platforms on the market, industry has fewer tools for logic orchestration than UI orchestration, and business logic is often scattered in the repository of applications and not easily multiplexed. The existing visual arrangement schemes in the market mainly comprise various low-code platforms and programming tools such as scratch and AWS Step Functions. The former mainly is ui arrangement, and a front page and related components are generated by dragging and providing rich material components; in the latter visual arrangement tool aiming at logic, scratch is game programming, bottom logic is packaged into nodes such as moving, steering, changing size, making sound and the like, bottom codes are generated and operated by contact and nesting arrangement from top to bottom, and finally an operation result is transmitted to game characters in a page, so that the characters trigger actions according to the nodes in the dragging arrangement of a user.
The main users of the low-code platform are enterprises which want to reduce the cost and increase the efficiency, although the main users aim at reducing the programming threshold, the main users still have a certain use threshold, the users need to deploy environments, build containers, mirror images and the like, most of the users provide UI editing functions such as page dragging and the like, and the problem of low logic multiplexing rate cannot be solved.
Specifically, scratch is mainly oriented to global children groups and provides a low-threshold visual programming service. But the atomic operations that it provides to the user have been encapsulated in a layer to implement the functions of moving, steering, and making sounds. This feature, while lowering the programming threshold, for users who want to directly contact the python programming language, cannot directly use the native keywords and statements, and cannot directly view the code files produced by building blocks on the current page for debugging.
The layout mode of scratch is that the building blocks are divided into different notches and protrusions according to functions, the nodes are stacked to form logic through complementation of shapes, when the logic is too complex, a user entering the door lacking in a packaging concept often forms relatively bulky code blocks, and the logic is unclear, and is poor in readability and maintainability.
Therefore, the existing low-code platform has high upper threshold, lacks a logic arrangement function or has low logic multiplexing rate; meanwhile, the visual programming tool of scratch lacks the primary keyword statement of the bottom layer, the layout lacks the connection lines, and the readability is poor when the logic is bloated.
Based on this, in the embodiments of the present application, a code generating method, apparatus, electronic device, and medium are provided, and a target flow chart corresponding to target logic is generated based on a low code platform, where the target flow chart includes at least one type of target nodes and connection lines, and the types of the target nodes include: the system comprises basic nodes belonging to basic program sentences, extension nodes pre-packaged by a low-code platform and custom nodes pre-packaged by a user; generating a code segment corresponding to the target node based on the configured target node in the target flow chart, and determining the combination sequence of the code segments in the target flow chart based on the connecting line; generating target codes corresponding to target logic according to the code segmentation and combination sequences; thus, the basic node directly uses the original keywords and sentences in the programming language, and the logic arrangement function can be realized in the low-code platform based on basic program sentence logic; the method comprises the steps of providing basic nodes, expansion nodes and user-defined nodes for users to flexibly select, and meanwhile, providing basic programming statement nodes of programming languages, the expansion nodes with certain functions in the platform, and encapsulating and expanding functions of usable nodes by the users at an upper layer; the method can enable a user to visually program a native computer language, can use the expansion nodes packaged by the platform to replace complex processes, can use the custom nodes to realize logic multiplexing, and improves the logic multiplexing rate; the flow chart is formed based on the nodes and the connecting lines, so that the layout is clear and the readability is high; the user can package the arranged logic into the custom node, so that logic multiplexing is realized, and the logic multiplexing rate is improved; the logic corresponding flow chart consists of nodes and connecting lines, and supports nesting and automatic layout of the nodes; the node and the connection line can divide the whole process into a plurality of sub-processes, the sub-processes are arranged in a visual mode, and when the service logic changes, the node and the connection line can be added, deleted and modified to cope with the service change; the visualization arrangement can present the complex flow in a simple manner, so that a user can understand the workflow more easily, and the use threshold can be greatly reduced.
Referring to fig. 1, fig. 1 is a flowchart illustrating a method of code generation according to an embodiment of the present application; specifically, the code generation method includes the following steps S101-S103;
s101, generating a target flow chart corresponding to target logic based on a low-code platform; the target flow chart comprises at least one type of target nodes and connecting lines; the types of the target node include: the system comprises basic nodes belonging to basic program sentences, extension nodes pre-packaged by a low-code platform and custom nodes pre-packaged by a user;
s102, generating a code segment corresponding to a target node based on the configured target node in the target flow chart, and determining the combination sequence of the code segments in the target flow chart based on the connecting line;
s103, generating target codes corresponding to the target logic according to the code segmentation and the combination sequence.
In the code generation method provided by the embodiment of the application, the basic node directly uses the original keywords and sentences in the programming language, so that a logic arrangement function can be realized in a low-code platform based on basic program sentence logic; the flow chart is formed based on the nodes and the connecting lines, so that the layout is clear and the readability is high; the user can package the arranged logic into the custom node, so that the logic multiplexing is realized, and the logic multiplexing rate is improved.
The execution subject of the code generation method can be a computer, a server, a processor and other electronic devices with data processing functions, and the method can be applied to a low-code platform.
The low code platform, which may also be referred to as a visual programming tool, is used to implement visual editing of logic.
In the step S101, a target flow chart corresponding to the target logic is generated based on the low-code platform, where the target flow chart includes at least one type of target nodes and links; the types of the target node include: the method comprises the steps of basic nodes belonging to basic program sentences, extension nodes which are packaged in advance by a low-code platform and custom nodes packaged in advance by a user.
Here, the basic node is a basic node in a programming language, for example, if, while, assignment, expression and other sentences, so that a user can directly program by using a native python keyword; each basic node consists of two parts of types and user-defined configuration, wherein 8 types are available for users to select: the expressions, assignments, if, while, for, break, continue and code block nodes where the user can customize the input python code. Each node incorporates a basic python statement and the configuration information that the user is required to fill is occupied with placeholders at initialization.
Based on the above, when the embodiment of the application lays out the logic based on the base node, although the programming codes or programming sentences are input, only part of programming sentences are filled in the base node, and the laid-out programming sentences are not needed, so that a user can touch the bottom original keyword sentences, visual programming can be realized, programming thresholds are reduced, and the readability of the logic is improved.
The expansion node is specifically an expansion node encapsulated by a user, such as a timer node with a time delay function, an http node capable of initiating a network request, a for-n loop node and the like.
The user-defined node is specifically a user converting the implemented logic flow chart into the user-defined node; the custom node can be flexibly multiplexed in other flowcharts after adding input parameters and output parameters.
The method comprises the steps of providing basic nodes, expansion nodes and user-defined nodes for users to flexibly select, and meanwhile, providing basic programming statement nodes of programming languages, the expansion nodes with certain functions in the platform, and encapsulating and expanding functions of usable nodes by the users at an upper layer; the method can enable the user to visually program the native computer language, and can also replace complex flow by using the expansion nodes packaged by the platform.
Referring to FIG. 2, FIG. 2 shows a schematic diagram of a graphical user interface of a low code platform; here, the low-code platform supports basic nodes, expansion nodes and user-defined nodes at the same time; the material area of the low-code platform is specifically divided into three areas, and the first area displays basic nodes for programming, such as if, while, assignment, expression and other sentences, so that a user can directly program by using a native python keyword; the second region display system is an expansion node encapsulated by a user, such as a timer node with a time delay function, an http node capable of initiating a network request and a for-n circulation node; the third area displays user-defined nodes, so that a user can convert an implemented logic flow chart into the user-defined nodes, and input and output parameters are added to be flexibly multiplexed in other flow charts.
Referring to fig. 2, the low-code platform is a web-side application, and the graphical user interface displays a canvas area in the middle, a material area displaying a node list on the left side, and a log area viewing codes, running and printing results on the right side.
When generating a target flow chart corresponding to the target logic based on the low code platform, firstly establishing a target logic; responding to the operation of the newly built logic, creating a target logic, and opening a canvas; aiming at a newly built target logic, configuring input parameters and output parameters of the newly built target logic; wherein the input parameters and the output parameters comprise the number of the input parameters and the output parameters and the data type; the data types include int type, boolean type, string type, etc.
After the input parameters and the output parameters of the target logic are configured, the flow chart of the target logic can be arranged in the canvas area.
Referring to fig. 3, a flow chart of a method to be configured corresponding to a target logic generated based on a low code platform includes the following steps S301-S302:
s301, responding to a second selection operation of a node displayed in a material area of a graphical user interface of a low-code platform, and dragging a selected target node into a canvas area of the graphical user interface;
s302, connecting the target nodes through connecting lines to generate a flow chart which corresponds to the target logic and is to be configured.
Here, the step S301 and the step S302 do not represent the target nodes required by selecting the target logic, and then connect the target nodes through the connection lines, or drag the selected target nodes into the canvas area of the graphical user interface one by one, and drag the target nodes into the canvas area through the connection lines in real time.
In the embodiment of the present application, a user may act on a node displayed in a material area based on a touch manner such as clicking, long pressing, dragging, etc. to generate a selection operation for the at least one node, and in response to the selection operation, a node corresponding to the selection operation may be a target node and dragged into a canvas. Alternatively, the number of target nodes may be 3, 5, 10, etc., which are not limited herein and may be different depending on the actual logic.
When the flow chart corresponding to the target logic and to be configured is generated, the layout principle of the target nodes in the canvas area is that the automatic layout is combined with the manual layout.
Specifically, generating a flow chart to be configured corresponding to the target logic includes:
when a hierarchical flow chart is generated based on part of target nodes, the position of the scope of the existing hierarchy in the flow chart is adjusted, and the position of the scope corresponding to the target node of the current hierarchy is determined;
the rank of each scope is determined based on the location of the scope of each hierarchy in the flow.
Referring to fig. 4, fig. 4 shows a schematic view of a scope of a flowchart; in fig. 4, a flow chart with four while nodes, one for each hierarchy, is shown. When a node is dragged into the flow chart of the link, the flow chart performs automatic layout based on an automatic layout algorithm. The automatic layout algorithm divides the scope based on each hierarchy, the scope of the lowest hierarchy is an atomic node, and the scope of the highest hierarchy is the entire canvas. When a node is pulled into a scope, the size of the scope is re-acquired, the scope is further bubbled layer by layer to the upper layer until the canvas at the top layer, each scope is respectively laid out by using the length, width, vertex abscissa and fixed point ordinate of the scope, and the position of the scope in the canvas area is determined.
Illustratively, the leftmost white node in FIG. 4 has a scope that is the highest level, i.e., the entire canvas; after the second white node on the left is pulled into the painting area, determining a scope of the second white node on the left; when the third white node on the left side is pulled into the painting area and is connected with the second white node on the left side, the third white node on the left side enters the scope of the second white node on the left side; at this time, the length, width, vertex abscissa and fixed point ordinate of the scope of the second white node on the left side are redetermined to redetermine the scope of the second white node on the left side, and the length, width, vertex abscissa and fixed point ordinate of the scope of the third white node on the left side are determined to determine the scope of the third white node on the left side; until the scope of the fourth while node is determined.
It can be seen that the scope of 4 while nodes in fig. 4 is arranged in order, the width is consistent, and the duty ratio in canvas is reasonable; therefore, when the flow chart is built, the scope corresponding to the target node is automatically laid out, and the readability of the flow chart is improved.
Referring to fig. 5, in the step S101, a target flowchart corresponding to target logic is generated based on a low code platform, including the following steps S501-S502;
S501, generating a flow chart to be configured corresponding to target logic based on a low-code platform; the flow chart to be configured comprises target nodes to be configured and connecting lines;
s502, configuring attribute information of each target node and end connection information of each connecting line in the flow chart to be configured, and generating a target flow chart corresponding to target logic.
The flow chart corresponding to the target logic consists of nodes and connecting lines, and supports nesting and automatic layout of the nodes; the node and the connection can divide the whole process into a plurality of sub-processes, and the sub-processes are arranged in a visual mode; when the business logic changes, nodes can be added, deleted and modified to cope with the business changes by changing the connecting lines; the visual arrangement can present a complex flow in a simple way, so that a user can understand the workflow more easily, and if a novice user touches a task which can be completed in the form of a drag graph, the use threshold of the system can be greatly reduced.
Here, the configuring the attribute information of each target node in the to-be-configured flowchart, where the attribute information of the target node includes a node id, a node name, whether logic is asynchronous, and other basic attributes of the node; and when the target node is a basic node, the attribute information of the target node further comprises program codes; when the target node is a custom node, the attribute information of the target node further comprises an input parameter and an output parameter.
Based on this, the configuring the attribute information of each target node in the to-be-configured flowchart includes:
and when the type of the target node is a basic node, filling program codes in a filling control of the target node to configure attribute information of the basic node.
The configuring the attribute information of each target node in the to-be-configured flow chart comprises the following steps:
and when the type of the target node is a custom node, filling in input parameters and output parameters in a configuration control of the target node so as to configure attribute information of the custom node.
In this embodiment of the present application, configuring end connection information of each connection includes:
the start point id and the end point id of the connection line are configured to represent a node connected with the start point and a node connected with the end point of the connection line.
For the target logic, the configured attribute information of the node is stored in a DSL structure, and is specifically stored in the uiData field of the target logic. Storing two arrays of nodes and connecting lines in uiData, wherein each node stores own id, type and configuration information input by a user; each link stores its own start id and end id.
Here, the start id of the link is the id of the node to which the link start is connected; the end point id of the connection is the id of the node to which the end point of the connection is connected.
Meanwhile, only one starting point node and one ending point node exist in each canvas, and after all the connection information and the starting point and ending points are traversed at the moment, the information and the sequence of all the nodes can be obtained in sequence. This view data is also the basis for the subsequent steps.
It should be noted that, in general, there is one target logic in each canvas; the target logic may include several sub-logics therein, for example, the target logic is a ratio of the sum of the first 100 variables to the product of the first 10 variables; at this time, the sum of the first 100 variables is calculated as a sub-logic, and the product of the first 10 variables is calculated as a sub-logic; the sub-logics can be realized by adopting user-defined nodes, and the sub-logics do not need to be built through a base node, so that logic multiplexing is realized.
In this embodiment, referring to fig. 6, fig. 6 shows 8 basic node diagrams in a canvas area; when the type of the target node is a basic node, filling program codes in a filling control of the target node to configure attribute information of the basic node, wherein the method comprises the following steps:
responding to filling operation aiming at a basic node, and displaying a filling control in the target node; the filling control comprises at least one filling frame and/or partial pre-configured program codes;
Filling program codes in the filling boxes, and determining attribute information of the basic nodes based on the filling program codes and/or partial pre-configured program codes.
That is, the program codes are filled in the filling control of the target node, and the corresponding program codes are filled in according to the filling boxes in the filling control; it is not necessary to fill out all code that implements the function of the target node starting from scratch.
Referring to fig. 6, the assignment node in fig. 6 only needs to fill in assignment parameters at two ends of an equal sign, where =sign is a part of the preconfigured program code displayed in the filling control ; The expression node in fig. 6 then needs to enter the completed expression code, i.e. the filling control only includes the filling box.
That is, the filling control includes at least one filling frame and/or a part of pre-configured program code, in two cases, one: the filling control comprises at least one filling frame; the filling control comprises at least one filling box and partial pre-configured program codes.
In the code generation method according to the embodiment of the present application, after generating the target flowchart corresponding to the target logic, the method further includes:
Determining a target node to be packaged in response to a first selection operation for at least part of target nodes logically corresponding in the target flow chart; wherein the target node to be packaged comprises at least one target node;
and responding to the encapsulation operation aiming at the target node to be encapsulated, and encapsulating the target node to be encapsulated into a custom node.
Here, the at least partially logically corresponding target node typically constitutes a sub-logic in the target logic, e.g., the target logic is a ratio of the sum of the first 100 variables to the product of the first 10 variables; at this time, the sum of the first 100 variables is calculated as a sub-logic, and the product of the first 10 variables is calculated as a sub-logic; if a target node corresponding to the sub-logic of the sum of the first 100 variables is selected, the sub-logic of the sum of the first 100 variables is packaged into a custom node; or, the target flow chart is directly packaged as a custom node, that is, all target nodes in the target flow chart are packaged as a custom node.
That is, some nodes in the target flowchart may be encapsulated as a custom node during the process of building the target flowchart. Or after the configuration of the target flow chart is completed, the whole target flow chart is packaged into a custom node.
In the embodiment of the present application, a user may act on a target node in a flowchart of a canvas area based on a touch manner such as clicking, long pressing, dragging, etc. to generate a first selection operation for the at least one target node, and in response to the first selection operation, a node corresponding to the first selection operation may be packaged as a custom node. Alternatively, the number of target nodes selected in the first selection operation may be 3, 5, 10, etc., which are not limited herein, and may be different according to actual logic.
Based on this, after the target node to be packaged is packaged as a custom node, the method further includes:
and replacing at least part of target nodes logically corresponding to the target flow chart with the packaged custom nodes, and updating the target flow chart.
For example, in the process of building the target flow chart, after part of nodes in the target flow chart are packaged into a custom node, the packaged custom node is used for replacing the part of nodes corresponding to the target flow chart, so that the flow chart layout is simpler.
Meanwhile, in the process of building the target flow chart, part of nodes in the target flow chart are packaged into a custom node, the custom node can be used in the subsequent building of the target flow chart, and the sub-logic can be reused in the target flow chart without independently building and packaging the target flow chart for the sub-logic, so that the method is more convenient, and the logic multiplexing rate in the process of building the flow chart is improved.
In this embodiment, in response to a packaging operation for a target node to be packaged, packaging the target node to be packaged as a custom node includes:
responding to the encapsulation operation aiming at the target node to be encapsulated, and encapsulating the target node to be encapsulated and the preconfigured identification information into a custom node;
and displaying the packaged custom nodes in the custom node area of the material area of the graphical user interface of the low-code platform based on the identification information in the custom nodes.
In order to improve reusability, the low-code platform determines the types of the nodes and the specific display areas of the nodes based on the identification information in the custom nodes, so that the custom nodes can be dragged into the custom node areas in the right lower corner material areas in other canvas or current canvas for flexible multiplexing, the custom nodes can be used independently, the return values of the custom nodes can be used as variables to be assigned to other variables, and the custom nodes can be nested in the custom nodes, so that the logic multiplexing rate is enhanced.
One logic in the low code platform is one function file in the code, such as the function file in python; the function signature of a function is determined by the type, number and type of the input parameters; to enable more flexible use of compiled logic in the canvas, the low code platform may configure input parameters, output parameters, and local variables for the constructed logic.
Specifically, the input parameters, the output parameters and the local variables are respectively stored in three fields of the DSL of the logic in an array structure, the types of the input parameters, the output parameters or the local variables are described by using a schema field, and the schema field is provided with three subfields of type, naming space and reference id; when the type is a basic type, the type is directly used for describing; if the type of the input parameter, the output parameter or the local variable is a complex type, the input parameter, the output parameter or the local variable is represented by combining a name space and a reference id.
After the logic has the basis of the input parameters and the output parameters, the logic provides the identification information of whether the user-defined node is or not to distinguish the user-defined node from the logic. If the user wants to implement a logic of the sum of n numbers before printing, the content of the logic canvas can be defined as shown in fig. 7, wherein the output parameter of the logic is result, and the logic canvas outputs the sum of 0 to 4. Here, the logical canvas of the logic, i.e., the logically corresponding configured flow chart, is exposed in the canvas.
In the step S102, code segments corresponding to the target nodes are generated based on the configured target nodes in the target flowchart, and the combination sequence of the code segments in the target flowchart is determined based on the connection line.
Specifically, generating a code segment corresponding to a target node based on the configured target node in the target flowchart includes:
replacing placeholders in program sentences built in the target nodes with matched and configured attribute information; wherein the attribute information includes program code;
and determining the code segment corresponding to the target node based on the replaced attribute information and the built-in program statement.
Except for a starting node and an ending node, the platform provides a base node at a first part of a material area, and each node consists of two parts of type and user-defined configuration; there are 8 types available for user selection: the expressions, assignments, if, while, for, break, continue and code block nodes where the user can customize the input python code.
Each node incorporates a basic python statement, and when the user drags the node into the canvas, the unfilled configuration information will be placed with a placeholder at initialization. After the user inputs the code configuration, the code replaces the content in the placeholder for generating the code in the subsequent step.
And determining the combination sequence of the code segments in the target flow chart based on the connecting lines, wherein the attribute of each connecting line stores the starting point id and the ending point id of the connecting line, and after traversing all connecting line information and the starting point and the ending point, the code segments and the sequence of all nodes are obtained in sequence.
Specifically, after the configuration information of each basic node is configured by a user, an independent code segment is generated at the front end, and the scope level and the connection information of the independent code segment are attached to the configuration information and sent to a code generation server; the code generation server generates a code based on the code segments and the link information.
In the step S103, generating an object code corresponding to the object logic according to the code segmentation and the combination sequence, including:
determining the retraction amount of the code segment according to the scope level corresponding to the code segment;
and generating target codes corresponding to the target logic based on the code segments, the combination sequence and the retraction amount of the code segments.
Specifically, each node is respectively converted into code segment segments at the front end, and then the sequence of each segment of independent code segments is obtained through connection, so as to form a code array and a corresponding scope level; and sending the code array and the scope hierarchy to a code generation server. In the code generation server, the code segment array is arranged according to the sequence of the code segments and the scope level, and the target codes corresponding to the target flow chart are generated by adding and retracting according to the level.
When the target code is generated in the code generation server, the code generation server can complement and install the dependency and perform error detection according to the base library referenced by the user.
In this embodiment of the present application, after generating the object code corresponding to the object logic, the object code may be further converted into a code of another format. For example, the python code is translated by js code. Js, javaScript.
Specifically, in the embodiment of the present application, after the code generation server performs error detection, if the code is correct, the python code is converted into js code.
After generating the target code, the code generation server calls a compiling and running interface of the operating system, and returns the generated target code to the front end.
Based on this, in the embodiment of the present application, after the code generating method generates the target code corresponding to the target logic, the method further includes:
and responding to the operation aiming at the target code, operating the target code corresponding to the target logic on the low code platform, and displaying the operation result of the target code.
The code generating service and the code running are deployed in a low-code platform in a one-stop mode, and a user can directly open the canvas to write and run logic, so that the visual layout logic is experienced, the code is generated and the result is obtained through running, and the three-in-one service improves the user experience.
In this embodiment of the present application, after generating the object code corresponding to the object logic, the code generating method further includes:
and responding to the view operation aiming at the target codes, and viewing the target codes corresponding to the target logic on the low-code platform.
The code generating service, the code running and the code checking are deployed in a low-code platform in one-stop mode, a user can directly open the canvas to write, check and run logic, experience visual arrangement logic, generate codes and run to obtain results, and simultaneously can directly check the nodes or codes corresponding to the logic, so that the requirements of the user who wants to directly contact the python programming language are met.
After generating the target code, detecting the target code, and if the target code is abnormal, determining the position of the abnormal code; when the codes are abnormal, error prompts are provided in the output area, which indicates which line of codes of which file has a problem, and a user can see the error prompts while looking at the codes, and correct the codes according to the error prompts.
Referring to fig. 8, fig. 8 is a schematic diagram illustrating error notification according to an embodiment of the present application.
Here, the code generation server detects the target code, and if the target code is abnormal, the target code and the abnormality detection result are sent to the front end, so that the target code and the error prompt are directly displayed in the low code platform.
In this embodiment of the present application, in the code generating method, after generating the target code corresponding to the target logic, the method further includes:
generating an operation log for recording the operation information of the target code based on an operation log generation rule pre-configured by the low-code platform;
and/or extracting a code log from the target code and/or the running result of the target code based on a code log generation rule pre-configured in the target flow chart;
the execution log and/or code log is printed based on a print operation for the low code platform.
Here, the execution log records execution information in execution of the object code, for example, execution start time, execution end time, and the like; the code log records target codes or running results which are set by a user and need to be output; for example, a code corresponding to a certain sub-logic is printed, an output result of a target logic is printed, and the like.
Based on this, in the code generation method described in the embodiment of the present application, the environment parameters, the code generation service, the code operation and log output functions are deployed in a low code platform in a uniform standing manner, and a user can directly open the canvas to write and operate logic, experience multiple integrated services such as visually arranging the logic, viewing the code, generating the code, and operating to obtain a result.
Based on the same inventive concept, the embodiment of the present application further provides a code generating device corresponding to the code generating method, and since the principle of solving the problem by the device in the embodiment of the present application is similar to that of the code generating method in the embodiment of the present application, the implementation of the device may refer to the implementation of the method, and the repetition is omitted.
Referring to fig. 9, fig. 9 shows a schematic structural diagram of a code generating apparatus according to an embodiment of the present application; specifically, the code generation apparatus includes:
the first generating module 901 is configured to generate a target flowchart corresponding to a target logic based on the low code platform; the target flow chart comprises at least one type of target nodes and connecting lines; the types of the target node include: the system comprises basic nodes belonging to basic program sentences, extension nodes pre-packaged by a low-code platform and custom nodes pre-packaged by a user;
a second generating module 902, configured to generate a code segment corresponding to a configured target node in the target flowchart based on the configured target node, and determine a combination sequence of the code segments in the target flowchart based on the connection line;
and a third generating module 903, configured to generate an object code corresponding to the object logic according to the code segmentation and the combination sequence.
Based on this, in an embodiment of the present application, a code generating device is provided, and a target flow chart corresponding to a target logic is generated based on a low code platform, where the target flow chart includes at least one type of target nodes and links, and the types of the target nodes include: the system comprises basic nodes belonging to basic program sentences, extension nodes pre-packaged by a low-code platform and custom nodes pre-packaged by a user; generating a code segment corresponding to the target node based on the configured target node in the target flow chart, and determining the combination sequence of the code segments in the target flow chart based on the connecting line; generating target codes corresponding to target logic according to the code segmentation and combination sequences; thus, the basic node directly uses the original keywords and sentences in the programming language, and the logic arrangement function can be realized in the low-code platform based on basic program sentence logic; the method comprises the steps of providing basic nodes, expansion nodes and user-defined nodes for users to flexibly select, and meanwhile, providing basic programming statement nodes of programming languages, the expansion nodes with certain functions in the platform, and encapsulating and expanding functions of usable nodes by the users at an upper layer; the method can enable a user to visually program a native computer language, can use the expansion nodes packaged by the platform to replace complex processes, can use the custom nodes to realize logic multiplexing, and improves the logic multiplexing rate; the flow chart is formed based on the nodes and the connecting lines, so that the layout is clear and the readability is high; the user can package the arranged logic into the custom node, so that logic multiplexing is realized, and the logic multiplexing rate is improved; the logic corresponding flow chart consists of nodes and connecting lines, and supports nesting and automatic layout of the nodes; the node and the connection line can divide the whole process into a plurality of sub-processes, the sub-processes are arranged in a visual mode, and when the service logic changes, the node and the connection line can be added, deleted and modified to cope with the service change; the visualization arrangement can present the complex flow in a simple manner, so that a user can understand the workflow more easily, and the use threshold can be greatly reduced.
In some embodiments, the code generating device further includes an operation module, where the operation module is configured to, after generating the target code corresponding to the target logic, respond to an operation for the target code, operate the target code corresponding to the target logic on the low code platform, and display an operation result of the target code.
In some embodiments, the code generating device further includes a viewing module, where the viewing module is configured to, after generating the target code corresponding to the target logic, respond to a viewing operation for the target code, and view the target code corresponding to the target logic on the low code platform.
In some embodiments, the code generating device further includes a fourth generating module, configured to generate, after generating the target code corresponding to the target logic, a running log that records running information of the target code based on a running log generating rule configured in advance by the low code platform;
and/or extracting a code log from the target code and/or the running result of the target code based on a code log generation rule pre-configured in the target flow chart;
The execution log and/or code log is printed based on a print operation for the low code platform.
In some embodiments, the first generating module in the code generating device is specifically configured to, when generating the target flowchart corresponding to the target logic based on the low code platform:
generating a flow chart to be configured corresponding to the target logic based on the low code platform; the flow chart to be configured comprises target nodes to be configured and connecting lines;
and configuring attribute information of each target node and end connection information of each connecting line in the flow chart to be configured to generate a target flow chart corresponding to target logic.
In some embodiments, the first generating module in the code generating device is specifically configured to, when configuring attribute information of each target node in the to-be-configured flowchart:
and when the type of the target node is a basic node, filling program codes in a filling control of the target node to configure attribute information of the basic node.
In some embodiments, the code generating device further includes an encapsulation module, where the encapsulation module is configured to, after generating a target flow chart corresponding to the target logic, determine a target node to be encapsulated in response to a first selection operation for at least a portion of target nodes corresponding to the logic in the target flow chart; wherein the target node to be packaged comprises at least one target node;
And responding to the encapsulation operation aiming at the target node to be encapsulated, and encapsulating the target node to be encapsulated into a custom node.
In some embodiments, the code generating device further includes an updating module, where after the target node to be packaged is packaged as a custom node, the updating module replaces at least part of the target nodes corresponding to the logic of the target flowchart with the packaged custom nodes, and updates the target flowchart.
In some embodiments, the encapsulation module in the code generating apparatus is specifically configured to, in response to an encapsulation operation for a target node to be encapsulated, encapsulate the target node to be encapsulated into a custom node:
responding to the encapsulation operation aiming at the target node to be encapsulated, and encapsulating the target node to be encapsulated and the preconfigured identification information into a custom node;
and displaying the packaged custom nodes in the custom node area of the material area of the graphical user interface of the low-code platform based on the identification information in the custom nodes.
In some embodiments, the first generating module in the code generating device is specifically configured to, when generating the flow chart to be configured corresponding to the target logic based on the low code platform:
Responding to a second selection operation of the nodes displayed in the material area of the graphical user interface of the low-code platform, and dragging the selected target nodes into the canvas area of the graphical user interface;
and connecting the target nodes through connecting lines to generate a flow chart which corresponds to the target logic and is to be configured.
In some embodiments, the first generating module in the code generating device is specifically configured to, when generating the flow chart to be configured corresponding to the target logic:
when a hierarchical flow chart is generated based on part of target nodes, the position of the scope of the existing hierarchy in the flow chart is adjusted, and the position of the scope corresponding to the target node of the current hierarchy is determined;
the rank of each scope is determined based on the location of the scope of each hierarchy in the flow.
In some embodiments, the third generating module in the code generating apparatus is specifically configured to, when generating the target code corresponding to the target logic according to the code segmentation and the combination sequence:
determining the retraction amount of the code segment according to the scope level corresponding to the code segment;
and generating target codes corresponding to the target logic based on the code segments, the combination sequence and the retraction amount of the code segments.
In some embodiments, the second generating module in the code generating device is specifically configured to, when generating a code segment corresponding to a target node based on the target node configured in the target flowchart:
replacing placeholders in program sentences built in the target nodes with matched and configured attribute information; wherein the attribute information includes program code;
and determining the code segment corresponding to the target node based on the replaced attribute information and the built-in program statement.
Based on the same inventive concept, the embodiment of the present application further provides an electronic device corresponding to the code generating method, and since the principle of solving the problem of the electronic device in the embodiment of the present application is similar to that of the code generating method in the embodiment of the present application, the implementation of the electronic device may refer to the implementation of the method, and the repetition is omitted.
Referring to fig. 10, fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application; specifically, the electronic device 1000 includes: a processor 1001, a memory 1002, and a bus, where the memory 1002 stores machine-readable instructions executable by the processor 1001, and when the electronic device 1000 is running, the processor 1001 communicates with the memory 1002 through the bus, and the processor 1001 executes the machine-readable instructions, where the processor 1001 executes the machine-readable instructions to perform the following steps:
Generating a target flow chart corresponding to the target logic based on the low code platform; the target flow chart comprises at least one type of target nodes and connecting lines; the types of the target node include: the system comprises basic nodes belonging to basic program sentences, extension nodes pre-packaged by a low-code platform and custom nodes pre-packaged by a user;
generating a code segment corresponding to the target node based on the configured target node in the target flow chart, and determining the combination sequence of the code segments in the target flow chart based on the connecting line;
and generating target codes corresponding to the target logic according to the code segmentation and the combination sequence.
An embodiment of the present application provides an electronic device, which generates a target flow chart corresponding to target logic based on a low-code platform, where the target flow chart includes at least one type of target node and a connection line, and the type of the target node includes: the system comprises basic nodes belonging to basic program sentences, extension nodes pre-packaged by a low-code platform and custom nodes pre-packaged by a user; generating a code segment corresponding to the target node based on the configured target node in the target flow chart, and determining the combination sequence of the code segments in the target flow chart based on the connecting line; generating target codes corresponding to target logic according to the code segmentation and combination sequences; thus, the basic node directly uses the original keywords and sentences in the programming language, and the logic arrangement function can be realized in the low-code platform based on basic program sentence logic; the method comprises the steps of providing basic nodes, expansion nodes and user-defined nodes for users to flexibly select, and meanwhile, providing basic programming statement nodes of programming languages, the expansion nodes with certain functions in the platform, and encapsulating and expanding functions of usable nodes by the users at an upper layer; the method can enable a user to visually program a native computer language, can use the expansion nodes packaged by the platform to replace complex processes, can use the custom nodes to realize logic multiplexing, and improves the logic multiplexing rate; the flow chart is formed based on the nodes and the connecting lines, so that the layout is clear and the readability is high; the user can package the arranged logic into the custom node, so that logic multiplexing is realized, and the logic multiplexing rate is improved; the logic corresponding flow chart consists of nodes and connecting lines, and supports nesting and automatic layout of the nodes; the node and the connection line can divide the whole process into a plurality of sub-processes, the sub-processes are arranged in a visual mode, and when the service logic changes, the node and the connection line can be added, deleted and modified to cope with the service change; the visualization arrangement can present the complex flow in a simple manner, so that a user can understand the workflow more easily, and the use threshold can be greatly reduced.
In some embodiments, the machine readable instructions, when executed by a processor in the electronic device, further perform the steps of:
after generating the target code corresponding to the target logic, responding to the operation aiming at the target code, operating the target code corresponding to the target logic on the low code platform, and displaying the operation result of the target code.
In some embodiments, the machine readable instructions, when executed by a processor in the electronic device, further perform the steps of:
after generating the target code corresponding to the target logic, responding to a viewing operation aiming at the target code, and viewing the target code corresponding to the target logic on the low code platform.
In some embodiments, the machine readable instructions, when executed by a processor in the electronic device, further perform the steps of:
after generating the target code corresponding to the target logic, generating a running log for recording the running information of the target code based on a running log generation rule pre-configured by the low code platform;
and/or extracting a code log from the target code and/or the running result of the target code based on a code log generation rule pre-configured in the target flow chart;
The execution log and/or code log is printed based on a print operation for the low code platform.
In some embodiments, when the processor in the electronic device executes the machine readable instructions to implement generating a target flowchart corresponding to the target logic based on the low code platform, the method is specifically used for:
generating a flow chart to be configured corresponding to the target logic based on the low code platform; the flow chart to be configured comprises target nodes to be configured and connecting lines;
and configuring attribute information of each target node and end connection information of each connecting line in the flow chart to be configured to generate a target flow chart corresponding to target logic.
In some embodiments, when the processor in the electronic device executes the machine-readable instructions to implement configuring attribute information of each target node in the flowchart to be configured, the method specifically is used to:
and when the type of the target node is a basic node, filling program codes in a filling control of the target node to configure attribute information of the basic node.
In some embodiments, the machine readable instructions are executed by a processor in the electronic device, further configured to perform the steps of:
After a target flow chart corresponding to target logic is generated, determining target nodes to be packaged in response to first selection operation aiming at target nodes corresponding to at least part of logic in the target flow chart; wherein the target node to be packaged comprises at least one target node;
and responding to the encapsulation operation aiming at the target node to be encapsulated, and encapsulating the target node to be encapsulated into a custom node.
In some embodiments, the machine readable instructions are executed by a processor in the electronic device, further configured to perform the steps of:
after the target node to be packaged is packaged into a custom node, at least part of target nodes logically corresponding to the target flow chart are replaced by the packaged custom node, and the target flow chart is updated.
In some embodiments, when the processor in the electronic device executes the machine-readable instructions to implement packaging the target node to be packaged into a custom node in response to a packaging operation for the target node to be packaged, the method is specifically used for:
responding to the encapsulation operation aiming at the target node to be encapsulated, and encapsulating the target node to be encapsulated and the preconfigured identification information into a custom node;
And displaying the packaged custom nodes in the custom node area of the material area of the graphical user interface of the low-code platform based on the identification information in the custom nodes.
In some embodiments, when the processor in the electronic device executes the machine readable instructions to generate the flow chart to be configured corresponding to the target logic based on the low code platform, the method is specifically used for:
responding to a second selection operation of the nodes displayed in the material area of the graphical user interface of the low-code platform, and dragging the selected target nodes into the canvas area of the graphical user interface;
and connecting the target nodes through connecting lines to generate a flow chart which corresponds to the target logic and is to be configured.
In some embodiments, when the processor in the electronic device executes the machine readable instructions to generate the flow chart to be configured corresponding to the target logic, the method is specifically used for:
when a hierarchical flow chart is generated based on part of target nodes, the position of the scope of the existing hierarchy in the flow chart is adjusted, and the position of the scope corresponding to the target node of the current hierarchy is determined;
the rank of each scope is determined based on the location of the scope of each hierarchy in the flow.
In some embodiments, when the processor in the electronic device executes the machine readable instructions to generate the target code corresponding to the target logic according to the code segmentation and the combination sequence, the method is specifically used for:
determining the retraction amount of the code segment according to the scope level corresponding to the code segment;
and generating target codes corresponding to the target logic based on the code segments, the combination sequence and the retraction amount of the code segments.
In some embodiments, when the processor in the electronic device executes the machine-readable instructions to generate the code segment corresponding to the target node based on the configured target node in the target flowchart, the method is specifically used for:
replacing placeholders in program sentences built in the target nodes with matched and configured attribute information; wherein the attribute information includes program code;
and determining the code segment corresponding to the target node based on the replaced attribute information and the built-in program statement.
Based on the same inventive concept, a computer readable storage medium corresponding to the code generation method is also provided in the embodiments of the present application, and since the principle of solving the problem by using the computer readable storage medium in the embodiments of the present application is similar to that of the code generation method in the embodiments of the present application, the implementation of the computer readable storage medium can refer to the implementation of the method, and the repetition is omitted.
Embodiments of the present application provide a computer readable storage medium having a computer program stored thereon, which when executed by a processor, the processor performs the steps of:
generating a target flow chart corresponding to the target logic based on the low code platform; the target flow chart comprises at least one type of target nodes and connecting lines; the types of the target node include: the system comprises basic nodes belonging to basic program sentences, extension nodes pre-packaged by a low-code platform and custom nodes pre-packaged by a user;
generating a code segment corresponding to the target node based on the configured target node in the target flow chart, and determining the combination sequence of the code segments in the target flow chart based on the connecting line;
and generating target codes corresponding to the target logic according to the code segmentation and the combination sequence.
An embodiment of the present application provides a computer readable storage medium, which generates a target flow chart corresponding to target logic based on a low code platform, where the target flow chart includes at least one type of target node and connection line, and the types of the target node include: the system comprises basic nodes belonging to basic program sentences, extension nodes pre-packaged by a low-code platform and custom nodes pre-packaged by a user; generating a code segment corresponding to the target node based on the configured target node in the target flow chart, and determining the combination sequence of the code segments in the target flow chart based on the connecting line; generating target codes corresponding to target logic according to the code segmentation and combination sequences; thus, the basic node directly uses the original keywords and sentences in the programming language, and the logic arrangement function can be realized in the low-code platform based on basic program sentence logic; the method comprises the steps of providing basic nodes, expansion nodes and user-defined nodes for users to flexibly select, and meanwhile, providing basic programming statement nodes of programming languages, the expansion nodes with certain functions in the platform, and encapsulating and expanding functions of usable nodes by the users at an upper layer; the method can enable a user to visually program a native computer language, can use the expansion nodes packaged by the platform to replace complex processes, can use the custom nodes to realize logic multiplexing, and improves the logic multiplexing rate; the flow chart is formed based on the nodes and the connecting lines, so that the layout is clear and the readability is high; the user can package the arranged logic into the custom node, so that logic multiplexing is realized, and the logic multiplexing rate is improved; the logic corresponding flow chart consists of nodes and connecting lines, and supports nesting and automatic layout of the nodes; the node and the connection line can divide the whole process into a plurality of sub-processes, the sub-processes are arranged in a visual mode, and when the service logic changes, the node and the connection line can be added, deleted and modified to cope with the service change; the visualization arrangement can present the complex flow in a simple manner, so that a user can understand the workflow more easily, and the use threshold can be greatly reduced.
In some embodiments, the processor further performs the steps of:
after generating the target code corresponding to the target logic, responding to the operation aiming at the target code, operating the target code corresponding to the target logic on the low code platform, and displaying the operation result of the target code.
In some embodiments, the machine readable instructions, when executed by the processor, further perform the steps of:
after generating the target code corresponding to the target logic, responding to a viewing operation aiming at the target code, and viewing the target code corresponding to the target logic on the low code platform.
In some embodiments, the processor further performs the steps of:
after generating the target code corresponding to the target logic, generating a running log for recording the running information of the target code based on a running log generation rule pre-configured by the low code platform;
and/or extracting a code log from the target code and/or the running result of the target code based on a code log generation rule pre-configured in the target flow chart;
the execution log and/or code log is printed based on a print operation for the low code platform.
In some embodiments, when the processor executes a target flowchart corresponding to the target logic generated based on the low code platform, the processor is specifically configured to:
generating a flow chart to be configured corresponding to the target logic based on the low code platform; the flow chart to be configured comprises target nodes to be configured and connecting lines;
and configuring attribute information of each target node and end connection information of each connecting line in the flow chart to be configured to generate a target flow chart corresponding to target logic.
In some embodiments, when the processor performs configuration of attribute information of each target node in the to-be-configured flowchart, the processor is specifically configured to:
and when the type of the target node is a basic node, filling program codes in a filling control of the target node to configure attribute information of the basic node.
In some embodiments, the processor is further configured to perform the steps of:
after a target flow chart corresponding to target logic is generated, determining target nodes to be packaged in response to first selection operation aiming at target nodes corresponding to at least part of logic in the target flow chart; wherein the target node to be packaged comprises at least one target node;
And responding to the encapsulation operation aiming at the target node to be encapsulated, and encapsulating the target node to be encapsulated into a custom node.
In some embodiments, the processor is further configured to perform the steps of:
after the target node to be packaged is packaged into a custom node, at least part of target nodes logically corresponding to the target flow chart are replaced by the packaged custom node, and the target flow chart is updated.
In some embodiments, the processor is configured to, when performing the encapsulating operation for the target node to be encapsulated, encapsulate the target node to be encapsulated as a custom node, specifically:
responding to the encapsulation operation aiming at the target node to be encapsulated, and encapsulating the target node to be encapsulated and the preconfigured identification information into a custom node;
and displaying the packaged custom nodes in the custom node area of the material area of the graphical user interface of the low-code platform based on the identification information in the custom nodes.
In some embodiments, when the processor executes the flow chart to be configured corresponding to the target logic generated based on the low code platform, the processor is specifically configured to:
Responding to a second selection operation of the nodes displayed in the material area of the graphical user interface of the low-code platform, and dragging the selected target nodes into the canvas area of the graphical user interface;
and connecting the target nodes through connecting lines to generate a flow chart which corresponds to the target logic and is to be configured.
In some embodiments, when the processor executes the flow chart to be configured corresponding to the generation target logic, the processor is specifically configured to:
when a hierarchical flow chart is generated based on part of target nodes, the position of the scope of the existing hierarchy in the flow chart is adjusted, and the position of the scope corresponding to the target node of the current hierarchy is determined;
the rank of each scope is determined based on the location of the scope of each hierarchy in the flow.
In some embodiments, the processor is specifically configured to, when executing the object code corresponding to the object logic according to the code segmentation and the combination sequence:
determining the retraction amount of the code segment according to the scope level corresponding to the code segment;
and generating target codes corresponding to the target logic based on the code segments, the combination sequence and the retraction amount of the code segments.
In some embodiments, when the processor executes to generate a code segment corresponding to a target node based on the configured target node in the target flowchart, the processor is specifically configured to:
Replacing placeholders in program sentences built in the target nodes with matched and configured attribute information; wherein the attribute information includes program code;
and determining the code segment corresponding to the target node based on the replaced attribute information and the built-in program statement.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the method embodiments, which are not described in detail in this application. In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, and the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, and for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, indirect coupling or communication connection of devices or modules, electrical, mechanical, or other form.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer readable storage medium executable by a processor. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a platform server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk, etc.
The foregoing is merely a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes or substitutions are covered in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (16)
1. A code generation method, the method comprising:
generating a target flow chart corresponding to the target logic based on the low code platform; the target flow chart comprises at least one type of target nodes and connecting lines; the types of the target node include: the system comprises basic nodes belonging to basic program sentences, extension nodes pre-packaged by a low-code platform and custom nodes pre-packaged by a user;
generating a code segment corresponding to the target node based on the configured target node in the target flow chart, and determining the combination sequence of the code segments in the target flow chart based on the connecting line;
and generating target codes corresponding to the target logic according to the code segmentation and the combination sequence.
2. The code generation method according to claim 1, wherein after generating the object code corresponding to the object logic, the method further comprises:
And responding to the operation aiming at the target code, operating the target code corresponding to the target logic on the low code platform, and displaying the operation result of the target code.
3. The code generation method according to claim 1, wherein after generating the object code corresponding to the object logic, the method further comprises:
and responding to the view operation aiming at the target codes, and viewing the target codes corresponding to the target logic on the low-code platform.
4. The code generation method according to claim 1, wherein after generating the object code corresponding to the object logic, the method further comprises:
generating an operation log for recording the operation information of the target code based on an operation log generation rule pre-configured by the low-code platform;
and/or extracting a code log from the target code and/or the running result of the target code based on a code log generation rule pre-configured in the target flow chart;
the execution log and/or code log is printed based on a print operation for the low code platform.
5. The code generation method of claim 1, wherein generating a target flow diagram corresponding to target logic based on a low code platform comprises:
Generating a flow chart to be configured corresponding to the target logic based on the low code platform; the flow chart to be configured comprises target nodes to be configured and connecting lines;
and configuring attribute information of each target node and end connection information of each connecting line in the flow chart to be configured to generate a target flow chart corresponding to target logic.
6. The code generation method according to claim 5, wherein configuring the attribute information of each target node in the flowchart to be configured comprises:
and when the type of the target node is a basic node, filling program codes in a filling control of the target node to configure attribute information of the basic node.
7. The code generation method according to claim 5, wherein after generating the target flow chart corresponding to the target logic, the method further comprises:
determining a target node to be packaged in response to a first selection operation for at least part of target nodes logically corresponding in the target flow chart; wherein the target node to be packaged comprises at least one target node;
and responding to the encapsulation operation aiming at the target node to be encapsulated, and encapsulating the target node to be encapsulated into a custom node.
8. The code generation method of claim 7, wherein after encapsulating the target node to be encapsulated as a custom node, the method further comprises:
and replacing at least part of target nodes logically corresponding to the target flow chart with the packaged custom nodes, and updating the target flow chart.
9. The code generation method of claim 7, wherein encapsulating the target node to be encapsulated as a custom node in response to an encapsulation operation for the target node to be encapsulated comprises:
responding to the encapsulation operation aiming at the target node to be encapsulated, and encapsulating the target node to be encapsulated and the preconfigured identification information into a custom node;
and displaying the packaged custom nodes in the custom node area of the material area of the graphical user interface of the low-code platform based on the identification information in the custom nodes.
10. The code generation method of claim 5, wherein generating a flow chart to be configured corresponding to the target logic based on the low code platform comprises:
responding to a second selection operation of the nodes displayed in the material area of the graphical user interface of the low-code platform, and dragging the selected target nodes into the canvas area of the graphical user interface;
And connecting the target nodes through connecting lines to generate a flow chart which corresponds to the target logic and is to be configured.
11. The code generation method according to claim 10, wherein generating a flow chart to be configured corresponding to the target logic includes:
when a hierarchical flow chart is generated based on part of target nodes, the position of the scope of the existing hierarchy in the flow chart is adjusted, and the position of the scope corresponding to the target node of the current hierarchy is determined;
the rank of each scope is determined based on the location of the scope of each hierarchy in the flow.
12. The code generation method of claim 10, wherein generating the object code corresponding to the object logic according to the code segmentation and combination order comprises:
determining the retraction amount of the code segment according to the scope level corresponding to the code segment;
and generating target codes corresponding to the target logic based on the code segments, the combination sequence and the retraction amount of the code segments.
13. The code generation method according to claim 1, wherein generating the code segment corresponding to the target node based on the configured target node in the target flowchart includes:
Replacing placeholders in program sentences built in the target nodes with matched and configured attribute information; wherein the attribute information includes program code;
and determining the code segment corresponding to the target node based on the replaced attribute information and the built-in program statement.
14. A code generating apparatus, the apparatus comprising:
the first generation module is used for generating a target flow chart corresponding to the target logic based on the low-code platform; the target flow chart comprises at least one type of target nodes and connecting lines; the types of the target node include: the system comprises basic nodes belonging to basic program sentences, extension nodes pre-packaged by a low-code platform and custom nodes pre-packaged by a user;
the second generation module is used for generating code segments corresponding to the target nodes based on the configured target nodes in the target flow chart, and determining the combination sequence of the code segments in the target flow chart based on the connecting lines;
and the third generation module is used for generating target codes corresponding to the target logic according to the code segmentation and the combination sequence.
15. An electronic device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory in communication over the bus when the electronic device is running, the machine-readable instructions when executed by the processor performing the steps of the code generation method of any of claims 1 to 13.
16. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, performs the steps of the code generation method of any of claims 1 to 13.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310279901.8A CN116301774A (en) | 2023-03-21 | 2023-03-21 | Code generation method and device, electronic equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310279901.8A CN116301774A (en) | 2023-03-21 | 2023-03-21 | Code generation method and device, electronic equipment and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116301774A true CN116301774A (en) | 2023-06-23 |
Family
ID=86821982
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310279901.8A Pending CN116301774A (en) | 2023-03-21 | 2023-03-21 | Code generation method and device, electronic equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116301774A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118502745A (en) * | 2024-07-17 | 2024-08-16 | 金现代信息产业股份有限公司 | Visual arrangement method, system, medium and device based on back-end code generation |
CN118502745B (en) * | 2024-07-17 | 2024-10-25 | 金现代信息产业股份有限公司 | Visual arrangement method, system, medium and device based on back-end code generation |
-
2023
- 2023-03-21 CN CN202310279901.8A patent/CN116301774A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118502745A (en) * | 2024-07-17 | 2024-08-16 | 金现代信息产业股份有限公司 | Visual arrangement method, system, medium and device based on back-end code generation |
CN118502745B (en) * | 2024-07-17 | 2024-10-25 | 金现代信息产业股份有限公司 | Visual arrangement method, system, medium and device based on back-end code generation |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111506310B (en) | Method, device, equipment and storage medium for generating multi-platform style | |
CN108984172B (en) | Interface file generation method and device | |
Paterno et al. | One model, many interfaces | |
US11216253B2 (en) | Application prototyping tool | |
TW202141300A (en) | Page processing method, device, apparatus and storage medium | |
US10592211B2 (en) | Generation of application behaviors | |
CN107704239B (en) | Configuration generation method and device and electronic equipment | |
US20130117656A1 (en) | Conversion of web template designs | |
JP2010117950A (en) | Layout editing apparatus and layout editing method | |
US20150128110A1 (en) | Mobile application development and deployment | |
CN110708235A (en) | Message generation method and device, storage medium and computer equipment | |
CN113535165A (en) | Interface generation method and device, electronic equipment and computer readable storage medium | |
CN112364496B (en) | Avionics simulation panel generation system based on HTML5 and VUE technologies | |
CN111625226A (en) | Prototype-based human-computer interaction design implementation method and system | |
CN114548056A (en) | Rich text editing method, device and equipment | |
CN112015410A (en) | Webpage editing method, device and system and computer storage medium | |
CN115495069A (en) | Model-driven coal industry software flow implementation method, device and equipment | |
CN106484389A (en) | Stream of action sectional management | |
CN114860218A (en) | Low code development method and device | |
CN108614692A (en) | Edit model method, apparatus, server and medium | |
US7802181B2 (en) | Document processing device and document processing method | |
US10031749B2 (en) | Creation of a help file | |
CN117193745A (en) | Application development method and device combining assembly and large language model | |
CN116301774A (en) | Code generation method and device, electronic equipment and medium | |
CN108647026B (en) | Visual interface integration method and system based on dynamic grid |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |