1.租户到期时间查询

This commit is contained in:
2025-08-25 14:28:17 +08:00
parent 061711a9c0
commit 3f1c4df78a
6 changed files with 48 additions and 4 deletions

View File

@@ -46,7 +46,8 @@ public class SaTokenConfigure implements WebMvcConfigurer {
"/user/doLogin",
"/tenant/get-id-by-name",
"/user/bigbrother-doLogin",
"/user/aiChat-doLogin"
"/user/aiChat-doLogin",
"/error"
};
}

View File

@@ -4,12 +4,15 @@ 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
@@ -30,7 +33,12 @@ public class TenantController {
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));
}
}

View File

@@ -0,0 +1,15 @@
package com.yupi.springbootinit.model.vo.user;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Date;
/*
* @author: ziin
* @date: 2025/8/25 14:12
*/
@Data
public class SystemTenantVO {
private Date expiredTime;
}

View File

@@ -3,7 +3,8 @@ package com.yupi.springbootinit.service;
import com.yupi.springbootinit.common.BaseResponse;
import com.yupi.springbootinit.model.entity.SystemTenant;
import com.baomidou.mybatisplus.extension.service.IService;
/*
import com.yupi.springbootinit.model.vo.user.SystemTenantVO;
/*
* @author: ziin
* @date: 2025/6/20 14:50
*/
@@ -12,4 +13,6 @@ public interface SystemTenantService extends IService<SystemTenant>{
Long getTenantIdByName(String name);
SystemTenantVO getTenantIdExpired(Long tenantId);
}

View File

@@ -1,9 +1,11 @@
package com.yupi.springbootinit.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yupi.springbootinit.common.BaseResponse;
import com.yupi.springbootinit.common.ErrorCode;
import com.yupi.springbootinit.exception.BusinessException;
import com.yupi.springbootinit.model.vo.user.SystemTenantVO;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@@ -11,6 +13,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yupi.springbootinit.model.entity.SystemTenant;
import com.yupi.springbootinit.mapper.SystemTenantMapper;
import com.yupi.springbootinit.service.SystemTenantService;
import javax.annotation.Resource;
/*
* @author: ziin
* @date: 2025/6/20 14:50
@@ -19,6 +23,9 @@ import com.yupi.springbootinit.service.SystemTenantService;
@Service
public class SystemTenantServiceImpl extends ServiceImpl<SystemTenantMapper, SystemTenant> implements SystemTenantService{
@Resource
private SystemTenantMapper systemTenantMapper;
@Override
public Long getTenantIdByName(String name) {
QueryWrapper<SystemTenant> queryWrapper = new QueryWrapper<>();
@@ -31,4 +38,12 @@ public class SystemTenantServiceImpl extends ServiceImpl<SystemTenantMapper, Sys
return systemTenant.getId();
}
@Override
public SystemTenantVO getTenantIdExpired(Long tenantId) {
SystemTenant systemTenant = systemTenantMapper.selectById(tenantId);
SystemTenantVO systemTenantVO = new SystemTenantVO();
systemTenantVO.setExpiredTime(systemTenant.getExpireTime());
return systemTenantVO;
}
}

View File

@@ -107,4 +107,6 @@ sa-token:
md5:
salt: (-FhqvXO,wMz
salt: (-FhqvXO,wMz
ai_log_path: /test/ai_log/