package cn.com.ty.lift.enterprise.organization.controller;

import cn.com.ty.lift.enterprise.organization.dao.entity.Project;
import cn.com.ty.lift.enterprise.organization.dao.entity.model.OrganizationReq;
import cn.com.ty.lift.enterprise.organization.service.OrganizationService;
import cn.com.xwy.boot.web.dto.RestResponse;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@AllArgsConstructor
@RequestMapping("/organization")
public class OrganizationController {
    private final OrganizationService organizationService;

    /**
     * 查询项目相关人员
     *
     * @param project 项目id
     * @return RestResponse 项目相关人员
     */
    @PostMapping("/user")
    public RestResponse user(@RequestBody Project project) {
        return organizationService.users(project);
    }

    /**
     * 查询维保公司省市区项目列表
     *
     * @param req 维保公司id
     * @return RestResponse 维保公司省市区项目列表
     */
    @PostMapping("/list")
    public RestResponse organizations(@RequestBody OrganizationReq req) {
        return organizationService.organizationTree(req.getMtCompanyId());
    }
}