The organizational structure of the company is a tree-shaped organization, and each level of the organization may have subordinate organizations, which are successively advanced to the last non-subdividable end organization. In order to facilitate search and maintenance, the table data is displayed in a tree format, and click to expand the subordinate institutions.
1. First design the database table structure, the key is the deptid of the organization at this level and the abvbranch of the higher organization
create table RQ_DEPT ( deptid VARCHAR2(30) not null, name VARCHAR2(200) not null, kind VARCHAR2(5), branchid VARCHAR2(20), abvbranch VARCHAR2(20), isused VARCHAR2(2) default '1', transtime NUMBER(6), transdatatimes NUMBER(6) )
2. Write Bean object, controller, service, dao layer business logic
1 public class Dept { 2 3 private String deptId; // organization code 4 private String deptName; // organization name 5 private String kind; // organization type 6 private String branchId; // branch 7 private String abvbranch; // superior Institution 8 private String isUsed; // Use status 9 // Omit get set 10 11 }
3. Design virtual Bean objects compatible with EasyUI page objects
public class DeptTree extends Dept { private String id; private String text; private String state; // State private List<DeptTree> children; // Omit get, set }
4. Write JS script to realize page operation
The complete sample code is detailed on Github: https://github.com/nextMonth/Module/tree/master/dept