Sync edqs and sql logics to display entity name
This commit is contained in:
		
							parent
							
								
									bae7030302
								
							
						
					
					
						commit
						e3967e31fc
					
				@ -148,10 +148,10 @@ public abstract class BaseEntityData<T extends EntityFields> implements EntityDa
 | 
			
		||||
 | 
			
		||||
    public String getDisplayName(){
 | 
			
		||||
        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 -> {
 | 
			
		||||
                boolean firstNameSet = StringUtils.isNotEmpty(fields.getFirstName());
 | 
			
		||||
                boolean lastNameSet = StringUtils.isNotEmpty(fields.getLastName());
 | 
			
		||||
                boolean firstNameSet = StringUtils.isNotBlank(fields.getFirstName());
 | 
			
		||||
                boolean lastNameSet = StringUtils.isNotBlank(fields.getLastName());
 | 
			
		||||
                if(firstNameSet && lastNameSet) {
 | 
			
		||||
                    yield fields.getFirstName() + " " + fields.getLastName();
 | 
			
		||||
                } else if(firstNameSet) {
 | 
			
		||||
 | 
			
		||||
@ -84,7 +84,7 @@ public class EntityKeyMapping {
 | 
			
		||||
    public static final String SERVICE_ID = "serviceId";
 | 
			
		||||
    public static final String OWNER_NAME = "ownerName";
 | 
			
		||||
    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 OWNER_NAME_SELECT_QUERY = "case when e.customer_id = '" + NULL_UUID + "' " +
 | 
			
		||||
            "then (select title from tenant where id = e.tenant_id) " +
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user