|
|
@@ -245,7 +245,6 @@ export class SysConfigService {
|
|
|
|
|
|
async getTeamConfig(name: string, userId: number, userRole: UserRole, adminTeamId?: number) {
|
|
|
if (userRole === UserRole.ADMIN) {
|
|
|
- // 管理员查询:如果指定了teamId则查询特定团队,否则查询所有团队
|
|
|
return await this.getSysConfig(name, adminTeamId)
|
|
|
} else {
|
|
|
const teamId = await this.getUserTeamId(userId, userRole)
|
|
|
@@ -255,7 +254,6 @@ export class SysConfigService {
|
|
|
|
|
|
async listTeamConfigs(query: ListTeamConfigQuery, userId: number, userRole: UserRole, adminTeamId?: number) {
|
|
|
if (userRole === UserRole.ADMIN) {
|
|
|
- // 管理员查询:如果指定了teamId则查询特定团队,否则查询所有团队
|
|
|
const { page = 0, size = 20, name, type } = query
|
|
|
return await this.list(page, size, name, type, adminTeamId)
|
|
|
} else {
|
|
|
@@ -264,4 +262,23 @@ export class SysConfigService {
|
|
|
return await this.list(page, size, name, type, teamId)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ async getUserTeamConfigs(userId: number) {
|
|
|
+ let teamId = 0
|
|
|
+ const user = await this.userRepository.findOne({ where: { id: userId } })
|
|
|
+ if (user) {
|
|
|
+ const team = await this.teamRepository.findOne({ where: { userId: user.parentId } })
|
|
|
+ if (team) {
|
|
|
+ teamId = team.id
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const configs = await this.sysConfigRepository.find({
|
|
|
+ where: { teamId },
|
|
|
+ select: ['name', 'value'],
|
|
|
+ order: { id: 'ASC' }
|
|
|
+ })
|
|
|
+
|
|
|
+ return configs
|
|
|
+ }
|
|
|
}
|