From 30b884a3f5c4ad6e0ab289cec14f09014b8f5cf3 Mon Sep 17 00:00:00 2001 From: expressgy Date: Fri, 12 Jul 2024 18:11:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=A0=E6=AD=A3=E9=83=A8=E9=97=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/application/auth-dept/auth-dept.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/application/auth-dept/auth-dept.service.ts b/src/application/auth-dept/auth-dept.service.ts index 6aac690..017af3d 100644 --- a/src/application/auth-dept/auth-dept.service.ts +++ b/src/application/auth-dept/auth-dept.service.ts @@ -156,12 +156,12 @@ export class AuthDeptService { const dept = await this.getDeptForDeptId(id); // ? 不存在部门? - if (dept.length > 0) throw new HttpException('未找到目标部门信息,无法修改!', HttpStatus.BAD_REQUEST); + if (dept.length === 0) throw new HttpException('未找到目标部门信息,无法修改!', HttpStatus.BAD_REQUEST); const pid = dept[0].pid; // ! 加目标锁,同级,而不是全局 - const lock = await this.redisService.distributedLock('DEPT' + updateAuthDeptDto.pid + '-' + updateAuthDeptDto.deptName, updateAuthDeptDto.deptName); + const lock = await this.redisService.distributedLock('DEPT' + pid + '-' + updateAuthDeptDto.deptName, updateAuthDeptDto.deptName); // ? 存在正在进行写入的部门 if (!lock) throw new HttpException('服务繁忙,部门名称重复!', HttpStatus.CONFLICT);