Files
wwjcloud-nest-v1/wwjcloud/src/common/sys/services/admin/RoleService.ts

77 lines
2.1 KiB
TypeScript
Raw Normal View History

import { Injectable } from '@nestjs/common';
import { CoreRoleService } from '../core/CoreRoleService';
@Injectable()
export class RoleService {
constructor(private readonly coreRoleService: CoreRoleService) {}
/**
2025-09-11 22:06:19 +08:00
* - getPage(siteId, query)
*/
2025-09-11 22:06:19 +08:00
async getPage(siteId: number, query: any) {
return this.coreRoleService.getPage({ ...query, site_id: siteId });
}
/**
2025-09-11 22:06:19 +08:00
*
*/
2025-09-11 22:06:19 +08:00
async getInfo(role_id: number) {
return this.coreRoleService.getInfo(role_id);
}
/**
2025-09-11 22:06:19 +08:00
*
*/
2025-09-11 22:06:19 +08:00
async delete(role_id: number) {
return this.coreRoleService.delete(role_id);
}
/**
2025-09-11 22:06:19 +08:00
*
*/
2025-09-11 22:06:19 +08:00
async getPermissions(role_id: number) {
return this.coreRoleService.getPermissions(role_id);
}
/**
2025-09-11 22:06:19 +08:00
*
*/
2025-09-11 22:06:19 +08:00
async setPermissions(role_id: number, menu_ids: number[]) {
return this.coreRoleService.setPermissions(role_id, menu_ids);
}
/**
2025-09-11 22:06:19 +08:00
*
*/
2025-09-11 22:06:19 +08:00
async getAll(siteId: number, userRoleIds?: number[], isAdmin?: boolean) {
const isAdminNum = isAdmin ? 1 : 0;
return this.coreRoleService.getAll(siteId);
}
2025-09-11 22:06:19 +08:00
async getColumn(siteId: number) {
return this.coreRoleService.getColumn(siteId as any);
}
2025-09-11 22:06:19 +08:00
async modifyStatus(roleId: number, siteId: number, status: number) {
return this.coreRoleService.modifyStatus(roleId as any, siteId as any, status as any);
}
2025-09-11 22:06:19 +08:00
async del(roleId: number, siteId: number) {
return this.coreRoleService.del(roleId as any, siteId as any);
}
2025-09-11 22:06:19 +08:00
async getMenuIdsByRoleIds(siteId: number, roleIds: number[], allowMenuKeys?: string[]) {
return this.coreRoleService.getMenuIdsByRoleIds(siteId as any, roleIds as any);
}
2025-09-11 22:06:19 +08:00
// 控制器契约add(siteId, appType, data)
async add(siteId: number, appType: string, data: any) {
return this.coreRoleService.add({ ...data, site_id: siteId, app_type: appType });
}
2025-09-11 22:06:19 +08:00
// 控制器契约edit(roleId, siteId, data)
async edit(roleId: number, siteId: number, data: any) {
return this.coreRoleService.edit(roleId, siteId, { ...data, site_id: siteId });
}
2025-09-11 22:06:19 +08:00
}