package com.ytpm.middle.controller;

import com.ytpm.general.Result;
import com.ytpm.general.ResultTable;
import com.ytpm.middle.service.AppService;
import com.ytpm.middle.service.DeptService;
import com.ytpm.middle.service.PermissionService;
import com.ytpm.middle.service.RoleService;
import com.ytpm.middle.view.DropDownVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "前端获取选项模块")
@RestController
@RequestMapping("/dropdown")
public class DropdownController {

    @Resource
    private DeptService deptService;
    @Resource
    private PermissionService permissionService;
    @Resource
    private AppService appService;

    @ApiOperation("查询部门树形菜单")
    @GetMapping("/deptTree")
    public Result<DropDownVO> deptTree() {
        return deptService.getDeptTree();
    }

    @ApiOperation("查询权限下拉列表")
    @GetMapping("/permissionList")
    public ResultTable<DropDownVO> permissionDropList() {
        return permissionService.permissionDropList();
    }

    @ApiOperation("查询上架应用列表")
    @GetMapping("/getIssuedAppList")
    public ResultTable<DropDownVO> getIssuedAppList() {
        return appService.getIssuedAppList();
    }

    @ApiOperation("根据上级应用获取apk包")
    @GetMapping("/getApkList")
    public ResultTable<DropDownVO> getApkList(@RequestParam(name = "appId")String appId) {
        return appService.getApkList(appId);
    }
}
