@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; }