CN102902811B - A kind of database design method quickly generating tree construction - Google Patents
A kind of database design method quickly generating tree construction Download PDFInfo
- Publication number
- CN102902811B CN102902811B CN201210401403.8A CN201210401403A CN102902811B CN 102902811 B CN102902811 B CN 102902811B CN 201210401403 A CN201210401403 A CN 201210401403A CN 102902811 B CN102902811 B CN 102902811B
- Authority
- CN
- China
- Prior art keywords
- sort
- node
- tree structure
- information
- tree
- 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.)
- Active
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a kind of database design method quickly generating tree construction, described method comprises the steps: step one, creates tree structure information table and Sort table in the data base with tree-shaped relation data, and described tree structure information table is for recording the nodal information in tree construction;Described Sort table is associated with described tree structure information table, and the relation between the node recording tree construction, each node has a Sort ID value;Step 2, time the nodal information in described tree structure information table is modified, amendment information is saved in described tree structure information table, and amendment information is associated in Sort table, described Sort table of then resequencing, so that amended tree structure relation record is in described Sort table;Step 3, by Sort table Field ID value sort read data, query tree structure information.The method of the invention improves operational efficiency, saves server resource.
Description
Technical field
The present invention relates to field of computer technology, in particular, the data base related in application system sets
Meter field.
Background technology
At present, in traditional application system, the design in tree structure data storehouse is all child node record father joint
The ID of point, uses the mode of recurrence to produce tree structure during webpage representation, this method for designing makes big data
Amount has a strong impact on system effectiveness when representing, it is possible to cause whole application system to be in torpor.
Summary of the invention
It is an object of the invention to provide a kind of database design method quickly generating tree construction, described method
The mode of directly sequence is used to directly generate in all of application system during spanning tree structured data.
In order to solve the difficulty that prior art exists, reach above-mentioned purpose, the invention provides a kind of quick
The database design method of spanning tree structure, described method comprises the steps:
Step one, in the data base with tree-shaped relation data create bivariate table, including:
Tree structure information table, for recording the nodal information in tree construction;
Sort table, is associated with described tree structure information table, between the node recording tree construction
Relation, each node has a Sort ID value;
Step 2, time the nodal information in described tree structure information table is modified, amendment information is protected
It is stored in described tree structure information table, and amendment information is associated in Sort table, then same
Affairs are resequenced described Sort table, so that amended tree structure relation record is in described Sort table;
Step 3, by Sort table Field ID value sort read data, query tree structure information.
Preferably, described nodal information include node ID, nodename, his father's node ID and its
The description of his attribute value information.
Preferably, described Sort table includes Sort ID, node ID and father node ID thereof, sequence class
Belonging to type, node, hierarchy node is at the particular location of affiliated level.
Preferably, the amendment of the nodal information described in step 2 includes increasing and deleting child node.
The invention has the beneficial effects as follows: the database design method quickly generating tree construction of the present invention,
Make not use during spanning tree structured data in all of application system recursive fashion, and use directly row
The mode of sequence directly generates, and improves operational efficiency, saves server resource;Unique data base's knot
Structure designs, and the resource taken during spanning tree carries out reasonable distribution, part resource is taken transfer to increase newly,
During deletion of node, improve spanning tree structure efficiency;The method of the invention enormously simplify spanning tree knot
The process of structure, with simple Sql query statement sorting query.
Accompanying drawing explanation
Fig. 1 is the schematic flow sheet of the method for the invention
Fig. 2 is the bivariate table created in the embodiment of the present invention
Detailed description of the invention
The present invention will be further described below in conjunction with the accompanying drawings, so that those of ordinary skill in the art are with reference to this
Can implement according to this after description.
As it is shown in figure 1, the database design method quickly generating tree construction of the present invention, including such as
Lower step:
Step one, in the data base with tree-shaped relation data create bivariate table, including tree structure information table
With Sort table, described tree structure information table is for recording the nodal information in tree construction, described nodal information
Including node ID, nodename, his father's node ID and the description of other attribute informations thereof.Traditional approach
In be to utilize described tree structure information table, during spanning tree structured data use recursive fashion, this design side
Method has a strong impact on system effectiveness when big data quantity represents, it is possible to cause whole application system to be in seemingly-dead
State.Described Sort table, is associated with institute tree structure information table, for record tree construction node it
Between relation, described Sort table include Sort ID, node ID and father node ID thereof, sort type,
Particular location in affiliated level of level, node belonging to node and other information etc. of external data table, institute
State sort type and refer to the DISPLAY ORDER of data, such as, have multiple department, the display of these departments can be set
Order, so that checking, arranges market department and ranked first position, and second etc. is clapped by technology department, such as the class that do not sorts
Type, then data initial by name is smoothed out auto-sequencing.Fig. 2 is the described bivariate table created
Citing, such as one company management's layer includes the first level president and the second level general manager, general manager
Administration assistant manager A, assistant manager B and assistant manager C, for third layer level management level, each assistant manager manages
Department be the 4th level, assistant manager A regulating the market portion and purchasing department, assistant manager B management production department and
Technology department, assistant manager C management office and Human Resources Department, material is thus formed the most tree-shaped of a company
Structural relation.Described nodal information includes, such as 02, assistant manager B, father node be general manager, management
It is technology and production field etc.;Or 07, market department, father node be assistant manager A, groundwork appoints
Business is the exploitation etc. of marketing.Described Sort table include IV, 02, belong to second position of third layer level
Deng;Or VII, 07, belong to first position etc. of the 4th level.Described Sort ID and sort level (institute
Belong to level), level code (particular location of affiliated level) be corresponding, i.e. belong to the first level
The Sort ID value of first position is minimum, comes foremost.
Step 2, time the nodal information in described tree structure information table is modified, first to described node
Information is modified and is saved in described tree structure information table, and amendment information is increased in Sort table
Being associated, then caller rearrangement Sort table in same affairs, makes described Sort table record
Amended tree structure relation, the amendment of described nodal information includes increasing and deleting child node.Increase
Or when deleting child node, first amended information is saved in tree structure information table, and amendment is believed
Breath is associated in Sort table, now has some information and changes therewith, as deleted the total of the second level
Manager, then the vice general manager of third layer level just becomes the second level, and its father node becomes president, and the 4th
Each department of level just becomes third layer level, will resequence Sort table.Now, in same affairs
Middle caller rearrangement Sort table, makes the described amended tree structure relation of Sort table record.
The code of rearrangement Sort table is:
Step 3, the Sql statement of execution query tree structure, be ranked up by the ID of Sort table, display tree
Structured data.Because described Sort ID and sort level (affiliated level), level code (affiliated level
Particular location) be corresponding, so being ranked up just may be used to described Sort table by described Sort ID
To show tree construction.The Sql statement of query tree structure is:
The method of the invention uses unique database structure design, and the resource taken during spanning tree is entered
Row reasonable distribution, part resource is taken transfer to increase newly, deletion of node time, improve spanning tree structure
Efficiency, and enormously simplify the process of spanning tree structure, with simple Sql query statement sorting query i.e.
Can.
Although embodiment of the present invention are disclosed as above, but it is not restricted to description and embodiment party
Listed utilization in formula, it can be applied to various applicable the field of the invention completely, for being familiar with ability
For the personnel in territory, be easily achieved other amendment, therefore without departing substantially from claim and etc. homotype
Enclosing under limited general concept, the present invention is not limited to specific details and shown here as the figure with description
Example.
Claims (1)
1. the database design method quickly generating tree construction, it is characterised in that described method includes
Following steps:
Step one, in the data base with tree-shaped relation data create bivariate table, including:
Tree structure information table, for recording the nodal information in tree construction, described nodal information includes node
ID, nodename, his father's node ID and the description of other attribute value information thereof;
Sort table, is associated with described tree structure information table, between the node recording tree construction
Relation, each node has a Sort ID value, described Sort table include Sort ID, node ID and
Level belonging to father node ID, sort type, node and node are at the particular location of affiliated level;
Step 2, time the nodal information in described tree structure information table is modified, amendment information is protected
It is stored in described tree structure information table, and amendment information is associated in Sort table, then same
Affairs are resequenced described Sort table, so that amended tree structure relation record is in described Sort table;
Step 3, by Sort table Field ID value sort read data, query tree structure information;
Wherein, the amendment of described nodal information includes increasing and deleting child node.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210401403.8A CN102902811B (en) | 2012-10-19 | 2012-10-19 | A kind of database design method quickly generating tree construction |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210401403.8A CN102902811B (en) | 2012-10-19 | 2012-10-19 | A kind of database design method quickly generating tree construction |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102902811A CN102902811A (en) | 2013-01-30 |
CN102902811B true CN102902811B (en) | 2016-09-14 |
Family
ID=47575043
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210401403.8A Active CN102902811B (en) | 2012-10-19 | 2012-10-19 | A kind of database design method quickly generating tree construction |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102902811B (en) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104408067B (en) * | 2014-10-29 | 2019-08-13 | 中国建设银行股份有限公司 | A kind of database design method and device of polytree structure |
CN105335501A (en) * | 2015-10-28 | 2016-02-17 | 南车青岛四方机车车辆股份有限公司 | Technical standard database as well as estimating method and device thereof |
CN105809594B (en) * | 2016-03-11 | 2020-05-01 | 武汉天量数据技术有限公司 | Flexible knowledge point system construction method and system |
CN110569300A (en) * | 2018-05-17 | 2019-12-13 | 江苏优瀛科技有限公司 | Method and system for realizing data sorting of report forms with tree hierarchical structure |
CN110768882B (en) * | 2019-11-07 | 2022-07-12 | 青岛合启立智能科技有限公司 | Data monitoring method and system, monitoring equipment and vehicle |
CN113064881B (en) * | 2021-04-15 | 2024-05-24 | 深信服科技股份有限公司 | Database management method, device, equipment and readable storage medium |
CN115840751B (en) * | 2023-02-21 | 2023-05-12 | 山东经伟晟睿数据技术有限公司 | Novel tree-shaped data coding method |
CN116561650B (en) * | 2023-07-10 | 2023-09-19 | 中汽智联技术有限公司 | Scene file classification and updating method, device and equipment based on tree structure |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101236550A (en) * | 2007-02-01 | 2008-08-06 | 阿里巴巴公司 | Method and system for processing tree -type structure data |
US7512594B2 (en) * | 2005-08-17 | 2009-03-31 | Lixin Zhang | Computer controlled user display interface with a tree to represent data relationships in a database |
CN101706820A (en) * | 2009-12-10 | 2010-05-12 | 金蝶软件(中国)有限公司 | Storing method and device and query method and device of bill of materials |
CN102096711A (en) * | 2011-01-24 | 2011-06-15 | 四川长虹电器股份有限公司 | Method for constructing tree structural directory in database |
CN102508866A (en) * | 2011-10-09 | 2012-06-20 | 中国电子科技集团公司第二十八研究所 | Digital addressing-based method for structured storage and rapid processing of command relation tree |
-
2012
- 2012-10-19 CN CN201210401403.8A patent/CN102902811B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7512594B2 (en) * | 2005-08-17 | 2009-03-31 | Lixin Zhang | Computer controlled user display interface with a tree to represent data relationships in a database |
CN101236550A (en) * | 2007-02-01 | 2008-08-06 | 阿里巴巴公司 | Method and system for processing tree -type structure data |
CN101706820A (en) * | 2009-12-10 | 2010-05-12 | 金蝶软件(中国)有限公司 | Storing method and device and query method and device of bill of materials |
CN102096711A (en) * | 2011-01-24 | 2011-06-15 | 四川长虹电器股份有限公司 | Method for constructing tree structural directory in database |
CN102508866A (en) * | 2011-10-09 | 2012-06-20 | 中国电子科技集团公司第二十八研究所 | Digital addressing-based method for structured storage and rapid processing of command relation tree |
Also Published As
Publication number | Publication date |
---|---|
CN102902811A (en) | 2013-01-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102902811B (en) | A kind of database design method quickly generating tree construction | |
US20140098101A1 (en) | Node cluster relationships in a graph database | |
CN110443010A (en) | One kind permission visual configuration control method, device, terminal and storage medium in information system | |
CN103310295B (en) | Work micro-blog management method | |
CN105069109B (en) | A kind of method and system of distributed data base dilatation | |
CN103853759B (en) | A kind of generation method and system of adaptive list | |
CN104504008B (en) | A kind of Data Migration algorithm based on nested SQL to HBase | |
CN102567820A (en) | Dynamic news release and management system | |
CN102542409A (en) | Recruitment information display method based on socialized network system | |
Batagelj et al. | Analysis of kinship relations with Pajek | |
CN107563715A (en) | Foreign trade set-off marketing system and method | |
CN103365868A (en) | Data processing method and data processing system | |
US20120078971A1 (en) | Data management method | |
CN102024182A (en) | System for managing asset information | |
US20150058363A1 (en) | Cloud-based enterprise content management system | |
CN102508971A (en) | Method for establishing product function model in concept design stage | |
Kantabutra et al. | Using the Newly‐created ILE DBMS to Better Represent Temporal and Historical GIS Data | |
SE0202593D0 (en) | A Computer program product and associated methods for searching a database of objects, connecting objects in such a database, and exporting data from at least arbitrary database | |
CN104424532A (en) | Human resource management system | |
CN110134511A (en) | A kind of shared storage optimization method of OpenTSDB | |
CN102236662A (en) | Database query and control method | |
Prabowo et al. | Analysis of regional economic problems (Case study: Mapping regency/city leading sectors in Papua province in 2020) | |
CN110222032A (en) | A kind of generalised event model based on software data analysis | |
CN109976719A (en) | A kind of design method of management system, electronic equipment, storage medium and platform | |
CN108399188A (en) | A kind of general foundation of the strong business object based on genre metadata and processing method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |