package com.energy.manage.service.controller.system;

import com.energy.manage.common.reponse.ResultResp;
import com.energy.manage.service.controller.base.BaseServiceController;
import com.energy.manage.service.domain.vo.cockpit.CompanyFieldNumberVo;
import com.energy.manage.service.domain.vo.cockpit.CompanyFieldTreeRoleVo;
import com.energy.manage.service.service.system.SysOrganizationAuthService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author chy
 * @date 2024/5/21 09:33
 * @desc
 */
@Slf4j
@Api(value = "SysOrganizationAuthController", tags = "组织机构权限管理")
@RestController
@RequestMapping("/sysOrganizationAuth")
public class SysOrganizationAuthController extends BaseServiceController {

    @Autowired
    private SysOrganizationAuthService sysOrganizationAuthService;

    @ApiOperation(value = "根据角色查询风场列表")
    @GetMapping("/queryCodeNum")
    public ResultResp queryCodeNunByRoleId() {
        return success(sysOrganizationAuthService.queryCodeNunByRoleId(getRoleId()));
    }


    @ApiOperation(value = "根据角色查询风场树（驾驶仓）")
    @PostMapping("/getSysOrganizationAuthTreeByRoleId")
    public ResultResp<List<Map<String, Object>>> getSysOrganizationAuthTreeByRoleId() {
        return success(sysOrganizationAuthService.getSysOrganizationAuthTreeByRoleId(getRoleId()));
    }


    @ApiOperation(value = "根据角色查询风场集合（驾驶仓）")
    @PostMapping("/getSysOrganizationAuthListByRoleId")
    public ResultResp<List<CompanyFieldTreeRoleVo>> getSysOrganizationAuthListByRoleId() {
        return success(sysOrganizationAuthService.getSysOrganizationAuthListByRoleId(getRoleId()));
    }

    @ApiOperation(value = "驾驶舱统计数量（驾驶仓）")
    @PostMapping("/getCompanyFieldNumberVo")
    public ResultResp<CompanyFieldNumberVo> getCompanyFieldNumberVo() {
        return success(sysOrganizationAuthService.getCompanyFieldNumberVo(getRoleId()));
    }

}
