Commit 7b052407 by guojuxing

新增商户所有菜单接口

parent c8540aa4
package com.gic.auth.web.controller;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.MenuDTO;
import com.gic.auth.dto.UserDTO;
import com.gic.auth.service.MenuApiService;
import com.gic.auth.service.UserApiService;
import com.gic.enterprise.response.EnterpriseRestResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -14,6 +19,9 @@ import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
import javax.xml.ws.Service;
import java.util.List;
@RestController
@RequestMapping("/role")
public class RoleController {
......@@ -22,6 +30,8 @@ public class RoleController {
private RoleApiService roleApiService;
@Autowired
private MenuApiService menuApiService;
@Autowired
private UserApiService userApiService;
@RequestMapping("/get-detail")
public RestResponse getDetail(Integer id) {
......@@ -56,4 +66,22 @@ public class RoleController {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
return ResultControllerUtils.commonResult(roleApiService.listRole(enterpriseId), RoleSelectVO.class);
}
@RequestMapping("/list-menu")
public RestResponse listMenu() {
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
ServiceResponse<UserDTO> userResponse = userApiService.getUserByEnterpriseId(enterpriseId);
if (userResponse.isSuccess()) {
UserDTO admin = userResponse.getResult();
Integer userId = admin.getUserId();
ServiceResponse<List<MenuDTO>> menuResponse = menuApiService.getSuperAdminMenu(userId, enterpriseId);
if (menuResponse.isSuccess()) {
return RestResponse.success(menuResponse.getResult());
} else {
return EnterpriseRestResponse.failure(menuResponse);
}
} else {
return EnterpriseRestResponse.failure(userResponse);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment