CN112241412A - Tree structure table generation method and device and electronic equipment - Google Patents

Tree structure table generation method and device and electronic equipment Download PDF

Info

Publication number
CN112241412A
CN112241412A CN202011175520.8A CN202011175520A CN112241412A CN 112241412 A CN112241412 A CN 112241412A CN 202011175520 A CN202011175520 A CN 202011175520A CN 112241412 A CN112241412 A CN 112241412A
Authority
CN
China
Prior art keywords
tree structure
initial
structure table
file
sql file
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.)
Granted
Application number
CN202011175520.8A
Other languages
Chinese (zh)
Other versions
CN112241412B (en
Inventor
张淑强
李文泽
张鑫
宋晨
李大勤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Zhongxin Zhiguan Information Technology Co ltd
Original Assignee
Tianjin Zhongxin Zhiguan Information Technology Co ltd
Tianjin Meiteng Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Tianjin Zhongxin Zhiguan Information Technology Co ltd, Tianjin Meiteng Technology Co Ltd filed Critical Tianjin Zhongxin Zhiguan Information Technology Co ltd
Priority to CN202011175520.8A priority Critical patent/CN112241412B/en
Publication of CN112241412A publication Critical patent/CN112241412A/en
Application granted granted Critical
Publication of CN112241412B publication Critical patent/CN112241412B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24553Query execution of query operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/283Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method and a device for generating a tree structure table and electronic equipment, wherein an initial tree structure table is generated based on a received initial sql file; configuring an initial tree structure table based on the received configuration sql file to obtain a tree structure table; wherein configuring the sql file comprises: modifying, adding or deleting node information of one or more nodes in the initial tree structure table; the tree structure table includes a plurality of levels of nodes, each node including one or more child nodes. In the method, the initial sql file and the configured sql file can be directly processed through the database management system to obtain the tree structure table, the operation is simple, the time cost is low, and meanwhile, the method can flexibly modify the data structure of the tree structure table according to different application scenes.

Description

Tree structure table generation method and device and electronic equipment
Technical Field
The invention relates to the technical field of computers, in particular to a tree structure table generating method and device and electronic equipment.
Background
The existing generation tool of the dynamic data structure can only generate a simple single-table data structure so as to meet simple business logic; for enterprise structures, equipment structures and the like, managing complex scenes, generally associating single-table data structures and generating a tree-type structure table; when the tree structure table is generated, developers need to modify the sql codes manually, operation is complex, modification errors and omissions are easy to occur, and time cost is high; in addition, the tree structure table generated in this way is inflexible in data structure, and cannot be modified for different application scenarios.
Disclosure of Invention
In view of this, the present invention provides a method and an apparatus for generating a tree structure table, and an electronic device, where a database is directly processed, the operation is simple, the time cost is low, and meanwhile, the data structure of the tree structure table can be flexibly modified for different application scenarios.
In a first aspect, an embodiment of the present invention provides a method for generating a tree structure table, where the method is applied to a database management system, and the method includes: receiving an initial sql file; generating an initial tree structure table based on the initial sql file; receiving a configuration sql file aiming at an initial tree structure table; configuring the sql file comprises: modifying, adding or deleting node information of one or more nodes in the initial tree structure table; configuring an initial tree structure table based on the configuration sql file to obtain a tree structure table; wherein the tree structure table comprises a plurality of levels of nodes, each node comprising one or more child nodes.
Further, the database management system is in communication connection with the server; the server is in communication connection with the client; the step of receiving an initial sql file comprises: and receiving the initial sql file sent by the server through the database interface program.
Further, the initial sql file is generated by: the client responds to a generation instruction aiming at the initial tree structure table, and generates a first json file based on the table structure information and the data structure information of the initial tree structure table; and the client responds to a saving instruction aiming at the initial tree structure table, and sends the first json file to the server so that the server converts the first json file into an initial sql file.
Further, the database management system is in communication connection with the server; the server is in communication connection with the client; the step of receiving a configuration sql file for the initial tree structure table comprises: and receiving the configuration sql file sent by the server through a database interface program.
Further, the configuration sql file is generated by the following method: processing the initial tree structure table into a second json file after receiving a query instruction of the initial tree structure table; sending the second json file to the client so that the client responds to modification operation aiming at the second json file and generates a configuration json file; sending the configuration json file to a server so that the server converts the second json file into a configuration sql file; wherein the modifying operation comprises: modifying, adding or deleting the information of the corresponding table structure and/or data structure in the second json file; the client is further used for dynamically rendering the page provided by the client according to the second json file and displaying the initial tree structure table on the page.
Further, the tree structure table comprises a plurality of types of nodes; wherein, the nodes or sub-nodes with the same type are corresponding to the same dictionary table; the nodes and the child nodes are used for storing the basic data of the corresponding types.
Further, the step of generating an initial tree structure table based on the initial sql file includes: executing the initial sql file in a transaction operation mode to generate an initial tree structure table; configuring an initial tree structure table based on the configuration sql file to obtain a tree structure table, wherein the step comprises the following steps: executing the configuration sql file in a transaction operation mode; and changing the table structure and/or the data structure of the initial tree structure table to obtain the tree structure table.
In a second aspect, an embodiment of the present invention provides a device for generating a tree structure table, where the device is disposed in a database management system, and the device includes: the system comprises an initial tree structure table generating module, a query module and a query module, wherein the initial tree structure table generating module is used for receiving an initial sql file; generating an initial tree structure table based on the initial sql file; a configuration sql file receiving module, configured to receive a configuration sql file for the initial tree structure table; configuring the sql file comprises: modifying, adding or deleting node information of one or more nodes in the initial tree structure table; the initial tree structure table configuration module is used for configuring the initial tree structure table based on the configuration sql file to obtain a tree structure table; wherein the tree structure table comprises a plurality of levels of nodes, each node comprising one or more child nodes.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, where the memory stores machine executable instructions capable of being executed by the processor, and the processor executes the machine executable instructions to implement the method for generating the tree structure table according to any one of the first aspect.
In a fourth aspect, embodiments of the present invention provide a machine-readable storage medium storing machine-executable instructions that, when invoked and executed by a processor, cause the processor to implement a method of generating a tree structure table according to any one of the first aspect.
The embodiment of the invention has the following beneficial effects:
the embodiment of the invention provides a method and a device for generating a tree structure table and electronic equipment, wherein the method comprises the steps of generating an initial tree structure table based on a received initial sql file; configuring an initial tree structure table based on the received configuration sql file to obtain a tree structure table; wherein configuring the sql file comprises: modifying, adding or deleting node information of one or more nodes in the initial tree structure table; the tree structure table includes a plurality of levels of nodes, each node including one or more child nodes. In the method, the initial sql file and the configured sql file can be directly processed through the database management system to obtain the tree structure table, the operation is simple, the time cost is low, and meanwhile, the method can flexibly modify the data structure of the tree structure table according to different application scenes.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a flowchart of a method for generating a tree structure table according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a tree structure table according to an embodiment of the present invention;
FIG. 3 is a flowchart of another tree structure table generating method according to an embodiment of the present invention;
FIG. 4 is a timing diagram illustrating a method for generating a tree structure table according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a device for generating a tree structure table according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The existing generation tool of the dynamic data structure can only generate a simple single-table data structure so as to meet simple business logic; for enterprise structures, equipment structures and the like, managing complex scenes, generally associating single-table data structures and generating a tree-type structure table; when the tree structure table is generated, developers need to modify the sql codes manually, operation is complex, modification errors and omissions are easy to occur, and time cost is high; in addition, the tree structure table generated by the method is inflexible in data structure and single in parameter, cannot increase the relationship among data structures in a finer granularity, and cannot be modified according to different application scenes.
In the prior art, when data is generated, a B/S (Browser/Server, Browser and Server) framework cannot check the direct table structure relationship of a database before generation, cannot reflect the relationship between table structures, cannot specify a field to increase an index after generation, and cannot prompt specific implementers to know the reason after generation fails. In addition, in the prior art, the relation between table structures is not checked during data query, only single-table query is performed, and the tree structure cascade relation is not provided, only addition, deletion, modification and check of single tables are performed, so that the existing enterprise-level huge tree structure cascade relation cannot be met. Based on this, the method and apparatus for generating a data structure table and the electronic device provided by the embodiments of the present invention may be applied to devices such as a mobile phone, a computer, a notebook, a server, and a database management system.
To facilitate understanding of the embodiment, first, a detailed description is given to a method for generating a tree structure table disclosed in the embodiment of the present invention, where the method is applied to a database management system, and the database management system is provided with a plurality of databases supporting mysql, oracle, sql server, and the like.
As shown in fig. 1, the method comprises the steps of:
step S102, receiving an initial sql file; generating an initial tree structure table based on the initial sql file;
the initial sql file comprises codes of sql language, and the initial sql file comprises data structure information and table structure information of an initial tree structure table; the data structure comprises categories such as arrays and queues, and the table structure comprises a table name, fields in the table and a record part of the table; the database may execute the initial sql file, generate a result, i.e., an initial tree structure table, displayed by the user at the front end from the information of the initial tree structure table included in the initial sql file, and store the initial tree structure table in the database.
For example, the received initial sql file may be, CREATE TABLE 'test 1 ″ (r) ((r)')
`id`varchar(10)NOT NULL DEFAULT‘1’,
`name`varchar(10)CHARACTER SET utf8,
PRIMARY KEY(`id`)USING BTREE,
) (ii) a The method comprises the information of a table name, a main key field, a coding set, a column name, a type of a column value, a field length, a decimal point number, a default value and the like of an initial tree structure table.
In addition, the initial tree structure table may include one or more nodes, each node may have one or more child nodes, and each child node may correspond to a different dictionary table. If the types of each node are inconsistent, different dictionary tables can be used for storing the basic data of each node, the method is suitable for tree structures with multiple dimensions, the data structure of each tree structure can be configured in a page, the effect and the result of specified use are achieved, and various abnormal conditions can be dealt with.
Step S104, receiving a configuration sql file aiming at the initial tree structure table; the configuration sql file comprises: modifying, adding or deleting node information of one or more nodes in the initial tree structure table;
the generated initial tree structure table has the functions of node configuration and modification, so that the generated initial tree structure table can be configured according to an actual application scene and business logic so as to change the data structure and the table structure of the initial tree structure table and modify, add or delete the node information of one or more nodes in the initial tree structure table; for example, the table name, the field name of the node, adding the node, deleting the node, changing the relationship between the data structures, and changing the relationship between the nodes, etc.
Step S106, configuring an initial tree structure table based on the configuration sql file to obtain a tree structure table; wherein the tree structure table comprises a plurality of levels of nodes, each node comprising one or more child nodes.
Specifically, the received configuration sql file is processed through a database persistent layer, the configuration sql file is executed, information needing to be changed in the initial tree structure table is changed, the changing process completely depends on the corresponding database, and finally the tree structure table is generated. The process is operated by a database, and is faster and safer than sequencing in a code structure; data cannot be lost due to the limitation of the main foreign key, and dirty data cannot be stored.
Fig. 2 is a schematic structural diagram of a tree structure table, which includes multiple levels of nodes, where node1 is a primary node, the node has a child node (node2), and node2 is a secondary node; the node2 has two child nodes (node3, node4), and node3 and node4 are tertiary nodes, wherein the right two child nodes (node5, node6) of node4, node5 and node6 are quaternary nodes.
Wherein the tree structure table further comprises a plurality of types of nodes; nodes or child nodes with the same type correspond to the same dictionary table; the nodes and the child nodes are used for storing the basic data of the corresponding types. The tree structure is suitable for multiple dimensions, the data structure of each tree structure can be guaranteed to be configured in the page, the effect and the result of specified use are achieved, and multiple abnormal conditions are responded.
The embodiment of the invention provides a method for generating a tree structure table, which is characterized in that an initial tree structure table is generated based on a received initial sql file; configuring an initial tree structure table based on the received configuration sql file to obtain a tree structure table; wherein configuring the sql file comprises: modifying, adding or deleting node information of one or more nodes in the initial tree structure table; the tree structure table includes a plurality of levels of nodes, each node including one or more child nodes. In the method, the initial sql file and the configured sql file can be directly processed through the database management system to obtain the tree structure table, the operation is simple, the time cost is low, and meanwhile, the method can flexibly modify the data structure of the tree structure table according to different application scenes.
The implementation also provides another generation method of the tree structure table, wherein the database management system is in communication connection with a server, and the server is in communication connection with a client; as shown in fig. 3, the method comprises the steps of:
step S302, receiving an initial sql file sent by a server through a database interface program;
the Database interface program may be a JDBC (Java Database Connectivity) interface program, if the language used by the Database is Java, the Database interface program may be an odbc (open Database Connectivity) interface program, if the language used by the Database is C + +, the Database interface program may be a Connector C + + interface program, and if the language adapted by the Database is phthon, the Database interface program may be a mysql-Connector interface program. The database management system is in communication connection with the server and can send or receive the sql file through a database interface program.
Wherein the initial sql file is generated by:
(1) the client responds to a generation instruction aiming at the initial tree structure table, and generates a first json file based on the table structure information and the data structure information of the initial tree structure table;
referring to the sequence diagram of the generation method of the tree structure table shown in fig. 4, the client (web) may be an operation page of a browser, an application program, or the like; specifically, the data structure and the table structure can be customized and designed by an operation page provided by a developer, a product person or a common user (user) for operating the terminal equipment, and the basic structure comprises a table name, a remark and the like; the design of the data table structure defines the file name of the data table, determines which fields are contained in the data table, the field name, the field type and the width of each field, and inputs the data into an operation page of the computer. After the design is finished, a generation button of an operation page can be clicked; the client responds to a generation instruction aiming at the initial tree structure table, and the operation page can preview and display or edit and display the initial tree structure table; and simultaneously generating a first json file based on the table structure information and the data structure information of the initial tree structure table.
For example, the first json file may be:
Figure BDA0002747123750000081
Figure BDA0002747123750000091
the tableList is a collection of the batch saving tables, wherein tableName is a table name, primaryKey is a primary key field, a coding collection of a charSet table, columns are a column collection, name is a column name, valueType, a type of a value of a column, a length column field length, decimalPoint decimal point number of bits, and a default value of default.
(2) And the client responds to a saving instruction aiming at the initial tree structure table, and sends the first json file to the server so that the server converts the first json file into an initial sql file.
After the user clicks the save button of the operation page, referring to fig. 4, the client sends the first json file to the server (server), so that the server converts the first json file into an initial sql file. Meanwhile, the server is connected with a specified database (db, data base) in the database management system, and sends the initial sql file to the specified database.
Step S304, executing the initial sql file in a transaction operation mode to generate an initial tree structure table;
after receiving the initial sql file, a designated database in the database management system usually sorts the initial sql file, and then directly performs database operation, wherein the database operation comprises transaction operation, if the operation is successful, the transaction is submitted, the initial sql file is executed, an initial tree structure table is generated, and the initial tree structure table is stored; if the operation is unsuccessful, the transaction rolls back the value server.
In addition, after the initial tree structure table is generated, the method further includes: based on the client side automatic response query operation, the designated database in the database management system corresponding to the initial tree structure sends the initial tree structure table to the client side for displaying.
Step S306, receiving a configuration sql file sent by a server through a database interface program; the configuration sql file comprises: modifying, adding or deleting node information of one or more nodes in the initial tree structure table;
the configuration sql file is generated by the following method:
(1) processing the initial tree structure table into a second json file after receiving a query instruction of the initial tree structure table;
the query instruction may be an instruction automatically triggered by the client, and is usually triggered after the initial tree structure table is generated; or it may be a user triggered query instruction at the discretion, typically at the time of re-querying the previously generated initial tree structure table. And after receiving a query instruction of the initial tree structure table, processing the initial tree structure table into a second json file.
(2) Sending the second json file to the client so that the client responds to modification operation aiming at the second json file and generates a configuration json file; sending the configuration json file to a server so that the server converts the second json file into a configuration sql file; wherein the modifying operation comprises: and modifying, adding or deleting the information of the corresponding table structure and/or data structure in the second json file.
Referring to fig. 4, a process of sending the second json file to the client is that the database sends the second json file (result) to the server first, and the server receives the second json file (result) and then corresponds to the second json file, and sends the second json file to the client.
Specifically, after receiving the second json file, the client may modify the data in the second json file, for example, the table name modification may be performed to modify 'tableName' to the table name desired by the user; also for example, the connections of a table structure may be modified, the foreign key of a given table may be modified, and the table may be associated with another table. And finally determining the modified second json file as a configuration json file. The client sends the configuration json file to the server so that the server converts the second json file into a configuration sql file.
In addition, after the second json file is sent to the client, the client is further used for dynamically rendering the page provided by the client according to the second json file and displaying the initial tree structure table on the page; in the mode, the client, the server and the database management system establish real-time connection, can place high concurrency, and can bidirectionally synchronize a data structure and a table structure to show the latest data structure for a user in real time.
Step S308, the configuration sql file is executed in a transaction operation mode; and changing the table structure and/or the data structure of the initial tree structure table to obtain the tree structure table.
After receiving the initial sql file, a designated database in the database management system usually sorts the configured sql file, then directly performs database operation, wherein the database operation comprises transaction operation, if the operation is successful, the transaction is submitted, the configured sql file is executed, the table structure and the data structure of the initial tree structure table are changed, and the tree structure table is obtained and stored; if the operation is unsuccessful, the transaction rolls back the value server. Or executing the configuration sql file, changing the table structure or the data structure of the initial tree structure table to obtain the tree structure table, storing the tree structure table, and sending the tree structure table to the client for displaying back so that the client displays the latest tree structure table in real time.
In the mode, through a simple user-defined data structure and a table structure of a user, the front-end client can automatically generate a corresponding json file, simultaneously the json file is sent to the server, the json file is converted into a language which can be executed by the database through the server, namely, an sql file, and the sql file is sent to the database to be operated so as to generate an initial tree structure table or configure the initial tree structure table. The mode of directly utilizing the database for operation is higher in sorting speed and safer than that of a code structure, and data cannot be lost. Meanwhile, different nodes in the generated tree structure table can have different data structures, and the types of each node can be completely different; in addition, the client, the server and the database are connected in real time, high concurrency can be prevented, the data structure and the table structure are synchronized in a two-way mode, and the latest data structure can be displayed for a user in real time.
Corresponding to the above method embodiment, this embodiment provides a device for generating a tree structure table, where the device is disposed in a database management system, and as shown in fig. 5, the device includes:
an initial sql file receiving module 51, configured to receive an initial sql file;
an initial tree structure table generating module 52, configured to generate an initial tree structure table based on the initial sql file;
a configuration sql file receiving module 53, configured to receive a configuration sql file for the initial tree structure table; configuring the sql file comprises: modifying, adding or deleting node information of one or more nodes in the initial tree structure table;
an initial tree structure table configuration module 54, configured to configure an initial tree structure table based on the configuration sql file to obtain a tree structure table; wherein the tree structure table comprises a plurality of levels of nodes, each node comprising one or more child nodes.
The embodiment of the invention provides a generating device of a tree structure table, which is used for generating an initial tree structure table based on a received initial sql file; configuring an initial tree structure table based on the received configuration sql file to obtain a tree structure table; wherein configuring the sql file comprises: modifying, adding or deleting node information of one or more nodes in the initial tree structure table; the tree structure table includes a plurality of levels of nodes, each node including one or more child nodes. In the method, the initial sql file and the configured sql file can be directly processed through the database management system to obtain the tree structure table, the operation is simple, the time cost is low, and meanwhile, the method can flexibly modify the data structure of the tree structure table according to different application scenes.
Further, the database management system is in communication connection with the server; the server is in communication connection with the client; the initial sql file receiving module is further configured to: and receiving the initial sql file sent by the server through the database interface program.
Further, the initial sql file is generated by the following method: the client responds to a generation instruction aiming at the initial tree structure table, and generates a first json file based on the table structure information and the data structure information of the initial tree structure table; and the client responds to a saving instruction aiming at the initial tree structure table, and sends the first json file to the server so that the server converts the first json file into an initial sql file.
Further, the database management system is in communication connection with the server; the server is in communication connection with the client; and the initial tree structure table receiving module is used for receiving the configuration sql file sent by the server through the database interface program.
Further, the above configuration sql file is generated by the following method: processing the initial tree structure table into a second json file after receiving a query instruction of the initial tree structure table; sending the second json file to the client so that the client responds to modification operation aiming at the second json file and generates a configuration json file; sending the configuration json file to a server so that the server converts the second json file into a configuration sql file; wherein the modifying operation comprises: and modifying, adding or deleting the information of the corresponding table structure and/or data structure in the second json file.
Further, the tree structure table includes a plurality of types of nodes; wherein, the nodes or sub-nodes with the same type are corresponding to the same dictionary table; the nodes and the child nodes are used for storing the basic data of the corresponding types.
Further, the initial tree structure table generating module is further configured to: executing the initial sql file in a transaction operation mode to generate an initial tree structure table; the initial tree structure table configuration module is further to: executing the configuration sql file in a transaction operation mode; and changing the table structure and/or the data structure of the initial tree structure table to obtain the tree structure table.
The tree structure table generation device provided by the embodiment of the present invention has the same technical features as the tree structure table generation method provided by the above embodiment, so that the same technical problems can be solved, and the same technical effects can be achieved.
The embodiment also provides an electronic device, which comprises a processor and a memory, wherein the memory stores machine executable instructions capable of being executed by the processor, and the processor executes the machine executable instructions to realize the generation method of the tree structure table.
Referring to fig. 6, the electronic device includes a processor 100 and a memory 101, where the memory 101 stores machine executable instructions capable of being executed by the processor 100, and the processor 100 executes the machine executable instructions to implement the tree structure table generating method.
Further, the electronic device shown in fig. 6 further includes a bus 102 and a communication interface 103, and the processor 100, the communication interface 103, and the memory 101 are connected through the bus 102.
The Memory 101 may include a high-speed Random Access Memory (RAM) and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used. The bus 102 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 6, but that does not indicate only one bus or one type of bus.
Processor 100 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 100. The Processor 100 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method of the foregoing embodiment in combination with the hardware thereof.
The present embodiments also provide a machine-readable storage medium storing machine-executable instructions that, when invoked and executed by a processor, cause the processor to implement the tree structure table generation method described above.
The method and apparatus for generating a tree structure table and the computer program product of the electronic device provided in the embodiments of the present invention include a computer-readable storage medium storing a program code, where instructions included in the program code may be used to execute the method described in the foregoing method embodiments, and specific implementation may refer to the method embodiments, and will not be described herein again.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In addition, in the description of the embodiments of the present invention, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meaning of the above terms in the present invention can be understood in specific cases for those skilled in the art.
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 computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that the following embodiments are merely illustrative of the present invention, and not restrictive, and the scope of the present invention is not limited thereto: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method for generating tree-structured table, the method being applied to a database management system, the method comprising:
receiving an initial sql file; generating an initial tree structure table based on the initial sql file;
receiving a configuration sql file for the initial tree structure table; the configuration sql file comprises: modifying, adding or deleting node information of one or more nodes in the initial tree structure table;
configuring the initial tree structure table based on the configuration sql file to obtain the tree structure table; wherein the tree structure table comprises a plurality of levels of nodes, each of the nodes comprising one or more child nodes.
2. The method of claim 1, wherein the database management system is communicatively coupled to a server; the server is in communication connection with the client;
the step of receiving an initial sql file comprises:
and receiving the initial sql file sent by the server through a database interface program.
3. The method of claim 2, wherein the initial sql file is generated by:
the client responds to a generation instruction aiming at the initial tree structure table, and generates a first json file based on the table structure information and the data structure information of the initial tree structure table;
and the client responds to a saving instruction aiming at the initial tree structure table, and sends the first json file to the server so as to enable the server to convert the first json file into the initial sql file.
4. The method of claim 1, wherein the database management system is communicatively coupled to a server; the server is in communication connection with the client;
a step of receiving a configuration sql file for the initial tree structure table, comprising:
and receiving the configuration sql file sent by the server through a database interface program.
5. The method of claim 4, wherein the configuration sql file is generated by:
processing the initial tree structure table into a second json file after receiving a query instruction of the initial tree structure table;
sending the second json file to a client so that the client responds to modification operation aiming at the second json file and generates a configuration json file; sending the configuration json file to the server so that the server converts the second json file into a configuration sql file; wherein the modifying operation comprises: modifying, adding or deleting information of a corresponding table structure and/or data structure in the second json file;
and the client is also used for dynamically rendering the page provided by the client according to the second json file and displaying the initial tree structure table on the page.
6. The method of claim 1, wherein the tree structure table includes a plurality of types of the nodes; wherein the nodes or child nodes having the same type have the same dictionary table; the nodes and the child nodes are used for storing basic data of corresponding types.
7. The method of claim 1, wherein the step of generating an initial tree structure table based on the initial sql file comprises: executing the initial sql file in a transaction operation mode to generate the initial tree structure table;
the step of configuring the initial tree structure table based on the configuration sql file to obtain the tree structure table includes: executing the configuration sql file in a transaction operation mode; and changing the table structure and/or the data structure of the initial tree structure table to obtain the tree structure table.
8. An apparatus for generating a tree-structured table, the apparatus being provided in a database management system, the apparatus comprising:
the system comprises an initial tree structure table generating module, a query module and a query module, wherein the initial tree structure table generating module is used for receiving an initial sql file; generating an initial tree structure table based on the initial sql file;
a configuration sql file receiving module, configured to receive a configuration sql file for the initial tree structure table; the configuration sql file comprises: modifying, adding or deleting node information of one or more nodes in the initial tree structure table;
an initial tree structure table configuration module, configured to configure the initial tree structure table based on the configuration sql file to obtain the tree structure table; wherein the tree structure table comprises a plurality of levels of nodes, each of the nodes comprising one or more child nodes.
9. An electronic device comprising a processor and a memory, the memory storing machine executable instructions executable by the processor, the processor executing the machine executable instructions to implement the tree structure table generation method of any one of claims 1-7.
10. A machine-readable storage medium having stored thereon machine-executable instructions which, when invoked and executed by a processor, cause the processor to implement the tree structure table generation method of any of claims 1-7.
CN202011175520.8A 2020-10-28 2020-10-28 Tree structure table generation method and device and electronic equipment Active CN112241412B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011175520.8A CN112241412B (en) 2020-10-28 2020-10-28 Tree structure table generation method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011175520.8A CN112241412B (en) 2020-10-28 2020-10-28 Tree structure table generation method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN112241412A true CN112241412A (en) 2021-01-19
CN112241412B CN112241412B (en) 2023-10-13

Family

ID=74170210

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011175520.8A Active CN112241412B (en) 2020-10-28 2020-10-28 Tree structure table generation method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112241412B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116403684A (en) * 2023-06-08 2023-07-07 杭州医策科技有限公司 Digital pathological image loading method and device

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109684336A (en) * 2018-12-27 2019-04-26 普元信息技术股份有限公司 The system and method for tree data table efficient retrieval and ranking function is realized based on big data application

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109684336A (en) * 2018-12-27 2019-04-26 普元信息技术股份有限公司 The system and method for tree data table efficient retrieval and ranking function is realized based on big data application

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
源码大爆炸: "[MySQL]基于左右值编码的树形数据库表结构设计", 《微信公众号》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116403684A (en) * 2023-06-08 2023-07-07 杭州医策科技有限公司 Digital pathological image loading method and device
CN116403684B (en) * 2023-06-08 2023-08-11 杭州医策科技有限公司 Digital pathological image loading method and device

Also Published As

Publication number Publication date
CN112241412B (en) 2023-10-13

Similar Documents

Publication Publication Date Title
US10776220B2 (en) Systems and methods for monitoring distributed database deployments
CN113986933A (en) Materialized view creating method and device, storage medium and electronic equipment
CN107133233B (en) Processing method and device for configuration data query
US11144562B1 (en) Method and apparatus of indicator information determination
CN111064725A (en) Code zero intrusion interface verification method and device
US11442930B2 (en) Method, apparatus, device and storage medium for data aggregation
CN112463549A (en) Auditing method, device and equipment of cloud platform and computer readable storage medium
CN116611411A (en) Business system report generation method, device, equipment and storage medium
CN116644223A (en) Data query method, device, equipment and readable medium
CN112667733A (en) Data warehouse data importing method and system
CN115145587A (en) Product parameter checking method and device, electronic equipment and storage medium
CN110750539A (en) Redis database-based information query method and device and electronic equipment
CN112241412A (en) Tree structure table generation method and device and electronic equipment
CN114168847A (en) Data query method and device, electronic equipment and storage medium
CN112434056A (en) Method and device for inquiring detailed data
CN112235358A (en) Data acquisition method and device, electronic equipment and computer readable storage medium
CN108415994B (en) Network management system report generation method, device and equipment
CN107273293B (en) Big data system performance test method and device and electronic equipment
CN112835934B (en) Query information acquisition method and device, electronic equipment and storage medium
CN113379551A (en) Transaction data analysis method and device and electronic equipment
US7155503B2 (en) Data server
CN112597186A (en) Data query method, computer equipment and storage medium
CN117742900B (en) Method, device, equipment and storage medium for constructing service call graph
CN112540754B (en) Component multiplexing method and device based on B/S architecture, electronic equipment and storage medium
CN118152587A (en) Business behavior map construction method and device, electronic 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
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20231121

Address after: 300467 Binhai Tianjin Binhai Zhongxin Ecological City West of Zhongcheng Avenue, South of Zhongbin Avenue Ecological Construction Apartment Building 8, Room 137, Floor 1

Patentee after: TIANJIN ZHONGXIN ZHIGUAN INFORMATION TECHNOLOGY CO.,LTD.

Address before: Room 137, 1st floor, building 8, ecological construction apartment, west of Zhongcheng Avenue and south of Zhongbin Avenue, Tianjin Zhongxin ecological city, Binhai New Area, Tianjin 300450

Patentee before: TIANJIN ZHONGXIN ZHIGUAN INFORMATION TECHNOLOGY CO.,LTD.

Patentee before: Tianjin Meiteng Technology Co.,Ltd.