コード例 #1
0
 /**
  * 部门列表,树形展示
  *
  * @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;
 }
コード例 #2
0
 /** 权限列表 */
 @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;
 }