@RequiresPermissions("renwu_run:renwuRun:view") @RequestMapping(value = {"list", ""}) public String list( RenwuRun renwuRun, HttpServletRequest request, HttpServletResponse response, Model model) { List<RenwuRun> list = renwuRunService.findList(renwuRun); for (RenwuRun run : list) { if ("0".equals(run.getTaskstatus())) { run.setTaskText("处理"); run.setTaskstatus("未处理"); } else { run.setTaskText("查看"); run.setTaskstatus("处理完毕"); } } model.addAttribute("list", list); return "modules/renwu_run/renwuRunList"; }
@RequiresPermissions("user") @ResponseBody @RequestMapping(value = "treeData") public List<Map<String, Object>> treeData( @RequestParam(required = false) String extId, HttpServletResponse response) { List<Map<String, Object>> mapList = Lists.newArrayList(); List<RenwuRun> list = renwuRunService.findList(new RenwuRun()); for (int i = 0; i < list.size(); i++) { RenwuRun e = list.get(i); if (StringUtils.isBlank(extId) || (extId != null && !extId.equals(e.getId()) && e.getParentIds().indexOf("," + extId + ",") == -1)) { Map<String, Object> map = Maps.newHashMap(); map.put("id", e.getId()); map.put("pId", e.getParentId()); map.put("name", e.getName()); mapList.add(map); } } return mapList; }
@RequiresPermissions("renwu_run:renwuRun:view") @RequestMapping(value = "form") public String form(RenwuRun renwuRun, Model model) { if (renwuRun.getParent() != null && StringUtils.isNotBlank(renwuRun.getParent().getId())) { renwuRun.setParent(renwuRunService.get(renwuRun.getParent().getId())); // 获取排序号,最末节点排序号+30 if (StringUtils.isBlank(renwuRun.getId())) { RenwuRun renwuRunChild = new RenwuRun(); renwuRunChild.setParent(new RenwuRun(renwuRun.getParent().getId())); List<RenwuRun> list = renwuRunService.findList(renwuRun); if (list.size() > 0) { renwuRun.setSort(list.get(list.size() - 1).getSort()); if (renwuRun.getSort() != null) { renwuRun.setSort(renwuRun.getSort() + 30); } } } } if (renwuRun.getSort() == null) { renwuRun.setSort(30); } model.addAttribute("renwuRun", renwuRun); return "modules/renwu_run/renwuRunForm"; }