XuqmGroup-Server/tenant-service/src/main/java/com/xuqm/tenant/service/SdkAppProvisioningService.java

25 行
783 B
Java

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
2026-05-07 19:39:42 +08:00
public AppEntity resolveApp(String appKey) {
return appRepository.findByAppKey(appKey)
.or(() -> appRepository.findById(appKey))
.orElseThrow(() -> new BusinessException(404, "App not found: " + appKey));
}
}