|
|
@ -9,7 +9,7 @@ import { ConfigService } from '@nestjs/config'; |
|
|
|
import { pacAuthUser, pacCoreDict, pacCoreEnv, pacCoreService } from '@entities/schema'; |
|
|
|
import { pacAuthUser, pacCoreDict, pacCoreEnv, pacCoreService } from '@entities/schema'; |
|
|
|
import { and, asc, desc, eq, isNull, like, or, sql } from 'drizzle-orm'; |
|
|
|
import { and, asc, desc, eq, isNull, like, or, sql } from 'drizzle-orm'; |
|
|
|
import { isExistKey, isTrueEnum } from '@utils/boolean.enum'; |
|
|
|
import { isExistKey, isTrueEnum } from '@utils/boolean.enum'; |
|
|
|
import { CoreEnvIdDTO, CoreEnvKeyDTO, CoreEnvTargetListDTO, GetCoreEnvDTO } from '@app/core-env/dto/get-core-env.dto'; |
|
|
|
import { CoreEnvKeyDTO, CoreEnvTargetListDTO, GetCoreEnvDTO } from '@app/core-env/dto/get-core-env.dto'; |
|
|
|
import { likeQuery } from '@utils/likeQuery'; |
|
|
|
import { likeQuery } from '@utils/likeQuery'; |
|
|
|
import { QueryBuilder } from 'drizzle-orm/mysql-core'; |
|
|
|
import { QueryBuilder } from 'drizzle-orm/mysql-core'; |
|
|
|
import { customDrizzleRowWithRecursive } from '@utils/customDrizzleRowWithRecursive'; |
|
|
|
import { customDrizzleRowWithRecursive } from '@utils/customDrizzleRowWithRecursive'; |
|
|
@ -28,10 +28,10 @@ export class CoreEnvService { |
|
|
|
envDictName: pacCoreDict.dictName, |
|
|
|
envDictName: pacCoreDict.dictName, |
|
|
|
valIsDict: pacCoreEnv.valIsDict, |
|
|
|
valIsDict: pacCoreEnv.valIsDict, |
|
|
|
haveChildren: pacCoreEnv.haveChildren, |
|
|
|
haveChildren: pacCoreEnv.haveChildren, |
|
|
|
ownOfPac: pacCoreEnv.ownOfPac, |
|
|
|
root: pacCoreEnv.root, |
|
|
|
orderNum: pacCoreEnv.orderNum, |
|
|
|
orderNum: pacCoreEnv.orderNum, |
|
|
|
status: pacCoreEnv.status, |
|
|
|
status: pacCoreEnv.status, |
|
|
|
serviceOf: pacCoreEnv.serviceOf, |
|
|
|
serviceKey: pacCoreEnv.serviceKey, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// # 环境变量列表信息
|
|
|
|
// # 环境变量列表信息
|
|
|
@ -46,10 +46,10 @@ export class CoreEnvService { |
|
|
|
valIsDict: pacCoreEnv.valIsDict, |
|
|
|
valIsDict: pacCoreEnv.valIsDict, |
|
|
|
envDesc: pacCoreEnv.envDesc, |
|
|
|
envDesc: pacCoreEnv.envDesc, |
|
|
|
haveChildren: pacCoreEnv.haveChildren, |
|
|
|
haveChildren: pacCoreEnv.haveChildren, |
|
|
|
ownOfPac: pacCoreEnv.ownOfPac, |
|
|
|
root: pacCoreEnv.root, |
|
|
|
orderNum: pacCoreEnv.orderNum, |
|
|
|
orderNum: pacCoreEnv.orderNum, |
|
|
|
status: pacCoreEnv.status, |
|
|
|
status: pacCoreEnv.status, |
|
|
|
serviceOf: pacCoreEnv.serviceOf, |
|
|
|
serviceKey: pacCoreEnv.serviceKey, |
|
|
|
serviceName: pacCoreService.serviceName, |
|
|
|
serviceName: pacCoreService.serviceName, |
|
|
|
createby: pacCoreEnv.createby, |
|
|
|
createby: pacCoreEnv.createby, |
|
|
|
createName: pacAuthUser.nickname, |
|
|
|
createName: pacAuthUser.nickname, |
|
|
@ -70,7 +70,12 @@ export class CoreEnvService { |
|
|
|
* DESC: 创建环境变量内容 |
|
|
|
* DESC: 创建环境变量内容 |
|
|
|
* DATE: 2024-06-05 11:48:04 - |
|
|
|
* DATE: 2024-06-05 11:48:04 - |
|
|
|
* */ |
|
|
|
* */ |
|
|
|
public async create(createCoreEnvDto: CreateCoreEnvDto, userInfo) { |
|
|
|
public async create(createCoreEnvDto: CreateCoreEnvDto, pacInfo: PacInfoType) { |
|
|
|
|
|
|
|
// ! 判断是否是root账户,非root账户无法设置为root
|
|
|
|
|
|
|
|
if (this.config.get<number>('masterId') !== pacInfo.userId && isTrueEnum(createCoreEnvDto.root)) { |
|
|
|
|
|
|
|
throw new HttpException('没有权限创建原始变量!', HttpStatus.UNAUTHORIZED); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ! 加目标锁
|
|
|
|
// ! 加目标锁
|
|
|
|
const lock = await this.redisService.distributedLock('ENV' + createCoreEnvDto.envKey, createCoreEnvDto.envKey); |
|
|
|
const lock = await this.redisService.distributedLock('ENV' + createCoreEnvDto.envKey, createCoreEnvDto.envKey); |
|
|
|
|
|
|
|
|
|
|
@ -86,7 +91,7 @@ export class CoreEnvService { |
|
|
|
if (result.length > 0) throw new HttpException('环境变量标识重复!', HttpStatus.CONFLICT); |
|
|
|
if (result.length > 0) throw new HttpException('环境变量标识重复!', HttpStatus.CONFLICT); |
|
|
|
|
|
|
|
|
|
|
|
// ! 添加环境变量数据
|
|
|
|
// ! 添加环境变量数据
|
|
|
|
const newPacCoreEnv = await this.addEnvData(createCoreEnvDto, userInfo); |
|
|
|
const newPacCoreEnv = await this.addEnvData(createCoreEnvDto, pacInfo); |
|
|
|
|
|
|
|
|
|
|
|
// ! 解锁
|
|
|
|
// ! 解锁
|
|
|
|
lock(); |
|
|
|
lock(); |
|
|
@ -126,8 +131,8 @@ export class CoreEnvService { |
|
|
|
* DESC: 查找环境变量项详细信息 |
|
|
|
* DESC: 查找环境变量项详细信息 |
|
|
|
* DATE: 2024-06-05 14:58:44 - |
|
|
|
* DATE: 2024-06-05 14:58:44 - |
|
|
|
* */ |
|
|
|
* */ |
|
|
|
public async findOne(coreEnvIdDTO: CoreEnvIdDTO) { |
|
|
|
public async findOne(envId: string) { |
|
|
|
return (await this.getMore(coreEnvIdDTO.envId))[0]; |
|
|
|
return (await this.getMore(envId))[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** Service |
|
|
|
/** Service |
|
|
@ -140,7 +145,23 @@ export class CoreEnvService { |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async update(coreEnvIdDTO: CoreEnvIdDTO, updateCoreEnvDto: UpdateCoreEnvDto, pacInfo: PacInfoType) { |
|
|
|
public async update(envId: string, updateCoreEnvDto: UpdateCoreEnvDto, pacInfo: PacInfoType) { |
|
|
|
|
|
|
|
// ! 判断是否是root账户,非root账户无法设置为root
|
|
|
|
|
|
|
|
if (this.config.get<number>('masterId') !== pacInfo.userId && updateCoreEnvDto.root !== undefined) { |
|
|
|
|
|
|
|
throw new HttpException('没有权限修改原始字典!', HttpStatus.UNAUTHORIZED); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ! 查变量是否存在
|
|
|
|
|
|
|
|
const oldEnv = await this.getMore(envId); |
|
|
|
|
|
|
|
if (oldEnv.length == 0) { |
|
|
|
|
|
|
|
throw new HttpException('未找到目标变量,无法修改!', HttpStatus.BAD_REQUEST); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ! root数据,非root用户不允许修改
|
|
|
|
|
|
|
|
if (oldEnv[0].root && this.config.get<number>('masterId') !== pacInfo.userId) { |
|
|
|
|
|
|
|
throw new HttpException('原始变量,权限不足无法修改!', HttpStatus.BAD_REQUEST); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ! 上锁
|
|
|
|
// ! 上锁
|
|
|
|
const lock = await this.redisService.distributedLock('ENV' + updateCoreEnvDto.envKey, updateCoreEnvDto.envKey); |
|
|
|
const lock = await this.redisService.distributedLock('ENV' + updateCoreEnvDto.envKey, updateCoreEnvDto.envKey); |
|
|
|
|
|
|
|
|
|
|
@ -153,12 +174,12 @@ export class CoreEnvService { |
|
|
|
const checkRepeat = await this.getEnvForEnvKey(updateCoreEnvDto.envKey); |
|
|
|
const checkRepeat = await this.getEnvForEnvKey(updateCoreEnvDto.envKey); |
|
|
|
|
|
|
|
|
|
|
|
// ? 判断是否存在重名的环境变量,但是不包括自己
|
|
|
|
// ? 判断是否存在重名的环境变量,但是不包括自己
|
|
|
|
if (checkRepeat.length > 0 && checkRepeat[0].envId != coreEnvIdDTO.envId) { |
|
|
|
if (checkRepeat.length > 0 && checkRepeat[0].envId != envId) { |
|
|
|
throw new HttpException('环境变量标识重复!', HttpStatus.CONFLICT); |
|
|
|
throw new HttpException('环境变量标识重复!', HttpStatus.CONFLICT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ! 更新数据
|
|
|
|
// ! 更新数据
|
|
|
|
const result = await this.updateEnvData(coreEnvIdDTO, updateCoreEnvDto, pacInfo); |
|
|
|
const result = await this.updateEnvData(envId, updateCoreEnvDto, pacInfo); |
|
|
|
|
|
|
|
|
|
|
|
// ! 解锁
|
|
|
|
// ! 解锁
|
|
|
|
lock(); |
|
|
|
lock(); |
|
|
@ -179,18 +200,23 @@ export class CoreEnvService { |
|
|
|
* DESC: 删除环境变量 |
|
|
|
* DESC: 删除环境变量 |
|
|
|
* DATE: 2024-06-05 17:17:28 - |
|
|
|
* DATE: 2024-06-05 17:17:28 - |
|
|
|
* */ |
|
|
|
* */ |
|
|
|
public async remove(coreEnvIdDTO: CoreEnvIdDTO, pacInfo: PacInfoType) { |
|
|
|
public async remove(envId: string, pacInfo: PacInfoType) { |
|
|
|
// ! 查看目标环境变量
|
|
|
|
// ! 查看目标环境变量
|
|
|
|
const result = await this.getMore(coreEnvIdDTO.envId); |
|
|
|
const result = await this.getMore(envId); |
|
|
|
|
|
|
|
|
|
|
|
// ? 判断是否存在
|
|
|
|
// ? 判断是否存在
|
|
|
|
if (result.length > 0) { |
|
|
|
if (result.length > 0) { |
|
|
|
|
|
|
|
// ! root数据,非root用户不允许删除
|
|
|
|
|
|
|
|
if (result[0].root && this.config.get<number>('masterId') !== pacInfo.userId) { |
|
|
|
|
|
|
|
throw new HttpException('原始变量,权限不足无法删除!', HttpStatus.BAD_REQUEST); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ! 存在目标环境变量
|
|
|
|
// ! 存在目标环境变量
|
|
|
|
|
|
|
|
|
|
|
|
// ? 判断是否存在子项
|
|
|
|
// ? 判断是否存在子项
|
|
|
|
if (result[0].haveChildren == 0) { |
|
|
|
if (result[0].haveChildren == 0) { |
|
|
|
// ! 删除目标环境变量
|
|
|
|
// ! 删除目标环境变量
|
|
|
|
await this.deleteEnvItem(coreEnvIdDTO, pacInfo); |
|
|
|
await this.deleteEnvItem(envId, pacInfo); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
throw new HttpException('目标环境变量存在子项!', HttpStatus.BAD_REQUEST); |
|
|
|
throw new HttpException('目标环境变量存在子项!', HttpStatus.BAD_REQUEST); |
|
|
|
} |
|
|
|
} |
|
|
@ -217,9 +243,6 @@ export class CoreEnvService { |
|
|
|
// ! 生成雪花id,用于环境变量主键
|
|
|
|
// ! 生成雪花id,用于环境变量主键
|
|
|
|
const id = await this.snowflake.generate(); |
|
|
|
const id = await this.snowflake.generate(); |
|
|
|
|
|
|
|
|
|
|
|
// ? 判断身份是否是pac,如果是pac才能写入
|
|
|
|
|
|
|
|
const isPac = this.config.get<number>('masterId') == userInfo.userId && isTrueEnum(createCoreEnvDto.ownOfPac); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ! 定义即将写入的环境变量数据
|
|
|
|
// ! 定义即将写入的环境变量数据
|
|
|
|
const newEnvData = { |
|
|
|
const newEnvData = { |
|
|
|
envId: id, |
|
|
|
envId: id, |
|
|
@ -229,9 +252,9 @@ export class CoreEnvService { |
|
|
|
envVal: createCoreEnvDto.envVal, |
|
|
|
envVal: createCoreEnvDto.envVal, |
|
|
|
valIsDict: isTrueEnum(createCoreEnvDto.valIsDict) ? 1 : 0, |
|
|
|
valIsDict: isTrueEnum(createCoreEnvDto.valIsDict) ? 1 : 0, |
|
|
|
envDesc: createCoreEnvDto.envDesc, |
|
|
|
envDesc: createCoreEnvDto.envDesc, |
|
|
|
ownOfPac: isPac ? 0 : 1, |
|
|
|
root: isTrueEnum(createCoreEnvDto.root) ? 1 : 0, |
|
|
|
orderNum: createCoreEnvDto.orderNum, |
|
|
|
orderNum: createCoreEnvDto.orderNum, |
|
|
|
serviceOf: createCoreEnvDto.serviceOf, |
|
|
|
serviceKey: createCoreEnvDto.serviceKey, |
|
|
|
createby: userInfo.userId, |
|
|
|
createby: userInfo.userId, |
|
|
|
createtime: sql`now()`, |
|
|
|
createtime: sql`now()`, |
|
|
|
}; |
|
|
|
}; |
|
|
@ -252,8 +275,6 @@ export class CoreEnvService { |
|
|
|
|
|
|
|
|
|
|
|
// DB 查Env项的查询函数QueryBuilder,作用于列表和分页查询
|
|
|
|
// DB 查Env项的查询函数QueryBuilder,作用于列表和分页查询
|
|
|
|
private getEnv(data, selectData = undefined) { |
|
|
|
private getEnv(data, selectData = undefined) { |
|
|
|
this.logger.info(JSON.stringify(data, null, 2)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ! 定义基础查询函数
|
|
|
|
// ! 定义基础查询函数
|
|
|
|
// 启用动态查询模式 $dynamic
|
|
|
|
// 启用动态查询模式 $dynamic
|
|
|
|
const query = this.mysqlService.db |
|
|
|
const query = this.mysqlService.db |
|
|
@ -289,13 +310,13 @@ export class CoreEnvService { |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// ? 是否查pac的数据
|
|
|
|
// ? 是否查pac的数据
|
|
|
|
wl.push(eq(pacCoreEnv.ownOfPac, isTrueEnum(data['ownOfPac']) ? 0 : 1).if(isExistKey(data, 'ownOfPac') && isTrueEnum(data['ownOfPac']))); |
|
|
|
wl.push(eq(pacCoreEnv.root, isTrueEnum(data['root']) ? 0 : 1).if(isExistKey(data, 'root') && isTrueEnum(data['root']))); |
|
|
|
|
|
|
|
|
|
|
|
// ? 按照层级查
|
|
|
|
// ? 按照层级查
|
|
|
|
wl.push(eq(pacCoreEnv.pid, data.hierarchy).if(isExistKey(data, 'hierarchy'))); |
|
|
|
wl.push(eq(pacCoreEnv.pid, data.hierarchy).if(isExistKey(data, 'hierarchy'))); |
|
|
|
|
|
|
|
|
|
|
|
// ? 是否存在目标service
|
|
|
|
// ? 是否存在目标service
|
|
|
|
wl.push(eq(pacCoreEnv.serviceOf, data.serviceOf).if(isExistKey(data, 'serviceOf'))); |
|
|
|
wl.push(eq(pacCoreEnv.serviceKey, data.serviceKey).if(isExistKey(data, 'serviceKey'))); |
|
|
|
|
|
|
|
|
|
|
|
// ? 是否查环境变量状态
|
|
|
|
// ? 是否查环境变量状态
|
|
|
|
wl.push(eq(pacCoreEnv.status, data.status).if(isExistKey(data, 'status'))); |
|
|
|
wl.push(eq(pacCoreEnv.status, data.status).if(isExistKey(data, 'status'))); |
|
|
@ -321,7 +342,7 @@ export class CoreEnvService { |
|
|
|
// 使用基础查询构建分页查询
|
|
|
|
// 使用基础查询构建分页查询
|
|
|
|
const paginatedQuery = this.getEnv(getCoreEnvDTO, this.envMoreDataType) |
|
|
|
const paginatedQuery = this.getEnv(getCoreEnvDTO, this.envMoreDataType) |
|
|
|
.leftJoin(pacAuthUser, eq(pacCoreEnv.createby, pacAuthUser.userId)) |
|
|
|
.leftJoin(pacAuthUser, eq(pacCoreEnv.createby, pacAuthUser.userId)) |
|
|
|
.leftJoin(pacCoreService, eq(pacCoreEnv.serviceOf, pacCoreService.serviceKey)) |
|
|
|
.leftJoin(pacCoreService, eq(pacCoreEnv.serviceKey, pacCoreService.serviceKey)) |
|
|
|
.limit(getCoreEnvDTO.pageSize) |
|
|
|
.limit(getCoreEnvDTO.pageSize) |
|
|
|
.offset(offset); |
|
|
|
.offset(offset); |
|
|
|
|
|
|
|
|
|
|
@ -338,7 +359,7 @@ export class CoreEnvService { |
|
|
|
.select(this.envMoreDataType) |
|
|
|
.select(this.envMoreDataType) |
|
|
|
.from(pacCoreEnv) |
|
|
|
.from(pacCoreEnv) |
|
|
|
.leftJoin(pacAuthUser, eq(pacCoreEnv.createby, pacAuthUser.userId)) |
|
|
|
.leftJoin(pacAuthUser, eq(pacCoreEnv.createby, pacAuthUser.userId)) |
|
|
|
.leftJoin(pacCoreService, eq(pacCoreEnv.serviceOf, pacCoreService.serviceKey)) |
|
|
|
.leftJoin(pacCoreService, eq(pacCoreEnv.serviceKey, pacCoreService.serviceKey)) |
|
|
|
.leftJoin(pacCoreDict, and(eq(pacCoreDict.dictId, pacCoreEnv.envVal), eq(pacCoreEnv.valIsDict, 1))) |
|
|
|
.leftJoin(pacCoreDict, and(eq(pacCoreDict.dictId, pacCoreEnv.envVal), eq(pacCoreEnv.valIsDict, 1))) |
|
|
|
.where(and(eq(pacCoreEnv.envId, envId), isNull(pacCoreEnv.deleteby))); |
|
|
|
.where(and(eq(pacCoreEnv.envId, envId), isNull(pacCoreEnv.deleteby))); |
|
|
|
} |
|
|
|
} |
|
|
@ -382,27 +403,25 @@ export class CoreEnvService { |
|
|
|
.select(this.envMoreDataType) |
|
|
|
.select(this.envMoreDataType) |
|
|
|
.from(pacCoreEnv) |
|
|
|
.from(pacCoreEnv) |
|
|
|
.leftJoin(pacAuthUser, eq(pacCoreEnv.createby, pacAuthUser.userId)) |
|
|
|
.leftJoin(pacAuthUser, eq(pacCoreEnv.createby, pacAuthUser.userId)) |
|
|
|
.leftJoin(pacCoreService, eq(pacCoreEnv.serviceOf, pacCoreService.serviceKey)) |
|
|
|
.leftJoin(pacCoreService, eq(pacCoreEnv.serviceKey, pacCoreService.serviceKey)) |
|
|
|
.leftJoin(pacCoreDict, and(eq(pacCoreDict.dictId, pacCoreEnv.envVal), eq(pacCoreEnv.valIsDict, 1))) |
|
|
|
.leftJoin(pacCoreDict, and(eq(pacCoreDict.dictId, pacCoreEnv.envVal), eq(pacCoreEnv.valIsDict, 1))) |
|
|
|
.where(and(eq(pacCoreEnv.envKey, coreEnvKeyDTO.envKey), isNull(pacCoreEnv.deleteby))); |
|
|
|
.where(and(eq(pacCoreEnv.envKey, coreEnvKeyDTO.envKey), isNull(pacCoreEnv.deleteby))); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// DB 通过ID删除Env
|
|
|
|
// DB 通过ID删除Env
|
|
|
|
private deleteEnvItem(coreEnvIdDTO: CoreEnvIdDTO, pacInfo: PacInfoType) { |
|
|
|
private deleteEnvItem(envId: string, pacInfo: PacInfoType) { |
|
|
|
return this.mysqlService.db |
|
|
|
return this.mysqlService.db |
|
|
|
.update(pacCoreEnv) |
|
|
|
.update(pacCoreEnv) |
|
|
|
.set({ |
|
|
|
.set({ |
|
|
|
deletetime: sql`now()`, |
|
|
|
deletetime: sql`now()`, |
|
|
|
deleteby: pacInfo.userId, |
|
|
|
deleteby: pacInfo.userId, |
|
|
|
}) |
|
|
|
}) |
|
|
|
.where(eq(pacCoreEnv.envId, coreEnvIdDTO.envId)); |
|
|
|
.where(eq(pacCoreEnv.envId, envId)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// DB 更新Env
|
|
|
|
// DB 更新Env
|
|
|
|
private updateEnvData(coreEnvIdDTO: CoreEnvIdDTO, updateCoreEnvDto: UpdateCoreEnvDto, pacInfo: PacInfoType) { |
|
|
|
private updateEnvData(envId: string, updateCoreEnvDto: UpdateCoreEnvDto, pacInfo: PacInfoType) { |
|
|
|
// ? 判断身份是否是pac,如果是pac才能写入
|
|
|
|
|
|
|
|
const isPac = this.config.get<number>('masterId') == pacInfo.userId && isTrueEnum(updateCoreEnvDto.ownOfPac); |
|
|
|
|
|
|
|
return this.mysqlService.db |
|
|
|
return this.mysqlService.db |
|
|
|
.update(pacCoreEnv) |
|
|
|
.update(pacCoreEnv) |
|
|
|
.set({ |
|
|
|
.set({ |
|
|
@ -411,13 +430,13 @@ export class CoreEnvService { |
|
|
|
envVal: updateCoreEnvDto.envVal, |
|
|
|
envVal: updateCoreEnvDto.envVal, |
|
|
|
valIsDict: isTrueEnum(updateCoreEnvDto.valIsDict) ? 1 : 0, |
|
|
|
valIsDict: isTrueEnum(updateCoreEnvDto.valIsDict) ? 1 : 0, |
|
|
|
envDesc: updateCoreEnvDto.envDesc, |
|
|
|
envDesc: updateCoreEnvDto.envDesc, |
|
|
|
ownOfPac: isPac ? 0 : 1, |
|
|
|
root: isTrueEnum(updateCoreEnvDto.root) ? 1 : 0, |
|
|
|
orderNum: updateCoreEnvDto.orderNum, |
|
|
|
orderNum: updateCoreEnvDto.orderNum, |
|
|
|
status: updateCoreEnvDto.status, |
|
|
|
status: updateCoreEnvDto.status, |
|
|
|
serviceOf: updateCoreEnvDto.serviceOf, |
|
|
|
serviceKey: updateCoreEnvDto.serviceKey, |
|
|
|
updateby: pacInfo.userId, |
|
|
|
updateby: pacInfo.userId, |
|
|
|
updatetime: sql`now()`, |
|
|
|
updatetime: sql`now()`, |
|
|
|
}) |
|
|
|
}) |
|
|
|
.where(eq(pacCoreEnv.envId, coreEnvIdDTO.envId)); |
|
|
|
.where(eq(pacCoreEnv.envId, envId)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|