package com.xuqm.tenant.service; import com.xuqm.common.exception.BusinessException; import com.xuqm.tenant.entity.AppEntity; import com.xuqm.tenant.repository.AppRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service public class SdkAppProvisioningService { private final AppRepository appRepository; public SdkAppProvisioningService(AppRepository appRepository) { this.appRepository = appRepository; } @Transactional public AppEntity resolveApp(String appKey) { return appRepository.findByAppKey(appKey) .or(() -> appRepository.findById(appKey)) .orElseThrow(() -> new BusinessException(404, "App not found: " + appKey)); } }