// create view T_ORDER_TENANT1005_VIEW as select order_id from T_ORDER private String createView(String tenantId, String objectName) { List<PropertyMeta> propertiesMeta = propertyMetaRepository.findByTenantIdAndObjectName(tenantId, objectName); StringBuffer createView = new StringBuffer(); createView .append("create view ") .append(objectName) .append("_") .append(tenantId) .append("_") .append("VIEW as select "); for (PropertyMeta propertyMeta : propertiesMeta) { createView .append(" ") .append(propertyMeta.getInternalName()) .append(" as ") .append(propertyMeta.getDisplayName()) .append(", "); } createView.deleteCharAt(createView.lastIndexOf(",")); createView.append(" from ").append(objectName); return createView.toString(); }
@Override public List<PropertyMeta> getByTenantIdAndObjectName(String tenantId, String objectName) { return propertyMetaRepository.findByTenantIdAndObjectName(tenantId, objectName); }