/**
  * @param user
  * @param query
  * @return @Description:用户分页数据
  */
 @ResponseBody
 @RequestMapping("ajaxlist")
 @Permission(systemSn = "privilege", moduleSn = "user", value = PermissionConatant.R)
 public String ajaxlist(User user, Query query) {
   PagerModel<User> Users = null;
   try {
     if ("0".equals(user.getDepartmentId())) {
       user.setDepartmentId(null);
     } else {
       String deptIds = departmentService.getChildrenIdsByPid(user.getDepartmentId());
       user.setDepartmentId(deptIds);
     }
     Users = this.userService.getPagerModel(user, query);
   } catch (Exception e) {
     e.printStackTrace();
     logger.debug("UserController-ajaxlist:" + e.getMessage());
   }
   return JsonUtils.getPmJson(Users);
 }
 @Override
 public User getUserByUserName(String userName) throws Exception {
   User user = this.userDao.getUserByUserName(userName);
   if (user != null) {
     Department department = this.departmentDao.getDepartmentById(user.getDepartmentId());
     if (department != null) {
       user.setDeptName(department.getName());
     }
   }
   return user;
 }
 @Override
 public User getUserById(String id) throws Exception {
   UserSystem userSystem = new UserSystem();
   userSystem.setUserId(id);
   List<UserSystem> list = this.userSystemDao.getAll(userSystem);
   StringBuffer systemIds = new StringBuffer("");
   if (list != null && list.size() > 0) {
     for (int i = 0, len = list.size(); i < len; i++) {
       if (i != 0) {
         systemIds.append(",");
       }
       systemIds.append(list.get(i).getSystemId());
     }
   }
   User user = userDao.getUserById(id);
   if (user != null && systemIds.length() > 0) {
     user.setSystemIds(systemIds.toString());
     Department department = this.departmentDao.getDepartmentById(user.getDepartmentId());
     if (department != null) {
       user.setDeptName(department.getName());
     }
   }
   return user;
 }