Selaa lähdekoodia

租户创建相关查询角色及菜单列表

tags/v1.2.0^2
xiaoying 1 vuosi sitten
vanhempi
commit
d85e71bed9
5 muutettua tiedostoa jossa 68 lisäystä ja 4 poistoa
  1. +21
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/OidcCallbackController.java
  2. +2
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/role/IRoleService.java
  3. +8
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/role/RoleServiceImpl.java
  4. +4
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/OidcService.java
  5. +33
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/OidcServiceImpl.java

+ 21
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/callback/OidcCallbackController.java Näytä tiedosto

@@ -8,10 +8,7 @@ import com.tuoheng.admin.service.third.oidc.OidcService;
import com.tuoheng.common.core.utils.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;
import org.springframework.web.bind.annotation.*;

/**
* oidc平台回调前端控制器
@@ -54,4 +51,24 @@ public class OidcCallbackController {
log.info("被oidc调用,删除租户:{}", JSONObject.toJSONString(request));
return oidcService.deletedTenant(request);
}
/**
* 查询所有可用的角色
*
* @return
*/
@GetMapping("/getRoleList")
public JsonResult getRoleList() {
return oidcService.getRoleList();
}

/**
* 查询角色对应的菜单
*
* @return
*/
@GetMapping("/getMenuList/{roleId}")
public JsonResult getMenuList(@PathVariable("roleId") Integer roleId) {
return oidcService.getMenuList(roleId);
}

}

+ 2
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/role/IRoleService.java Näytä tiedosto

@@ -28,4 +28,6 @@ public interface IRoleService {
JsonResult savePermission(RoleMenuDto roleMenuDto);

JsonResult roleToTenant(Integer[] ids);

JsonResult getRoles();
}

+ 8
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/role/RoleServiceImpl.java Näytä tiedosto

@@ -344,6 +344,14 @@ public class RoleServiceImpl implements IRoleService {
}
return JsonResult.success();
}
@Override
public JsonResult getRoles() {

List<Role> roles = roleMapper.selectList(Wrappers.<Role>lambdaQuery()
.eq(Role::getMark, MarkEnum.VALID.getCode()).eq(Role::getStatus, 1));

return JsonResult.success(roles);
}


}

+ 4
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/OidcService.java Näytä tiedosto

@@ -20,4 +20,8 @@ public interface OidcService {
JsonResult editTenant(EditOidcTenantRequest request);

JsonResult deletedTenant(DeletedOidcTenantRequest request);

JsonResult getRoleList();

JsonResult getMenuList(Integer roleId);
}

+ 33
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/OidcServiceImpl.java Näytä tiedosto

@@ -1,10 +1,13 @@
package com.tuoheng.admin.service.third.oidc;

import com.baomidou.mybatisplus.extension.service.IService;
import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.query.RoleClientQuery;
import com.tuoheng.admin.request.third.oidc.CreateOidcTenantRequest;
import com.tuoheng.admin.request.third.oidc.DeletedOidcTenantRequest;
import com.tuoheng.admin.request.third.oidc.EditOidcTenantRequest;
import com.tuoheng.admin.service.role.IRoleService;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,6 +35,10 @@ public class OidcServiceImpl implements OidcService {
@Autowired
private DeletedOidcTenantService deletedOidcTenantService;

@Autowired
private IRoleService roleService;


public JsonResult addUser(User user, String password, Tenant tenant) {
return addOidcUserService.add(user, password, tenant);
}
@@ -58,4 +65,30 @@ public class OidcServiceImpl implements OidcService {
public JsonResult deletedTenant(DeletedOidcTenantRequest request) {
return deletedOidcTenantService.deletedTenant(request);
}

/**
* 租户获取可用的角色
*
* @return
*/
@Override
public JsonResult getRoleList() {

JsonResult jsonResult = roleService.getRoles();
return jsonResult;
}

/**
* 获取角色对应的菜单
*
* @param roleId
* @return
*/
@Override
public JsonResult getMenuList(Integer roleId) {

RoleClientQuery query = new RoleClientQuery();
query.setRoleId(roleId);
return roleService.getMenuList(query);
}
}

Loading…
Peruuta
Tallenna