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);