| | |
| | | import org.dromara.system.domain.bo.SysTenantBo; |
| | | import org.dromara.system.domain.vo.SysTenantVo; |
| | | import org.dromara.system.service.ISysTenantService; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/system/tenant") |
| | | @ConditionalOnProperty(value = "tenant.enable", havingValue = "true") |
| | | public class SysTenantController extends BaseController { |
| | | |
| | | private final ISysTenantService tenantService; |
| | |
| | | @SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY) |
| | | @GetMapping("/dynamic/{tenantId}") |
| | | public R<Void> dynamicTenant(@NotBlank(message = "租户ID不能为空") @PathVariable String tenantId) { |
| | | TenantHelper.setDynamic(tenantId); |
| | | TenantHelper.setDynamic(tenantId, true); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | return toAjax(TenantHelper.ignore(() -> tenantService.syncTenantPackage(tenantId, packageId))); |
| | | } |
| | | |
| | | /** |
| | | * 同步租户字典 |
| | | */ |
| | | @SaCheckRole(TenantConstants.SUPER_ADMIN_ROLE_KEY) |
| | | @Log(title = "同步租户字典", businessType = BusinessType.INSERT) |
| | | @GetMapping("/syncTenantDict") |
| | | public R<Void> syncTenantDict() { |
| | | if (!TenantHelper.isEnable()) { |
| | | return R.fail("当前未开启租户模式"); |
| | | } |
| | | tenantService.syncTenantDict(); |
| | | return R.ok("同步租户字典成功"); |
| | | } |
| | | |
| | | } |