Sync edqs and sql logics to display entity name

This commit is contained in:
Vladyslav_Prykhodko 2025-10-08 15:52:33 +03:00
parent bae7030302
commit e3967e31fc
2 changed files with 4 additions and 4 deletions

View File

@ -148,10 +148,10 @@ public abstract class BaseEntityData<T extends EntityFields> implements EntityDa
public String getDisplayName(){ public String getDisplayName(){
return switch (getEntityType()) { return switch (getEntityType()) {
case DEVICE, ASSET -> StringUtils.isNotEmpty(fields.getLabel()) ? fields.getLabel() : fields.getName(); case DEVICE, ASSET -> StringUtils.isNotBlank(fields.getLabel()) ? fields.getLabel() : fields.getName();
case USER -> { case USER -> {
boolean firstNameSet = StringUtils.isNotEmpty(fields.getFirstName()); boolean firstNameSet = StringUtils.isNotBlank(fields.getFirstName());
boolean lastNameSet = StringUtils.isNotEmpty(fields.getLastName()); boolean lastNameSet = StringUtils.isNotBlank(fields.getLastName());
if(firstNameSet && lastNameSet) { if(firstNameSet && lastNameSet) {
yield fields.getFirstName() + " " + fields.getLastName(); yield fields.getFirstName() + " " + fields.getLastName();
} else if(firstNameSet) { } else if(firstNameSet) {

View File

@ -84,7 +84,7 @@ public class EntityKeyMapping {
public static final String SERVICE_ID = "serviceId"; public static final String SERVICE_ID = "serviceId";
public static final String OWNER_NAME = "ownerName"; public static final String OWNER_NAME = "ownerName";
public static final String OWNER_TYPE = "ownerType"; public static final String OWNER_TYPE = "ownerType";
public static final String LABELED_ENTITY_DISPLAY_NAME_SELECT_QUERY = "COALESCE(NULLIF(e." + LABEL + ", ''), e." + NAME + ")"; public static final String LABELED_ENTITY_DISPLAY_NAME_SELECT_QUERY = "COALESCE(NULLIF(TRIM(e." + LABEL + "), ''), e." + NAME + ")";
public static final String USER_DISPLAY_NAME_SELECT_QUERY = "COALESCE(NULLIF(TRIM(CONCAT_WS(' ', e.first_name, e.last_name)), ''), e.email)"; public static final String USER_DISPLAY_NAME_SELECT_QUERY = "COALESCE(NULLIF(TRIM(CONCAT_WS(' ', e.first_name, e.last_name)), ''), e.email)";
public static final String OWNER_NAME_SELECT_QUERY = "case when e.customer_id = '" + NULL_UUID + "' " + public static final String OWNER_NAME_SELECT_QUERY = "case when e.customer_id = '" + NULL_UUID + "' " +
"then (select title from tenant where id = e.tenant_id) " + "then (select title from tenant where id = e.tenant_id) " +