@JSON @Log(logName = "添加") public String add() throws CoreException { if (authority == null) { logger.error("add authority error, and authority is null"); super.writeError(""); return ResultType.SUCCESS; } boolean isAdd = authorityService.add(authority); if (isAdd) { super.write("添加成功"); } else { super.writeError("添加失败"); } return ResultType.SUCCESS; }
@JSON @Log(logName = "删除") public String remove() throws CoreException { if (authority.getId() <= 0) { logger.error("remove authority error, and authority is " + authority); super.writeError("删除失败"); return ResultType.SUCCESS; } boolean isDel = authorityService.deleteById(authority.getId()); if (isDel) { super.write("删除成功"); } else { super.writeError("删除失败"); } return ResultType.SUCCESS; }
@JSON @Log(logName = "加载列表") public String load() throws CoreException { logger.debug("******load authority resources"); List<Authority> authorityList = new ArrayList<Authority>(); try { authorityList = authorityService.list(); if (authorityList == null || authorityList.size() == 0) { super.writeError("查询无结果"); return ResultType.SUCCESS; } /*List<Authority> tempList = new ArrayList<Authority>(authorityList); for(Authority au : tempList){ if(au.getUserType().getTypeId() == CONST.USER_TYPE_SUPER){ authorityList.remove(au); } }*/ } catch (Exception e) { logger.error(""); e.printStackTrace(); } super.writeRows(authorityList); return ResultType.SUCCESS; }