classic_blue 1 сар өмнө
parent
commit
67843497b9

+ 10 - 1
edu-travel-remote/edu-travel-remote-tenant/src/main/java/edu/travel/tenant/TenantRemoteController.java

@@ -51,10 +51,19 @@ public interface TenantRemoteController {
      */
     @GetMapping("/getTenantById")
 //    @PreAuthorize("hasRole('超级管理员')")
-    public BaseResponse<SysRoleVo> getTenantById(Long id);
+    public BaseResponse<EduTenantVo> getTenantById(Long id);
 
 
     /**
+     * 查询登录用户信息
+     *
+     * @return
+     */
+    @GetMapping("/getLoginTenantInfo")
+//    @PreAuthorize("hasRole('超级管理员')")
+    public BaseResponse<EduTenantVo> getLoginTenantInfo();
+
+    /**
      * 获取用户分页列表
      */
     @GetMapping("/getTenantPageList")

+ 17 - 3
edu-travel-service/edu-travel-service-tenement/src/main/java/edu/travel/tenant/web/TenantController.java

@@ -105,10 +105,24 @@ public class TenantController  extends BaseController<EduTenant> implements Tena
      * @return
      */
     @GetMapping("/getTenantById")
-    @PreAuthorize("hasRole('超级管理员')")
-    public BaseResponse<SysRoleVo> getTenantById(Long id) {
+//    @PreAuthorize("hasRole('超级管理员')")
+    public BaseResponse<EduTenantVo> getTenantById(Long id) {
         EduTenant tenant = tenantService.getTenantById(id);
-        SysRoleVo eduTenantVo = BeanUtil.copyProperties(tenant, SysRoleVo.class);
+        EduTenantVo eduTenantVo = BeanUtil.copyProperties(tenant, EduTenantVo.class);
+        return PageResponse.out(200, "success", eduTenantVo);
+    }
+
+    /**
+     * 查询登录用户信息
+     *
+     * @return
+     */
+    @GetMapping("/getLoginTenantInfo")
+//    @PreAuthorize("hasRole('超级管理员')")
+    public BaseResponse<EduTenantVo> getLoginTenantInfo() {
+        EduTenant principal = (EduTenant) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
+        EduTenant tenant = tenantService.getTenantById(principal.getId());
+        EduTenantVo eduTenantVo = BeanUtil.copyProperties(tenant, EduTenantVo.class);
         return PageResponse.out(200, "success", eduTenantVo);
     }