package com.tofly.watermeter.custom.controller.meterBusiness;

import com.tofly.api.DepartmentClient;
import com.tofly.common.core.entity.ResultRespone;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author FlashWJL
 * @date 2021/4/7 11:05
 */
@RestController
@AllArgsConstructor
@RequestMapping("/dept")
@Api(tags = "获取部门信息")
public class DeptController {

    private final DepartmentClient departmentClient;

    @GetMapping("/getDeptById/{id}")
    @ApiOperation(value = "根据ID查询部门信息")
    public ResultRespone getDeptById(@PathVariable("id") Long id){
        return departmentClient.getById(id);
    }
    @GetMapping("/getAll")
    @ApiOperation(value = "查询所有部门")
    public ResultRespone getAll(){
        return departmentClient.departmentListAll();
    }

    @GetMapping("/getUserByDepts")
    @ApiOperation(value = "根据部门id查询所属部门的用户")
    public ResultRespone getUserByDepts(String depts){
        return departmentClient.getUserByDepts(depts);
    }


}
