/** demo页面跳转 */
 @RequestMapping(params = "demoLayoutList")
 public ModelAndView demoLayout(HttpServletRequest request) {
   CriteriaQuery cq = new CriteriaQuery(TSDemo.class);
   cq.isNull("TSDemo.id");
   cq.add();
   List<TSDemo> demoList = systemService.getListByCriteriaQuery(cq, false);
   request.setAttribute("demoList", demoList);
   return new ModelAndView("jeecg/demo/base/layout/demoLayoutList");
 }
 /**
  * 部门列表,树形展示
  *
  * @param request
  * @param response
  * @param treegrid
  * @return
  */
 @RequestMapping(params = "departgrid")
 @ResponseBody
 public List<TreeGrid> departgrid(
     TSDepart tSDepart,
     HttpServletRequest request,
     HttpServletResponse response,
     TreeGrid treegrid) {
   CriteriaQuery cq = new CriteriaQuery(TSDepart.class);
   // update-begin--Author:sun  Date:20130510 for:[089]解决部门名称查询异常
   if ("yes".equals(request.getParameter("isSearch"))) {
     treegrid.setId(null);
     tSDepart.setId(null);
   }
   // ----------------------------------------------------------------
   // update-begin--Author:yeshuai  Date:20130412 for:增加部门名称搜寻框
   if (null != tSDepart.getDepartname()) {
     org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tSDepart);
   }
   // update-end--Author:yeshuai  Date:20130412 for:增加部门名称搜寻框
   // ----------------------------------------------------------------
   if (treegrid.getId() != null) {
     cq.eq("TSPDepart.id", treegrid.getId());
   }
   if (treegrid.getId() == null) {
     cq.isNull("TSPDepart");
   }
   cq.add();
   List<TreeGrid> departList = null;
   departList = systemService.getListByCriteriaQuery(cq, false);
   if (departList.size() == 0 && tSDepart.getDepartname() != null) {
     cq = new CriteriaQuery(TSDepart.class);
     TSDepart parDepart = new TSDepart();
     tSDepart.setTSPDepart(parDepart);
     org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tSDepart);
     departList = systemService.getListByCriteriaQuery(cq, false);
   }
   // update-end--Author:sun  Date:20130510 for:[089]解决部门名称查询异常
   List<TreeGrid> treeGrids = new ArrayList<TreeGrid>();
   TreeGridModel treeGridModel = new TreeGridModel();
   treeGridModel.setTextField("departname");
   treeGridModel.setParentText("TSPDepart_departname");
   treeGridModel.setParentId("TSPDepart_id");
   treeGridModel.setSrc("description");
   treeGridModel.setIdField("id");
   treeGridModel.setChildList("TSDeparts");
   treeGrids = systemService.treegrid(departList, treeGridModel);
   return treeGrids;
 }
 /**
  * 父级权限列表
  *
  * @param role
  * @param request
  * @param response
  * @param dataGrid
  * @param user
  * @return
  */
 @RequestMapping(params = "setPFunction")
 @ResponseBody
 public List<ComboTree> setPFunction(HttpServletRequest request, ComboTree comboTree) {
   CriteriaQuery cq = new CriteriaQuery(TSDepart.class);
   if (comboTree.getId() != null) {
     cq.eq("TSPDepart.id", comboTree.getId());
   }
   if (comboTree.getId() == null) {
     cq.isNull("TDepart");
   }
   cq.add();
   List<TSDepart> departsList = systemService.getListByCriteriaQuery(cq, false);
   List<ComboTree> comboTrees = new ArrayList<ComboTree>();
   comboTrees = systemService.comTree(departsList, comboTree);
   return comboTrees;
 }
 /** 父级DEMO下拉菜单 */
 @RequestMapping(params = "pDemoList")
 @ResponseBody
 public List<ComboTree> pDemoList(HttpServletRequest request, ComboTree comboTree) {
   CriteriaQuery cq = new CriteriaQuery(TSDemo.class);
   if (comboTree.getId() != null) {
     cq.eq("TSDemo.id", comboTree.getId());
   }
   if (comboTree.getId() == null) {
     cq.isNull("TSDemo");
   }
   cq.add();
   List<TSDemo> demoList = systemService.getListByCriteriaQuery(cq, false);
   List<ComboTree> comboTrees = new ArrayList<ComboTree>();
   ComboTreeModel comboTreeModel = new ComboTreeModel("id", "demotitle", "tsDemos", "demourl");
   comboTrees = systemService.ComboTree(demoList, comboTreeModel, null, false);
   return comboTrees;
 }
 /** 权限列表 */
 @RequestMapping(params = "demoGrid")
 @ResponseBody
 public List<TreeGrid> demoGrid(HttpServletRequest request, TreeGrid treegrid) {
   CriteriaQuery cq = new CriteriaQuery(TSDemo.class);
   if (treegrid.getId() != null) {
     cq.eq("TSDemo.id", treegrid.getId());
   }
   if (treegrid.getId() == null) {
     cq.isNull("TSDemo");
   }
   cq.add();
   List<TSDemo> demoList = systemService.getListByCriteriaQuery(cq, false);
   TreeGridModel treeGridModel = new TreeGridModel();
   treeGridModel.setTextField("demotitle");
   treeGridModel.setParentText("TSDemo_demotitle");
   treeGridModel.setParentId("TSDemo_id");
   treeGridModel.setSrc("demourl");
   treeGridModel.setIdField("id");
   treeGridModel.setChildList("tsDemos");
   List<TreeGrid> treeGrids = systemService.treegrid(demoList, treeGridModel);
   return treeGrids;
 }