import { request } from '@/utils/request' /** * 用户岗位关联服务 */ class UserPostService { private baseUrl = '/user/admin/user-post' /** * 查询用户已分配的岗位ID列表 */ async listPostIdsByUserId(userId: number | string): Promise { const res: any = await request({ url: `${this.baseUrl}/user/${userId}`, method: 'get', }) return res.data || [] } /** * 分配用户岗位 */ async assignPosts(userId: number | string, postIds: number[]): Promise { const res: any = await request({ url: `${this.baseUrl}/user/${userId}`, method: 'post', data: postIds, }) return res.data === true } } /** 用户岗位关联服务单例 */ export const userPostService = new UserPostService()