45 lines
1.4 KiB
Java
45 lines
1.4 KiB
Java
package com.yupi.springbootinit.controller;
|
|
|
|
import com.yupi.springbootinit.common.BaseResponse;
|
|
import com.yupi.springbootinit.common.ErrorCode;
|
|
import com.yupi.springbootinit.common.ResultUtils;
|
|
import com.yupi.springbootinit.exception.BusinessException;
|
|
import com.yupi.springbootinit.model.entity.SystemTenant;
|
|
import com.yupi.springbootinit.model.vo.user.SystemTenantVO;
|
|
import com.yupi.springbootinit.model.vo.user.SystemUsersVO;
|
|
import com.yupi.springbootinit.service.SystemTenantService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.security.PermitAll;
|
|
|
|
/*
|
|
* @author: ziin
|
|
* @date: 2025/6/20 15:18
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/tenant")
|
|
@Slf4j
|
|
@CrossOrigin
|
|
public class TenantController {
|
|
|
|
@Resource
|
|
private SystemTenantService systemTenantService;
|
|
|
|
@GetMapping("/get-id-by-name")
|
|
public BaseResponse<Long> getTenantIdByName(@RequestParam("name") String name) {
|
|
if (name == null) {
|
|
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
|
}
|
|
return ResultUtils.success( systemTenantService.getTenantIdByName(name));
|
|
}
|
|
|
|
@GetMapping("/get-expired-time")
|
|
public BaseResponse<SystemTenantVO> getTenantIdExpired(@RequestParam("tenantId") Long tenantId) {
|
|
return ResultUtils.success(systemTenantService.getTenantIdExpired(tenantId));
|
|
}
|
|
|
|
|
|
}
|