// ---------------------------------------------------------------- // add-begin--Author:liutao Date:20130405 for:部门管理的添加处理逻辑 // ---------------------------------------------------------------- @RequestMapping(params = "add") public ModelAndView add(TSDepart depart, HttpServletRequest req) { List<TSDepart> departList = systemService.getList(TSDepart.class); req.setAttribute("departList", departList); if (StringUtil.isNotEmpty(depart.getId())) { TSDepart tspDepart = new TSDepart(); TSDepart tsDepart = new TSDepart(); depart = systemService.getEntity(TSDepart.class, depart.getId()); tspDepart.setId(depart.getId()); tspDepart.setDepartname(depart.getDepartname()); tsDepart.setTSPDepart(tspDepart); req.setAttribute("depart", tsDepart); } return new ModelAndView("system/depart/depart"); }
/** * 部门列表,树形展示 * * @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; }