Implementation of nested set design of SQL with Java - Preorder Tree Traversal

简体中文

Preface

Recently, we got a requirement for storage directories and files,the condition is,

  1. Input parameter is the path of the root directory which was unpacked.
  2. The files will not change nor update after unpacked.

The details of the requirement is,

  1. The directories and all its subdirectories and sub-files need to be parsed into a tree structure response to the front end.
  2. When the user clicks on each level of directory, we need to get the files in this directory and all its subdirectories for some business data statistics.
  3. We can only use the MySQL.(Can’t use a graph database.)
Read more