修改日志.md 1.3 KB

  • 调整 common-security 逻辑
  • 新增 SecurityUtils.getTenantId() 获取
  • 增加 日志输出及sql日志和文件打印

TODO: 1.ruoyi 整体命名调整

怎么获取当前会话的租户ID

  • 代码获取: Integer tenantId = SecurityUtils.getTenantId(); 例:

    /**
     *  通过租户ID获取配置
     */
    @GetMapping("/getTenantConfig")
    public ApiResult<SysConfigTenantVo> getTenantConfig() {
        Integer tenantId = SecurityUtils.getTenantId(); 
        SysConfigTenantVo config = sysTenantService.getSysConfig(tenantId);
        return ApiResult.success(config);
    }
    
  • 登录获取Token

    curl --location --request POST 'http://usky-cloud-web:9150/auth/login' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "username": "admin",
    "password": "admin123",
    "code": "7",
    "uuid": "de8b904e5d81474e83f33f61c6cb0854"
    }'
    
    {
    "code": 200,
    "msg": null,
    "data": {
        "access_token": "eyJhbGciOiJIUzUxMiJ9.eyJ0ZW5hbnRfaWQiOjEwMDEsInVzZXJfaWQiOjEsInVzZXJfa2V5IjoiNjFkOGQzYjgtOTk2Mi00YzA5LWEwMWYtYzNlMDc2MTIwYjY2IiwidXNlcm5hbWUiOiJhZG1pbiJ9.-2uBvkfY7FYxejPcPvZ-jUw4FiLoNiHDVbm9NDX66jSMZpH8MZJEK17JgNhErVH_mfP5QSmp91cNksBEW26Jaw",
        "tenantId": 1001,
        "expires_in": 7200
    }
    }