package com.iailab.module.system.api.dept; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.util.collection.CollectionUtils; import com.iailab.module.system.api.dept.dto.DeptRespDTO; import com.iailab.module.system.enums.ApiConstants; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Set; @FeignClient(name = ApiConstants.NAME) @Tag(name = "RPC 服务 - 部门") public interface DeptApi { String PREFIX = ApiConstants.PREFIX + "/dept"; @GetMapping(PREFIX + "/get") @Operation(summary = "获得部门信息") @Parameter(name = "id", description = "部门编号", example = "1024", required = true) CommonResult getDept(@RequestParam("id") Long id); @GetMapping(PREFIX + "/list") @Operation(summary = "获得部门信息数组") @Parameter(name = "ids", description = "部门编号数组", example = "1,2", required = true) CommonResult> getDeptList(@RequestParam("ids") Collection ids); @GetMapping(PREFIX + "/valid") @Operation(summary = "校验部门是否合法") @Parameter(name = "ids", description = "部门编号数组", example = "1,2", required = true) CommonResult validateDeptList(@RequestParam("ids") Collection ids); /** * 获得指定编号的部门 Map * * @param ids 部门编号数组 * @return 部门 Map */ default Map getDeptMap(Collection ids) { List list = getDeptList(ids).getCheckedData(); return CollectionUtils.convertMap(list, DeptRespDTO::getId); } @GetMapping(PREFIX + "/list-child") @Operation(summary = "获得指定部门的所有子部门") @Parameter(name = "id", description = "部门编号", example = "1024", required = true) CommonResult> getChildDeptList(@RequestParam("id") Long id); }