package com.ruoyi.tc.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.tc.service.UnitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
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;

/**
 * 组织架构
 * @author du
 * @since 2024/12/9 10:42
 */
@Api(tags = "组织架构")
@RestController
@RequestMapping("/tc/schema")
public class DeptSchemaController {

    @Resource
    private UnitService unitService;

    /**
     * 根据资产类型返回组织架构
     */
    @ApiOperation(value = "根据资产类型返回组织架构")
    @GetMapping
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "0:web资产，1:小程序资产，2：公众号资产，3：电子邮件资产，4：移动应用程序资产", required = true),
    })
    public AjaxResult schema(@RequestParam("type") String type) {
        return AjaxResult.success(unitService.getSchema(type));
    }

}
