package cn.iocoder.yudao.module.wxcp.controller.admin.member; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.wxcp.controller.admin.member.vo.WxCpDepartmentRespVO; import cn.iocoder.yudao.module.wxcp.controller.admin.member.vo.WxCpMemberRespVO; import cn.iocoder.yudao.module.wxcp.service.member.WxCpMemberService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.annotation.Resource; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; /** * 管理后台 - 企业微信通讯录(成员与部门) * * 数据实时取自企业微信,可用于推送时挑选目标成员/部门 * * @author 超级管理员 */ @Tag(name = "管理后台 - 企业微信通讯录") @RestController @RequestMapping("/wxcp/member") @Validated public class WxCpMemberController { @Resource private WxCpMemberService memberService; @GetMapping("/department/tree") @Operation(summary = "获得部门树") @PreAuthorize("@ss.hasPermission('wxcp:member:query')") public CommonResult> getDepartmentTree() { return success(memberService.getDepartmentTree()); } @GetMapping("/department/list") @Operation(summary = "获得部门平铺列表", description = "便于做下拉选择,无需自行拍平树") @PreAuthorize("@ss.hasPermission('wxcp:member:query')") public CommonResult> getDepartmentList() { return success(memberService.getDepartmentList()); } @GetMapping("/list") @Operation(summary = "获得成员列表") @Parameter(name = "departmentId", description = "部门ID,不传取根部门") @Parameter(name = "fetchChild", description = "是否包含子部门成员,默认 true") @PreAuthorize("@ss.hasPermission('wxcp:member:query')") public CommonResult> getMemberList( @RequestParam(value = "departmentId", required = false) Long departmentId, @RequestParam(value = "fetchChild", required = false) Boolean fetchChild) { return success(memberService.getMemberList(departmentId, fetchChild)); } }