package com.hz.pm.api.user.controller;

import com.hz.pm.api.user.manage.MhUnitManage;
import com.hz.pm.api.user.model.dto.MhUnitTreeDTO;
import com.hz.pm.api.user.model.dto.MhUnitUserTreeDTO;
import com.hz.pm.api.user.model.po.MhUnitListReq;
import com.hz.pm.api.user.model.po.UserTreeReq;
import com.hz.pm.api.user.model.vo.MhUnitListVO;
import com.ningdatech.basic.model.PageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * MhUnitController
 * </p>
 *
 * @author WendyYang
 * @since 15:28 2024/1/10
 */
@Api(tags = "组织管理")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/mh/unit")
public class MhUnitController {

    private final MhUnitManage mhUnitManage;

    @GetMapping("/tree")
    @ApiOperation("单位树")
    public List<MhUnitTreeDTO> getMhUnitTree() {
        return mhUnitManage.getMhUnitTree();
    }

    @GetMapping("/page")
    @ApiOperation("单位列表")
    public PageVo<MhUnitListVO> page(MhUnitListReq req) {
        return mhUnitManage.page(req);
    }

    @GetMapping("/user/tree")
    @ApiOperation("用户组织树")
    public List<MhUnitUserTreeDTO> getUserTree(UserTreeReq req) {
        return mhUnitManage.getUserTree(req);
    }

}
