added Staff details to GET /groups api
This commit is contained in:
+39
-6
@@ -21,7 +21,11 @@ public class GroupData {
|
||||
private final String externalId;
|
||||
private final Long officeId;
|
||||
private final String officeName;
|
||||
private final Long staffId;
|
||||
private final String staffName;
|
||||
private final Long groupLevel;
|
||||
private final Long parentId;
|
||||
private final String parentName;
|
||||
@SuppressWarnings("unused")
|
||||
private final GroupLevelData groupLevelData;
|
||||
private final Collection<ClientLookup> clientMembers;
|
||||
@@ -36,13 +40,18 @@ public class GroupData {
|
||||
@SuppressWarnings("unused")
|
||||
private final Collection<GroupLookupData> childGroups;
|
||||
|
||||
public GroupData(final Long id, final Long officeId, final String officeName, final String name, final String externalId , final Long groupLevel ) {
|
||||
public GroupData(final Long id, final Long officeId, final String officeName, final String name, final String externalId,
|
||||
final Long groupLevel, final Long parentId, final String parentName, final Long staffId, final String staffName) {
|
||||
this.id = id;
|
||||
this.officeId = officeId;
|
||||
this.officeName = officeName;
|
||||
this.name = name;
|
||||
this.externalId = externalId;
|
||||
this.groupLevel =groupLevel;
|
||||
this.groupLevel = groupLevel;
|
||||
this.parentId = parentId;
|
||||
this.parentName = parentName;
|
||||
this.staffId = staffId;
|
||||
this.staffName = staffName;
|
||||
this.groupLevelData = null;
|
||||
this.clientMembers = null;
|
||||
this.allowedClients = null;
|
||||
@@ -54,13 +63,17 @@ public class GroupData {
|
||||
|
||||
public GroupData(final GroupData group, final Collection<ClientLookup> clientMembers, final Collection<ClientLookup> allowedClients,
|
||||
final Collection<OfficeLookup> allowedOffices, final Collection<GroupLookupData> allowedParentGroups,
|
||||
final GroupLevelData groupLevelData , final Collection<StaffData> allowedStaffs , final Collection<GroupLookupData> childGroups) {
|
||||
final GroupLevelData groupLevelData, final Collection<StaffData> allowedStaffs, final Collection<GroupLookupData> childGroups) {
|
||||
this.id = group.getId();
|
||||
this.officeId = group.getOfficeId();
|
||||
this.officeName = group.getOfficeName();
|
||||
this.name = group.getName();
|
||||
this.externalId = group.getExternalId();
|
||||
this.groupLevel = group.getGroupLevel();
|
||||
this.parentId = group.getParentId();
|
||||
this.parentName = group.getParentName();
|
||||
this.staffId = group.getStaffId();
|
||||
this.staffName = group.getStaffName();
|
||||
|
||||
this.groupLevelData = groupLevelData;
|
||||
this.clientMembers = clientMembers;
|
||||
@@ -72,14 +85,19 @@ public class GroupData {
|
||||
}
|
||||
|
||||
public GroupData(final Long officeId, final Collection<ClientLookup> allowedClients, final Collection<OfficeLookup> allowedOffices,
|
||||
final Collection<GroupLookupData> allowedParentGroups, final GroupLevelData groupLevelData , final Collection<StaffData> allowedStaffs ) {
|
||||
final Collection<GroupLookupData> allowedParentGroups, final GroupLevelData groupLevelData,
|
||||
final Collection<StaffData> allowedStaffs) {
|
||||
this.id = null;
|
||||
this.officeId = officeId;
|
||||
this.officeName = null;
|
||||
this.name = null;
|
||||
this.externalId = null;
|
||||
this.clientMembers = null;
|
||||
this.groupLevel =null;
|
||||
this.groupLevel = null;
|
||||
this.parentId = null;
|
||||
this.parentName = null;
|
||||
this.staffId = null;
|
||||
this.staffName = null;
|
||||
this.groupLevelData = groupLevelData;
|
||||
this.allowedClients = allowedClients;
|
||||
this.allowedOffices = allowedOffices;
|
||||
@@ -107,11 +125,26 @@ public class GroupData {
|
||||
public String getOfficeName() {
|
||||
return officeName;
|
||||
}
|
||||
|
||||
|
||||
public Long getGroupLevel() {
|
||||
return this.groupLevel;
|
||||
}
|
||||
|
||||
public Long getParentId() {
|
||||
return this.parentId;
|
||||
}
|
||||
|
||||
public Long getStaffId() {
|
||||
return this.staffId;
|
||||
}
|
||||
|
||||
public String getStaffName() {
|
||||
return this.staffName;
|
||||
}
|
||||
|
||||
public String getParentName() {
|
||||
return this.parentName;
|
||||
}
|
||||
|
||||
public Collection<ClientLookup> clientMembers() {
|
||||
return this.clientMembers;
|
||||
|
||||
+10
-3
@@ -221,8 +221,10 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
|
||||
private static final class GroupDataMapper implements RowMapper<GroupData> {
|
||||
|
||||
public String groupSchema() {
|
||||
return "g.office_id as officeId, g.level_id as groupLevel , o.name as officeName, g.id as id, g.external_id as externalId, "
|
||||
+ "g.name as name from m_group g join m_office o on o.id = g.office_id";
|
||||
return "g.office_id as officeId, g.level_id as groupLevel , g.parent_id as parentId , o.name as officeName,"
|
||||
+ " g.id as id, g.external_id as externalId, g.name as name , s.display_name as staffName , pg.name as"
|
||||
+ " parentName , g.staff_id as staffId from m_group g join m_office o on o.id = g.office_id left join "
|
||||
+ "m_staff s on s.id = g.staff_id left join m_group pg on pg.id = g.parent_id";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -234,7 +236,12 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
|
||||
Long officeId = rs.getLong("officeId");
|
||||
String officeName = rs.getString("officeName");
|
||||
Long groupLevel = rs.getLong("groupLevel");
|
||||
return new GroupData(id, officeId, officeName, name, externalId, groupLevel);
|
||||
Long parentId = rs.getLong("parentId");
|
||||
String parentName = rs.getString("parentName");
|
||||
Long staffId = rs.getLong("staffId");
|
||||
String staffName = rs.getString("staffName");
|
||||
|
||||
return new GroupData(id, officeId, officeName, name, externalId, groupLevel, parentId, parentName, staffId, staffName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user