Easyui Loading the async tree in the background

Source: Internet
Author: User

DAO does not write interface, write implementation class directly

 Public List<dept> Tree (string hql, string par) {        = gethibernatetemplate (). Getsessionfactory ()                . Getcurrentsession ();         New ArrayList ();         if (par.length () = = 0)            {= session.createquery (hql). List ()        ; Else {            = Session.createquery (HQL). setString (0, par). List ();        }         return list;    }

Service Implementation Class

 Public     List<dept> Tree (Dept Dept) {        = "";         = "";         if (Dept.getid () =null | | dept.getid (). Trim (). Equals ("")) {            = "from Dept d where D.dept is null" c12>;        } Else {            = "from Dept d where d.dept.id =?" ;             = Dept.getid ();        }                 return Deptdao.tree (hql, par);    }

Action

//Add the tree inside     PublicString Comboxtree ()throwsException {List<Dept> FindAll =Deptservice.tree (dept); List List=NewArrayList ();  for(Dept dept:findall) {map map=NewHashMap (); if(dept.getdept () = =NULL) {Map.put ("id", Dept.getid ()); Map.put ("Text", Dept.getname ()); Map.put ("pid", 0); Map.put ("State", "closed");            List.add (map); }Else{map.put ("id", Dept.getid ()); Map.put ("Text", Dept.getname ()); Map.put ("pid", Dept.getdept (). GetId ()); List<Dept> depts =Deptservice.tree (dept); if(Depts.size () >0) {Map.put ("State", "closed");                            } list.add (map);        }} System.out.println (Jsonarray.fromobject (list). ToString ());        System.out.println ();        Servletactioncontext.getresponse (). Getwriter (). Write (Jsonarray.fromobject (list). ToString ()); return NULL; }

Easyui Loading the async tree in the background

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.