@ -446,6 +446,9 @@ export class AuthDeptService {
// DB 修改
private updateDept(id, updateAuthDeptDto: UpdateAuthDeptDto, userId) {
if (id == updateAuthDeptDto.pid) {
throw new HttpException('数据成环,无法设置!', HttpStatus.BAD_REQUEST);
}
return this.mysqlService.db
.update(pacAuthDept)
.set({
@ -173,6 +173,10 @@ export class AuthRoleService {
public async update(roleId: string, updateAuthRoleDto: UpdateAuthRoleDto, guardInfo: GuardInfo) {
if (roleId == updateAuthRoleDto.pid) {
// ! 查找角色信息
const roleData = await this.getRoleForRoleId(roleId);
@ -576,6 +576,9 @@ export class AuthUserService {
// DB 更新账户
private async updateUser(id: string, updateAuthUserDto: UpdateAuthUserDto, guardInfo: GuardInfo) {
if (id == updateAuthUserDto.pid) {
const user = await this.mysqlService.db
.select({ id: pacAuthUser.userId, pid: pacAuthUser.pid })
.from(pacAuthUser)
@ -152,6 +152,10 @@ export class CoreDictService {
throw new HttpException('没有权限修改原始字典!', HttpStatus.UNAUTHORIZED);
if (dictId == updateCoreDictDto.pid) {
// ! 产看目标字典是否存在
const oldDict = await this.getMore(dictId);
if (oldDict.length == 0) throw new HttpException('未找到目标字典,无法修改!', HttpStatus.BAD_REQUEST);
@ -150,6 +150,9 @@ export class CoreEnvService {
if (this.config.get<number>('masterId') != guardInfo.userId && updateCoreEnvDto.root !== undefined) {
if (envId == updateCoreEnvDto.pid) {
// ! 查变量是否存在
const oldEnv = await this.getMore(envId);
@ -115,7 +115,12 @@ export class CoreMenuService {
throw new HttpException('没有权限删除菜单!', HttpStatus.UNAUTHORIZED);
if (id == updateCoreMenuDto.pid) {
// ! 写入数据
return this.updateMenuData(id, updateCoreMenuDto, guardInfo);
public async remove(id: string, guardInfo: GuardInfo) {