瀏覽代碼

保存client租户信息

tags/v2.3.0^2^2
chenjiandong 1 年之前
父節點
當前提交
5dee1116c3
共有 8 個文件被更改,包括 182 次插入0 次删除
  1. +41
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/controller/ClientController.java
  2. +19
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/ClientMapper.java
  3. +17
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/dto/ClientDto.java
  4. +19
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/dto/ClientRoleInfoDto.java
  5. +15
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/model/param/GetClientTenantRoleDto.java
  6. +17
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/ClientSevice.java
  7. +45
    -0
      tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/ClientServiceImpl.java
  8. +9
    -0
      tuoheng_oidc_admin/src/main/resources/mapper/ClientMapper.xml

+ 41
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/controller/ClientController.java 查看文件

@@ -0,0 +1,41 @@
package com.tuoheng.controller;

import com.tuoheng.model.dto.LoginUser;
import com.tuoheng.model.param.CreateClientTenantDto;
import com.tuoheng.model.param.GetClientTenantRoleDto;
import com.tuoheng.service.ClientSevice;
import com.tuoheng.service.ClientUserSevice;
import com.tuoheng.service.CurrentUser;
import com.tuoheng.until.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @author chenjiandong
* @description: TODO
* @date 2022/12/7 16:17
*/
@RestController
@RequestMapping("/client")
@Slf4j
public class ClientController {

@Autowired
private ClientSevice clientSevice;

@PostMapping("/getAllClient")
public JsonResult getAllClient(@CurrentUser LoginUser loginUser){
return clientSevice.getAllClient();
}

@PostMapping("/getClientTenantRole")
public JsonResult getClientTenantRole(@RequestBody GetClientTenantRoleDto getClientTenantRoleDto,
@CurrentUser LoginUser loginUser){
return clientSevice.getClientTenantRole(getClientTenantRoleDto);
}

}

+ 19
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/mapper/ClientMapper.java 查看文件

@@ -0,0 +1,19 @@
package com.tuoheng.mapper;

import com.tuoheng.model.dto.ClientDto;
import com.tuoheng.model.po.UserPo;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
* @author chenjiandong
* @description: TODO
* @date 2022/10/8 11:59
*/
@Mapper
public interface ClientMapper {

List<ClientDto> getAllClient();

}

+ 17
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/dto/ClientDto.java 查看文件

@@ -0,0 +1,17 @@
package com.tuoheng.model.dto;

import lombok.Data;

/**
* @author chenjiandong
* @description: TODO
* @date 2022/12/12 9:16
*/
@Data
public class ClientDto {

private String clientId;

private String clientName;

}

+ 19
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/dto/ClientRoleInfoDto.java 查看文件

@@ -0,0 +1,19 @@
package com.tuoheng.model.dto;

import lombok.Data;
import lombok.experimental.Accessors;

/**
* @author chenjiandong
* @description: TODO
* @date 2022/12/12 10:01
*/
@Data
@Accessors(chain = true)
public class ClientRoleInfoDto {

private Integer roleId;

private String roleName;

}

+ 15
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/model/param/GetClientTenantRoleDto.java 查看文件

@@ -0,0 +1,15 @@
package com.tuoheng.model.param;

import lombok.Data;

/**
* @author chenjiandong
* @description: TODO
* @date 2022/12/12 9:53
*/
@Data
public class GetClientTenantRoleDto {

private String clientId;

}

+ 17
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/ClientSevice.java 查看文件

@@ -0,0 +1,17 @@
package com.tuoheng.service;

import com.tuoheng.model.param.GetClientTenantRoleDto;
import com.tuoheng.until.JsonResult;

/**
* @author chenjiandong
* @description: TODO
* @date 2022/10/8 11:35
*/
public interface ClientSevice {

JsonResult getAllClient();

JsonResult getClientTenantRole(GetClientTenantRoleDto getClientTenantRoleDto);

}

+ 45
- 0
tuoheng_oidc_admin/src/main/java/com/tuoheng/service/impl/ClientServiceImpl.java 查看文件

@@ -0,0 +1,45 @@
package com.tuoheng.service.impl;

import com.tuoheng.mapper.ClientMapper;
import com.tuoheng.model.dto.ClientRoleInfoDto;
import com.tuoheng.model.param.ClientRoleDto;
import com.tuoheng.model.param.GetClientTenantRoleDto;
import com.tuoheng.service.ClientSevice;
import com.tuoheng.until.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
* @author chenjiandong
* @description: TODO
* @date 2022/10/8 11:35
*/
@Service
public class ClientServiceImpl implements ClientSevice {

@Autowired
private ClientMapper clientMapper;

@Override
@Transactional(readOnly = true)
public JsonResult getAllClient(){
return JsonResult.success(clientMapper.getAllClient());
}

@Override
@Transactional(readOnly = true)
public JsonResult getClientTenantRole(GetClientTenantRoleDto getClientTenantRoleDto){
List<ClientRoleInfoDto> clientRoleInfoDtos = new ArrayList<>();
ClientRoleInfoDto clientRoleInfoDto = new ClientRoleInfoDto()
.setRoleId(1).setRoleName("租户管理员角色");
clientRoleInfoDtos.add(clientRoleInfoDto);
//todo:根据不同的 client 调用不同系统的接口,获取租户所对应的角色
return JsonResult.success(clientRoleInfoDtos);
}


}

+ 9
- 0
tuoheng_oidc_admin/src/main/resources/mapper/ClientMapper.xml 查看文件

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tuoheng.mapper.ClientMapper">

<select id="getAllClient" resultType="com.tuoheng.model.dto.ClientDto">
select client_id as clientId, client_name as clientName from oauth2_registered_client
</select>

</mapper>

Loading…
取消
儲存