CN119045816A - Automatic page generation method, device, equipment and medium based on query SQL statement - Google Patents
Automatic page generation method, device, equipment and medium based on query SQL statement Download PDFInfo
- Publication number
- CN119045816A CN119045816A CN202410945594.7A CN202410945594A CN119045816A CN 119045816 A CN119045816 A CN 119045816A CN 202410945594 A CN202410945594 A CN 202410945594A CN 119045816 A CN119045816 A CN 119045816A
- Authority
- CN
- China
- Prior art keywords
- data
- field
- page
- information
- data table
- 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
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Human Computer Interaction (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application discloses a method, a device, equipment and a medium for automatically generating pages based on query SQL sentences, and belongs to the technical field of Internet. The method comprises the steps of obtaining field information of at least one pre-constructed data table, receiving an SQL sentence input by a user, obtaining a parameter-out field in the SQL sentence, determining parameter-out data corresponding to the parameter-out field according to the data table, determining a page generation code based on the parameter-out field and the parameter-out data corresponding to the parameter-out field, and generating a target page to be displayed according to the page generation code. According to the technical scheme, the display page can be generated based on the query statement of the data table, so that a user can quickly acquire the required data in a large amount of data through the key field, the data reference time is greatly saved, the layout of the display page can be automatically configured, and the development efficiency and the page quality of the page are improved.
Description
Technical Field
The application belongs to the technical field of Internet, and particularly relates to a method, a device, equipment and a medium for processing an application program request.
Background
In modern web page development, pages containing complex data presentation and interaction functions have very wide application scenarios.
Currently, creation of a data page requires a developer to manually write corresponding code, which not only increases development time, but also easily introduces erroneous data. In addition, the developer also needs to manually configure and adjust the page layout and functions, so that the workload of the developer is greatly increased, and the development efficiency is seriously affected.
Therefore, the development efficiency of the page is low, the quality of the page development is uneven, a great deal of repeated labor is required in the development process, and the consumed labor cost is high, so that the method is a technical problem to be solved by the technicians in the field.
Disclosure of Invention
The embodiment of the application provides a method, a device, equipment and a medium for automatically generating a page based on query SQL sentences, which aim to generate a display page based on query sentences of a data table, so that a user can quickly acquire required data in a large amount of data through key fields, the data consulting time is greatly saved, the layout of the display page can be automatically configured, and the development efficiency and the page quality of the page are improved.
In a first aspect, the present embodiment provides a method for automatically generating a page based on a query SQL statement, where the method includes:
Acquiring field information of at least one pre-constructed data table;
receiving an SQL sentence input by a user, and acquiring a parameter-out field in the SQL sentence;
Determining parameter outputting data corresponding to the parameter outputting field according to the data table;
Determining a page generation code based on the parameter-out field and parameter-out data corresponding to the parameter-out field;
And generating a target page to be displayed according to the page generating code.
Further, after receiving the SQL statement input by the user, the method further comprises:
acquiring a parameter entering field and a parameter exiting field in the SQL sentence, and condition data input for at least one parameter entering field;
matching the condition data of the parameter entering field with the field information to determine parameter exiting data corresponding to the parameter exiting field;
Determining a page generation code based on the parameter entry field, condition data input for at least one parameter entry field, the parameter exit field and parameter exit data corresponding to the parameter exit field;
And generating a target page to be displayed according to the page generating code.
Further, after receiving the SQL statement input by the user, the method further comprises:
If the SQL statement is a newly added query statement, acquiring field information of a target data table;
taking field information of the target data table as a parameter outputting field, and determining a page generating code based on the parameter outputting field;
Generating a target page to be displayed according to the page generating code;
Receiving adding data input by a user;
And adding the added data to a target data table.
Further, after receiving the SQL statement input by the user, the method further comprises:
if the SQL statement is a deletion type query statement, acquiring primary key information of a target data table;
taking the primary key information of the target data table as output information, and determining a page generation code based on the output information;
Generating a target page to be displayed according to the page generating code;
Receiving a deleting operation of a user;
And deleting the main key of the deletion object corresponding to the deletion operation from the target data table.
Further, after receiving the SQL statement input by the user, the method further comprises:
If the SQL statement is a modified query statement, acquiring field information of a target data table and data content corresponding to the field information;
taking field information of the target data table as a parameter outputting field, taking data content corresponding to the field information as parameter outputting data corresponding to the parameter outputting field, and determining a page generating code based on the parameter outputting field and the parameter outputting data;
Generating a target page to be displayed according to the page generating code;
Receiving a data change operation of a user;
and modifying the change object data corresponding to the data change operation in the target data table.
Further, after receiving the added data input by the user, the method includes:
acquiring a required data type corresponding to each field information in the target data table;
Identifying a data type of the added data;
and generating type error prompt information of the added data when the data type of the added data is inconsistent with the required data type of the information field.
Further, obtaining field information of at least one pre-constructed data table, including:
acquiring the list construction sentence information of at least one pre-constructed data list;
And analyzing field information of each data table based on the table establishing sentence information, and analyzing type information of each data table.
In a second aspect, the present embodiment provides an apparatus for automatically generating a page based on a query SQL statement, where the apparatus includes:
the field information acquisition module is used for acquiring the field information of at least one pre-constructed data table;
the parameter-out field acquisition module is used for receiving an SQL sentence input by a user and acquiring a parameter-out field in the SQL sentence;
the parameter outputting data determining module is used for determining parameter outputting data corresponding to the parameter outputting field according to the data table;
The page generation code determining module is used for determining a page generation code based on the parameter outputting field and parameter outputting data corresponding to the parameter outputting field;
and the target page generating module is used for generating a target page to be displayed according to the page generating code.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a memory, and a program or instruction stored on the memory and executable on the processor, the program or instruction implementing the steps of the method according to the first aspect when executed by the processor.
In a fourth aspect, embodiments of the present application provide a readable storage medium having stored thereon a program or instructions which when executed by a processor perform the steps of the method according to the first aspect.
In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and where the processor is configured to execute a program or instructions to implement a method according to the first aspect.
In the embodiment of the application, field information of at least one pre-constructed data table is acquired, an SQL sentence input by a user is received, a parameter-outputting field in the SQL sentence is acquired, parameter-outputting data corresponding to the parameter-outputting field is determined according to the data table, a page generating code is determined based on the parameter-outputting field and the parameter-outputting data corresponding to the parameter-outputting field, and a target page to be displayed is generated according to the page generating code. By the method for automatically generating the page based on the query SQL statement, the display page can be generated based on the query statement of the data table, so that a user can quickly acquire the demand data in a large amount of data through the key field, the data consulting time is greatly saved, the layout of the display page can be automatically configured, and the development efficiency and the page quality of the page are improved.
Drawings
FIG. 1 is a flow chart of an automatic page generation method based on query SQL statements according to an embodiment of the application;
FIG. 2 is a flowchart of an automatic page generating method based on query SQL statements according to a second embodiment of the present application;
FIG. 3 is a flowchart of generating a user query result page according to a second embodiment of the present application;
FIG. 4 is a flowchart of a method for automatically generating a page based on a query SQL statement according to a third embodiment of the present application;
FIG. 5 is a flowchart of a method for automatically generating a page based on a query SQL statement according to a fourth embodiment of the present application;
FIG. 6 is a flowchart of an automatic page generating method based on query SQL statements according to a fifth embodiment of the present application;
FIG. 7 is a flowchart of a method for automatically generating a page based on a query SQL statement according to a sixth embodiment of the application;
Fig. 8 is a schematic structural diagram of an automatic page generating device based on a query SQL statement according to a seventh embodiment of the present application;
Fig. 9 is a schematic structural diagram of an electronic device according to an eighth embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the following detailed description of specific embodiments of the present application is given with reference to the accompanying drawings. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the matters related to the present application are shown in the accompanying drawings. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart depicts operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently, or at the same time. Furthermore, the order of the operations may be rearranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figures. The processes may correspond to methods, functions, procedures, subroutines, and the like.
The technical solutions of the embodiments of the present application will be clearly described below with reference to the drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which are obtained by a person skilled in the art based on the embodiments of the present application, fall within the scope of protection of the present application.
The terms first, second and the like in the description and in the claims, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged, as appropriate, such that embodiments of the present application may be implemented in sequences other than those illustrated or described herein, and that the objects identified by "first," "second," etc. are generally of a type, and are not limited to the number of objects, such as the first object may be one or more. Furthermore, in the description and claims, "and/or" means at least one of the connected objects, and the character "/", generally means that the associated object is an "or" relationship.
The method, the device, the equipment and the medium for automatically generating the page based on the query SQL statement provided by the embodiment of the application are described in detail through specific embodiments and application scenes thereof by combining the attached drawings.
Example 1
Fig. 1 is a flowchart of a method for automatically generating a page based on a query SQL statement according to an embodiment of the present application.
As shown in fig. 1, the method specifically comprises the following steps:
S101, acquiring field information of at least one pre-constructed data table;
The application scene of the scheme can be a scene of generating a corresponding query result page according to SQL sentences input by a user.
Based on the above scenario, it can be understood that the execution subject of the present scenario may be a front end and a back end for generating the query result page code, where the back end code is generated by the server, and the front end code may be generated by the client, or may be generated by the server and then sent to the client, where no excessive limitation is made.
The data table, which may be the primary data storage container in the database, organizes data by rows and columns. Each column in the table has a name and each column has a specified data type and size. The logical structure of the data table is a two-dimensional table consisting of rows and columns. One of the columns in the table is commonly referred to as an attribute column. A record describes an entity and a column of attributes describes an attribute of the entity.
The field information may be header information in the data table, and is used to describe attributes of each column in the data table. For example, in the class personnel record data table, header information such as student name, number, sex, and entrance time is used as field information.
The method for obtaining the field information of at least one pre-constructed data table may be that a worker inputs the field information and the corresponding specific content information in the data table to be stored into a server through a terminal device in advance, the server stores the field information and the corresponding specific content information in a database according to a specified format, and when a user needs to query a service, the server extracts the field information from the database.
S102, receiving an SQL sentence input by a user, and acquiring a parameter-out field in the SQL sentence;
SQL (Structured Query Language ) statements, may be a standard programming language for managing and manipulating relational databases. The SQL statement may perform various database operations such as querying, updating, inserting, and deleting data.
The out-parameter field may be one or more field information that the user wants to query. For example, if the user wants to query which students are recorded in the data table of class 1, the student name may be used as the out-of-reference field, and if the user wants to query the age of the student recorded in the data table of class 1, the student name and the student age may be used as the out-of-reference field.
The method for obtaining the parameter-out field in the SQL sentence can be that the user inputs the information to be queried in the appointed input box of the query interface, and the client generates the corresponding SQL sentence according to the information content input by the user and sends the SQL sentence to the server. After the server receives the SQL sentence, the SQL sentence is interpreted, and information input by a user is extracted as a parameter field.
S103, determining parameter outputting data corresponding to the parameter outputting field according to the data table;
the parameter data may be content that the user corresponding to the parameter field wants to know. For example, the play field is the name of the student in class 1, and the corresponding play data is all the names under the head of the student name in the data sheet of class 1.
The method for determining the parameter outputting data corresponding to the parameter field according to the data table may be that after the parameter outputting field is obtained, at least one data table in the database is queried for header information consistent with the parameter outputting field, and all elements under the attribute column are obtained as the parameter outputting data.
S104, determining a page generation code based on the parameter-out field and parameter-out data corresponding to the parameter-out field;
The page generation code may be programming code for creating and building web pages. These codes define the structure, style and behavior of the page. Page generation code typically includes three parts, HTML (for defining the structure and content of the page), CSS (for controlling the style and layout of the page) and JavaScript (for increasing the interactivity of the page), but other technologies or frameworks may be involved for personalized pages.
The mode of determining the page generation code can be that a developer constructs a frame of the page generation code according to the style of the page to be displayed, the layout of the page content and other reusable structures, and fills out the parameter output field and the parameter output data to the appointed position of a preset code frame after acquiring the parameter output field and the parameter output data, so as to obtain the page generation code.
S105, generating a target page to be displayed according to the page generation code.
The method for generating the target page to be displayed according to the page generating code can be that the page generating code is operated, the specified display type of the parameter-outputting field is obtained, for example, the specified student name is displayed in the page by using a character string type, the student age is displayed in the page by using integer, and the like, after the format of corresponding parameter-outputting data is adjusted according to the specified display type of the parameter-outputting field, the parameter-outputting data is displayed in the page, the code operation result is obtained, the operation result is tested, namely, whether the parameter-outputting field and the parameter-outputting data are displayed at specified positions is identified, and whether the elements such as buttons, links and forms in the page execute correct operations or not is tested by a method such as manual operation of a developer or test script. And after the test is qualified, determining the current page as a target page.
In the embodiment of the application, field information of at least one pre-constructed data table is acquired, an SQL sentence input by a user is received, a parameter-outputting field in the SQL sentence is acquired, parameter-outputting data corresponding to the parameter-outputting field is determined according to the data table, a page generating code is determined based on the parameter-outputting field and the parameter-outputting data corresponding to the parameter-outputting field, and a target page to be displayed is generated according to the page generating code. By the method for automatically generating the page based on the query SQL statement, the display page can be generated based on the query statement of the data table, so that a user can quickly acquire the demand data in a large amount of data through the key field, the data consulting time is greatly saved, the layout of the display page can be automatically configured, and the development efficiency and the page quality of the page are improved.
Example two
Fig. 2 is a flow chart of a method for automatically generating a page based on a query SQL statement according to a second embodiment of the present application. The method comprises the steps of obtaining a parameter entering field and a parameter exiting field in an SQL sentence input by a user after receiving the SQL sentence input by the user, matching condition data of the parameter entering field with field information according to condition data of the parameter entering field, determining parameter exiting data corresponding to the parameter exiting field, determining a page generating code based on the parameter entering field, the condition data input by the parameter entering field, the parameter exiting field and parameter exiting data corresponding to the parameter exiting field, and generating a target page to be displayed according to the page generating code.
As shown in fig. 2, the method specifically includes the following steps:
s201, acquiring field information of at least one pre-constructed data table;
s202, receiving SQL sentences input by a user;
S203, acquiring a parameter entering field and a parameter exiting field in the SQL sentence, and inputting condition data aiming at least one parameter entering field;
the entry field may be field information that the user wants to query. For example, student age, student gender, etc.
The condition data can be constraint conditions for limiting the search range of the parameter entering data and enabling the query result to be more accurate. For example, regarding the student gender as condition data, only the data information of the student with gender as girl appears in the parameter outputting data, and regarding the student age as parameter inputting field, if the condition data is 15-20 years old, only the parameter outputting data of the student with gender as girl is inquired in the data table.
The method for obtaining the parameter entering field and parameter exiting field in the SQL sentence and the condition data input for at least one parameter entering field can be that the user inputs the information to be queried and the query condition in the designated input box of the query interface, and the client generates the corresponding SQL sentence according to the information content input by the user and sends the SQL sentence to the server. After the service end receives the SQL sentence, the SQL sentence is interpreted, and the parameter entering field, the parameter exiting data and the condition data input for at least one parameter entering field are respectively extracted at the corresponding positions in the SQL sentence.
S204, matching the field information according to the condition data of the parameter entering field, and determining parameter exiting data corresponding to the parameter exiting field;
The method for determining the parameter outputting data corresponding to the parameter field may be to search the information content corresponding to the parameter inputting field and the parameter outputting field in the data table as the field information, to screen according to the condition data in the field information, to only reserve the field information conforming to the condition data, and to use the reserved field information as the parameter outputting data. For example, if the entry field is the student's age, the exit field is the student's name, and the exit data is the student's age in the range of 15-20 years, two columns of data including the student's name and the student's age are extracted from the data table, the data of the student's age less than 15 years old and the data of the student's age greater than 20 years old are removed, the data corresponding to the removed student's age in the student's name are removed together, and the remaining student's age of 15-20 years old and the corresponding student's name are used as the exit data.
S205, determining a page generation code based on the parameter entry field, the condition data input for at least one parameter entry field, the parameter exit field and the parameter exit data corresponding to the parameter exit field;
The determining of the page generating code may be that the parameter entering field, the condition data input for at least one parameter entering field, and the parameter exiting field are filled in a designated position of a preset code frame as user input information, and the parameter exiting field and the parameter exiting data corresponding to the parameter exiting field are written in the designated position of the preset code frame as a query result, so as to construct a complete page generating code.
S206, generating a target page to be displayed according to the page generation code.
For example, fig. 3 is a schematic flow chart of generating a user query result page according to the second embodiment of the present application, as shown in fig. 3, a user inputs table sentence information, for example, data such as a header, a field, and a type in a data table, and the database parses the input data table, sorts the field information in the data table, and stores the sorted field information. When a user needs to inquire information in the data table, the client inputs an inquiry SQL sentence, the client sends the inquiry SQL sentence to the server, the server analyzes the inquiry SQL sentence, extracts parameter-out fields and parameter-in fields in the inquiry SQL sentence, acquires field information corresponding to the parameter-out fields and the parameter-in fields in the data table, determines information content to be displayed on the page according to the parameter-out fields, the parameter-in fields and the field information, generates front and back end codes capable of manufacturing the page according to the information content to be displayed on the page, and operates the front and back end codes to obtain the display page.
The method has the advantages that the queried information can be further screened according to the condition data provided by the user, the display range of the query result is narrowed, the user can accurately acquire the needed information, the user does not need to browse in a large number of query results, and the use experience and the consulting efficiency of the user are improved.
Example III
Fig. 4 is a flowchart of a method for automatically generating a page based on a query SQL statement according to the third embodiment of the present application. The method comprises the steps of obtaining field information of a target data table after receiving SQL sentences input by a user, taking the field information of the target data table as a parameter outputting field, determining a page generating code based on the parameter outputting field, generating a target page to be displayed according to the page generating code, receiving adding data input by the user, and newly adding the adding data into the target data table.
As shown in fig. 4, the method specifically includes the following steps:
s401, acquiring field information of at least one pre-constructed data table;
s402, receiving SQL sentences input by a user;
s403, if the SQL statement is a newly added query statement, acquiring field information of a target data table;
the new type query statement may be a query SQL statement that the user wants to add new data in a storage location corresponding to the specified field information in the data table. For example, the name of student a is added to the student name field information of the data sheet of class 1.
The field information of the target data table may be a column attribute classification of data that the user wants to add in the data table. For example, if the user wants to add the name of student a to the data sheet of class 1, the field information of the target data sheet is the name of the student in the data sheet of class 1.
The determination mode of the target data table may be to obtain the name of the target data table input by the user in the SQL sentence and call the target data table with consistent names in the database, or the determination mode of the target data table may also be to obtain the field information input by the user in the SQL sentence and call the data table with the same field information in the database as the target data table.
The method for obtaining the field information of the target data table may be that the user inputs the data table to be added and the adding position in the designated input box through the client, the client generates a corresponding SQL sentence according to the information input by the user, and sends the SQL sentence to the server, the server receives the SQL sentence and then interprets the SQL sentence, and the information input by the user is extracted as the field information of the target data table.
S404, taking field information of the target data table as a parameter outputting field, and determining a page generating code based on the parameter outputting field;
The method for determining the page generating code may be that after the field information of the target data table is obtained, the field information of the target data table is used as a parameter outputting field, the parameter outputting field is filled in a designated position in a preset code frame to obtain the page generating code of the page of the input frame capable of displaying the field information of the target data table, and after the field information of each target data table is added with the field information of the data obtaining frame.
S405, generating a target page to be displayed according to the page generation code;
s406, receiving the added data input by the user;
The added data may be specific content that the user wants to add. For example, if the user wants to add student a in the data table of class 1, the added data may be information of name, sex, and number of student a.
The manner of receiving the added data input by the user may be that the user inputs the corresponding added data in an input box after the field information of the target data table in the page displayed by the client, the client uses the content input by the user as the added data, and the client sends the added data and the field information of the corresponding target data table to the server, and the server receives the added data. For example, if the user wants to add the name of student a, then a is filled in the input box behind the student name in the page presented by the client.
S407, adding the added data to a target data table.
The mode of adding the added data to the target data table may be extracting the target data table from the database, searching the field information in the target data table, and filling the corresponding field information with the added data. For example, if the added data is a and 12, the field information of the student age of the student name is queried in the target data table, and a and 12 are respectively filled in under the student age header of the corresponding student name.
The method has the advantages that the method can support the user to add data information to the target data table, so that the data adding operation is simpler, and the working efficiency of the user and the use experience of the database are improved.
In this embodiment, optionally, after receiving the added data input by the user, the method includes:
acquiring a required data type corresponding to each field information in the target data table;
Identifying a data type of the added data;
and generating type error prompt information of the added data when the data type of the added data is inconsistent with the required data type of the information field.
The data type, which may be the type of operation that specifies the nature of the data and may be performed, makes the storage, retrieval, etc. of the data more normative and efficient. For example, integer type is used to store integer values, floating point type is used to store values with fractional parts, string is used to store text data, and so on.
The obtaining of the required data type corresponding to each field information in the target data table may be that the required data type of each field information in the data table is set in advance when the user stores the data table in the database. For example, the type of the required data of the student name is set as a character string, the type of the required data of the student age is integer, and the like.
The mode of identifying the data type of the added data can be to identify the format of the added data, wherein the data type is character String (String) if the added data is text information, integer data type is integer (int) if the added data is composed of numbers, decimal data type is float (double), and boolean type (boolean) if the added data is only true or false.
The method for generating the type error prompt information of the added data can be that field information corresponding to the added data is identified, the data type of the added data is matched with the required data type of the corresponding field information, if the matching is inconsistent, the result of inconsistent type matching is written into the prompt information, and the type error prompt information of the added data is generated so as to prompt a user to check the type of the added data. For example, the added data is 12.6, the data type is a floating point type, the required data type of the field information of the corresponding student age is an integer type, the floating point type is inconsistent with the integer type matching, and the type error prompt information of the added data should be generated.
The method has the advantages that the data type of the added data of the user can be detected, the input error of the user can be found in time, the data formats in the data table are kept uniform, and the problem of incompatibility of the data in the data table is avoided.
Example IV
Fig. 5 is a flowchart of a method for automatically generating a page based on a query SQL statement according to a fourth embodiment of the present application. The method comprises the steps of obtaining main key information of a target data table after receiving SQL sentences input by a user, taking the main key information of the target data table as output information, determining a page generation code based on the output information, generating a target page to be displayed according to the page generation code, receiving a deleting operation of the user, and deleting a main key of a deleting object corresponding to the deleting operation from the target data table after receiving the SQL sentences input by the user.
As shown in fig. 5, the method specifically includes the following steps:
S501, acquiring field information of at least one pre-constructed data table;
s502, receiving SQL sentences input by a user;
S503, if the SQL statement is a deletion type query statement, acquiring the primary key information of a target data table;
the delete type query statement may be a query SQL statement that the user wants to delete existing data at a specified location in the data table. For example, all information of student b is deleted in the data table of class 1.
The primary key information may be information that can be represented in the same row of data of the data table. For example, in the class data table, the number is used as the primary key information, and the number is searched, so that all data such as the name, age, etc. of the student corresponding to the number in the same line as the number can be obtained.
The main key information of the target data table can be obtained by inputting the information to be deleted in the designated input box by the user through the client, generating a corresponding SQL sentence by the client according to the information input by the user, sending the SQL sentence to the server, reading the SQL sentence after the server receives the SQL sentence, and extracting the information input by the user as the deleting information of the target data table.
S504, taking the primary key information of the target data table as output information, and determining a page generation code based on the output information;
the method for determining the page generating code may be that after the deletion information of the target data table is obtained, the information content of the same row corresponding to the primary key information of the target data table is obtained, the primary key information and the information content of the same row are used as output information, the output information is filled in a designated position in a preset code frame, so as to obtain the page generating code which can display the output information of the target data table and is provided with the page with the deletion option.
S505, generating a target page to be displayed according to the page generation code;
S506, receiving a deleting operation of a user;
the manner of receiving the deletion operation of the user may be that the user clicks a deletion option corresponding to the data to be deleted in the target page, and after receiving the click operation of the user, the client obtains a deletion object, that is, the data content to be deleted by the user, and sends the deletion object and a deletion instruction to the server, and the server receives the deletion object and the deletion instruction.
S507, deleting the main key of the deletion object corresponding to the deletion operation from the target data table.
The deleting operation may be performed by extracting the target data table from the database, searching the target data table for the deleted object, and deleting the corresponding deleted object primary key.
The method and the device have the advantages that the user can be supported to delete the data information in the target data table, the deleting operation of the data is simple, and the working efficiency of the user and the use experience of the database are improved.
Example five
Fig. 6 is a flowchart of an automatic page generating method based on a query SQL statement according to a fifth embodiment of the present application. The method and the device have the advantages that the embodiment is improved better, and the method and the device are particularly improved, if the SQL statement is a modification type query statement, field information of a target data table and data content corresponding to the field information are obtained, the field information of the target data table is used as a parameter-out field, the data content corresponding to the field information is used as parameter-out data corresponding to the parameter-out field, page generation codes are determined based on the parameter-out field and the parameter-out data, a target page to be displayed is generated according to the page generation codes, data modification operation of a user is received, and modification object data corresponding to the data modification operation are modified in the target data table.
As shown in fig. 6, the method specifically includes the following steps:
s601, acquiring field information of at least one pre-constructed data table;
s602, receiving SQL sentences input by a user;
S603, if the SQL statement is a modified query statement, acquiring field information of a target data table and data content corresponding to the field information;
The modification type query statement may be a query SQL statement sent by the user that wants existing data at a specified location in the data table to be modified to new data. For example, change student name a to b in class 1's data sheet.
The method for obtaining the field information of the target data table and the data content corresponding to the field information may be that the user inputs the existing data to be changed in the designated input box through the client, the client generates a corresponding SQL sentence according to the information input by the user, and sends the SQL sentence to the server, the server receives the SQL sentence and then interprets the SQL sentence, and the information input by the user is extracted as the field information and the data content corresponding to the field information. For example, if the user wants to change the name a in the student names, the field information is the student name, and the data content corresponding to the field information is a.
S604, taking field information of the target data table as a parameter outputting field, taking data content corresponding to the field information as parameter outputting data corresponding to the parameter outputting field, and determining a page generating code based on the parameter outputting field and the parameter outputting data;
The method for determining the page generation code may be that after the field information of the target data table and the data content corresponding to the field information are acquired, the field information of the target data table is used as a parameter outputting field, the data content corresponding to the field information is used as parameter outputting data corresponding to the parameter outputting field, the parameter outputting field and the parameter outputting data are filled in a designated position in a preset code frame, so as to obtain the page generation code capable of displaying the field information of the target data table and the data content corresponding to the field information, and after each data content, an input frame for acquiring new data is added.
S605, generating a target page to be displayed according to the page generation code;
s606, receiving a data change operation of a user;
The mode of receiving the data change operation of the user may be that the user inputs the new data after modification in an input box corresponding to the data content to be modified in the target page, the client sends the new data and the corresponding original data to the server, and the server receives the new data and the corresponding original data.
S607, modifying the change object data corresponding to the data change operation in the target data table.
The modification of the modification target data corresponding to the data modification operation in the target data table may be performed by taking the original data as the modification target data after receiving the new data and the corresponding original data, extracting the target data table from the database, extracting the modification target data from the target data table, deleting the modification target data, and filling the new data in the position.
The method and the device have the advantages that the user can be supported to change the data information in the target data table, so that the data change operation is simpler, and the working efficiency of the user and the use experience of the database are improved.
Example six
Fig. 7 is a flowchart of a method for automatically generating a page based on a query SQL statement according to a sixth embodiment of the present application. The scheme makes a better improvement on the embodiment, and the specific improvement comprises the steps of obtaining field information of at least one pre-constructed data table, including obtaining table construction sentence information of the at least one pre-constructed data table, analyzing the field information of each data table based on the table construction sentence information, and analyzing the type information of each data table.
As shown in fig. 7, the method specifically includes the following steps:
S701, acquiring the list construction sentence information of at least one pre-constructed data list;
The table sentence construction information can be specific contents of a data table which needs to be stored in a database, and the table sentence construction information can comprise a table name, a table field, a field type, field contents, annotation information and the like.
The method for obtaining the list construction sentence information of at least one pre-constructed data list can be that the list construction sentence information of the data list to be stored is input to the server by the user, and the information input by the user is received by the server and then stored in the database.
S702, analyzing field information of each data table based on the table establishment sentence information, and analyzing type information of each data table;
Based on the way that the table-building sentence information analyzes the field information and the type information of each data table, after the server receives the table-building sentence information input by the user, the table-building sentence information can be interpreted, the header information in the table-building sentence information is used as the field information of the data table, and the data type of each field information is used as the type information of the data table.
S703, receiving an SQL sentence input by a user, and acquiring a parameter-out field in the SQL sentence;
s704, determining parameter outputting data corresponding to the parameter outputting field according to the data table;
s705, determining a page generation code based on the parameter-out field and parameter-out data corresponding to the parameter-out field;
S706, generating a target page to be displayed according to the page generation code.
Preferably, the present embodiment provides a target page generating method for reference:
The user inputs the list construction sentence information of each data table through the client, the client sends the list construction sentence information to the server, the server analyzes the list construction sentence information, acquires the field information and the required type in each data table, modifies the format of the specific record content of the field information according to the corresponding required type, stores the modified format in the corresponding position in the database, and establishes newly added, deleted and modified related interfaces and interface access parameters according to the field information and the required type. After the user inputs the query SQL sentence, the client sends the sentence to the server, the server analyzes the query SQL sentence, extracts the input data and the output data in the query SQL sentence, generates the content to be displayed in the target page according to the input data, the output data and the corresponding field information and the requirement type, and for example, the content can comprise the input data, the output data of the user, the information content which the user wants to query, the function options for adding, deleting or modifying the information content and the like, generates the front end code and the back end code which can display the target page according to the content to be displayed in the target page, operates the front end code and the back end code, and debugs and checks the result.
For example, the user needs to design information of a student list page, which includes a student list and a class list, wherein one field in the student list is data associated with a class, and the construction sentence of the class list and the construction sentence of the student list are respectively as follows:
Student watch:
After receiving the student table and the class table input by the user, the server side can firstly analyze each field in the class table and the student table and the type of each field, and the main key in the student table is the ID, and meanwhile can confirm the type of the front and back end codes according to the database type, for example, if vue is used at the front end and go is used at the back end, the database field is, for example, the varchar type, the front end type of the field is String, and the back end type is String.
When the user needs to display the student information list page, a query SQL sentence can be input as follows:
After the server receives the query SQL statement, the query SQL statement is analyzed, so that corresponding input parameters are student NAME, student AGE and student creation time CREATED _AT, corresponding output parameters are student ID, class NAME, student GENDER, student AGE, student CREATED _BY, student CREATED _AT, student UPDATED _BY and student UPDATED _AT, types of all fields are acquired, and page information can be obtained. As above, for the newly added interface, other fields in the student table can be used as parameters of the newly added field, and for the update and deletion of the interface, the main key is generally used as an interface to enter the parameters, so that the code of adding, deleting and modifying the front end and the rear end is generated. After the front and back end codes are generated, the corresponding front and back end services are deployed, and the generated page effect can be seen.
The scheme has the advantages that the data tables input by the user can be classified and stored according to the preset format, so that the problem that the data storage is disordered due to the fact that the data tables and the data are crossed is avoided, and the use experience of the user is affected.
Example seven
Fig. 8 is a schematic structural diagram of an automatic page generating device based on a query SQL statement according to a seventh embodiment of the present application.
As shown in fig. 8, the method specifically includes the following steps:
a field information obtaining module 801, configured to obtain field information of at least one pre-constructed data table;
The parameter-out field obtaining module 802 is configured to receive an SQL statement input by a user, and obtain a parameter-out field in the SQL statement;
a parameter-out data determining module 803, configured to determine parameter-out data corresponding to the parameter-out field according to the data table;
A page generation code determining module 804, configured to determine a page generation code based on the parameter-out field and parameter-out data corresponding to the parameter-out field;
And the target page generating module 805 is configured to generate a target page to be displayed according to the page generating code.
The embodiment of the application discloses a method for generating a target page, which comprises the steps of obtaining field information of at least one pre-built data table, obtaining a parameter-outputting field, determining parameter-outputting data, determining a page generating code, and generating the target page according to the page generating code, wherein the parameter-outputting field is used for receiving an SQL statement input by a user and obtaining parameter-outputting fields in the SQL statement, the parameter-outputting data is used for determining parameter-outputting data corresponding to the parameter-outputting fields according to the data table, and the page generating code is used for determining the page generating code based on the parameter-outputting fields and the parameter-outputting data corresponding to the parameter-outputting fields. According to the device for automatically generating the page based on the query SQL statement, the display page can be generated based on the query statement of the data table, so that a user can quickly acquire the demand data in a large amount of data through the key field, the data consulting time is greatly saved, the layout of the display page can be automatically configured, and the development efficiency and the page quality of the page are improved.
The device for automatically generating the page based on the query SQL statement in the embodiment of the application can be a device, and can also be a component, an integrated circuit or a chip in a terminal. The device may be a mobile electronic device or a non-mobile electronic device. By way of example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), etc., and the non-mobile electronic device may be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a Television (TV), a teller machine, a self-service machine, etc., and the embodiments of the present application are not limited in particular.
The device for automatically generating the page based on the query SQL statement in the embodiment of the application can be a device with an operating system. The operating system may be an Android operating system, an ios operating system, or other possible operating systems, and the embodiment of the present application is not limited specifically.
The device for automatically generating the page based on the query SQL statement provided by the embodiment of the application can realize each process realized by each method embodiment, and is not repeated here for avoiding repetition.
Example eight
As shown in fig. 9, an embodiment of the present application further provides an electronic device 900, which includes a processor 901, a memory 902, and a program or an instruction stored in the memory 902 and capable of running on the processor 901, where the program or the instruction implements each process of the above embodiment of an apparatus for automatically generating a page based on a query SQL statement when executed by the processor 901, and the process can achieve the same technical effects, and is not repeated herein.
The electronic device in the embodiment of the application includes the mobile electronic device and the non-mobile electronic device.
Example nine
The embodiment of the application also provides a readable storage medium, wherein a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the program or the instruction realizes each process of the device embodiment based on the automatic page generation of the query SQL statement, and the same technical effect can be achieved, so that repetition is avoided, and the description is omitted here.
Wherein the processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium such as a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and the like.
Examples ten
The embodiment of the application further provides a chip, which comprises a processor and a communication interface, wherein the communication interface is coupled with the processor, and the processor is used for running a program or an instruction, so that each process of the device embodiment for automatically generating the page based on the query SQL statement can be realized, the same technical effect can be achieved, and the repetition is avoided, and the description is omitted here.
It should be understood that the chips referred to in the embodiments of the present application may also be referred to as system-on-chip chips, chip systems, or system-on-chip chips, etc.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element. Furthermore, it should be noted that the scope of the methods and apparatus in the embodiments of the present application is not limited to performing the functions in the order shown or discussed, but may also include performing the functions in a substantially simultaneous manner or in an opposite order depending on the functions involved, e.g., the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a computer software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present application.
The embodiments of the present application have been described above with reference to the accompanying drawings, but the present application is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those having ordinary skill in the art without departing from the spirit of the present application and the scope of the claims, which are to be protected by the present application.
The foregoing description is only of the preferred embodiments of the application and the technical principles employed. The present application is not limited to the specific embodiments described herein, but is capable of numerous modifications, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the application. Therefore, while the application has been described in connection with the above embodiments, the application is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit of the application, the scope of which is set forth in the following claims.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410945594.7A CN119045816A (en) | 2024-07-15 | 2024-07-15 | Automatic page generation method, device, equipment and medium based on query SQL statement |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410945594.7A CN119045816A (en) | 2024-07-15 | 2024-07-15 | Automatic page generation method, device, equipment and medium based on query SQL statement |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN119045816A true CN119045816A (en) | 2024-11-29 |
Family
ID=93567748
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202410945594.7A Pending CN119045816A (en) | 2024-07-15 | 2024-07-15 | Automatic page generation method, device, equipment and medium based on query SQL statement |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN119045816A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN120296066A (en) * | 2025-06-12 | 2025-07-11 | 山东浪潮智慧医疗科技有限公司 | A method, system, device and medium for displaying health record data on a page |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105487864A (en) * | 2015-11-26 | 2016-04-13 | 北京京东尚科信息技术有限公司 | Method and device for automatically generating code |
| CN113434133A (en) * | 2021-08-27 | 2021-09-24 | 深圳市信润富联数字科技有限公司 | Application building method, device, equipment and computer readable storage medium |
| CN113656439A (en) * | 2021-08-19 | 2021-11-16 | 北京搜房科技发展有限公司 | Data query method and device, storage medium and electronic equipment |
| CN114741079A (en) * | 2022-04-14 | 2022-07-12 | 上海携宁计算机科技股份有限公司 | Software development method, platform, electronic device, and computer-readable storage medium |
| CN118210488A (en) * | 2024-04-11 | 2024-06-18 | 西藏众陶联供应链服务有限公司 | Method, system and terminal equipment for generating codes and interface documents based on sql |
-
2024
- 2024-07-15 CN CN202410945594.7A patent/CN119045816A/en active Pending
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105487864A (en) * | 2015-11-26 | 2016-04-13 | 北京京东尚科信息技术有限公司 | Method and device for automatically generating code |
| CN113656439A (en) * | 2021-08-19 | 2021-11-16 | 北京搜房科技发展有限公司 | Data query method and device, storage medium and electronic equipment |
| CN113434133A (en) * | 2021-08-27 | 2021-09-24 | 深圳市信润富联数字科技有限公司 | Application building method, device, equipment and computer readable storage medium |
| CN114741079A (en) * | 2022-04-14 | 2022-07-12 | 上海携宁计算机科技股份有限公司 | Software development method, platform, electronic device, and computer-readable storage medium |
| CN118210488A (en) * | 2024-04-11 | 2024-06-18 | 西藏众陶联供应链服务有限公司 | Method, system and terminal equipment for generating codes and interface documents based on sql |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN120296066A (en) * | 2025-06-12 | 2025-07-11 | 山东浪潮智慧医疗科技有限公司 | A method, system, device and medium for displaying health record data on a page |
| CN120296066B (en) * | 2025-06-12 | 2025-09-12 | 山东浪潮智慧医疗科技有限公司 | Page display method, system, equipment and medium for health archive data |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US8601438B2 (en) | Data transformation based on a technical design document | |
| CN106133766B (en) | System and method for calculating, applying and displaying document deltas | |
| US11106906B2 (en) | Systems and methods for information extraction from text documents with spatial context | |
| US9047346B2 (en) | Reporting language filtering and mapping to dimensional concepts | |
| US20180060420A1 (en) | Method and apparatus for natural language query in a workspace analytics system | |
| CN110738037A (en) | Method, apparatus, device and storage medium for automatically generating electronic form | |
| CN110780970B (en) | Data screening method, device, equipment and computer readable storage medium | |
| CN108171600A (en) | Reference report analytic method, server and storage medium | |
| US10572566B2 (en) | Image quality independent searching of screenshots of web content | |
| US20150199346A1 (en) | Hierarchical database report generation with automated query generation for placeholders | |
| CN113407678A (en) | Knowledge graph construction method, device and equipment | |
| KR101950126B1 (en) | Mathematical formula processing method, device, apparatus and computer storage medium | |
| KR20170073693A (en) | Extracting similar group elements | |
| CN114201615B (en) | Scientific research data change review method and server based on data snapshot | |
| US8615733B2 (en) | Building a component to display documents relevant to the content of a website | |
| CN118502857A (en) | Interactive processing method, device, equipment, medium and program product of user interface | |
| CN119045816A (en) | Automatic page generation method, device, equipment and medium based on query SQL statement | |
| CN110929100B (en) | Method and device for acquiring value taking path, storage medium and electronic equipment | |
| CN117389538A (en) | Page component content development method, device, equipment and storage medium | |
| US20240037325A1 (en) | Ability to add non-direct ancestor columns in child spreadsheets | |
| CN118410077B (en) | Data mining method, system, medium and equipment | |
| JP2019101889A (en) | Test execution device and program | |
| CN116483344A (en) | Code generation method and device, terminal equipment and computer readable storage medium | |
| CN113792557A (en) | Language file generation method and device | |
| CN112861060A (en) | Page creating method and device, computer equipment and storage medium |
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 |