chore: project userid fixed -1

This commit is contained in:
xiaojunnuo
2026-03-04 23:15:48 +08:00
parent 6c546b5290
commit 17dd77cc96
21 changed files with 97 additions and 72 deletions
@@ -83,7 +83,7 @@ export abstract class BaseController {
let userId = this.getUserId()
const projectId = await this.getProjectId(permission)
if(projectId){
userId = 0
userId = -1 // 企业管理模式下,用户id固定-1
}
return {
projectId,userId
@@ -258,12 +258,12 @@ export abstract class BaseService<T> {
export function checkUserProjectParam(userId: number, projectId: number) {
if (projectId != null ){
if( userId !==0) {
if( userId !==-1) {
throw new ValidateException('userId projectId 错误');
}
return true
}else{
if( userId > 0) {
if( userId != null) {
return true
}
throw new ValidateException('userId不能为空');
@@ -8,7 +8,7 @@ export class AccessEntity {
@PrimaryGeneratedColumn()
id: number;
@Column({ name: 'user_id', comment: '用户id' })
userId: number;
userId: number; // 0为系统级别, -1为企业,大于1为用户
@Column({ comment: '名称', length: 100 })
name: string;
@@ -24,9 +24,6 @@ export class AccessEntity {
@Column({ name: 'project_id', comment: '项目id' })
projectId: number;
@Column({ comment: '权限等级', length: 100 })
level: string; // user common system
@Column({
name: 'create_time',
comment: '创建时间',