feat: implement new structure

This commit is contained in:
2025-12-29 09:30:49 +08:00
parent 503b15aab7
commit ad52371028
116 changed files with 17579 additions and 1213 deletions

View File

@@ -8,8 +8,6 @@ import (
"context"
"time"
"quyun/v2/pkg/consts"
"go.ipao.vip/gen"
)
@@ -17,16 +15,16 @@ const TableNameTenantJoinRequest = "tenant_join_requests"
// TenantJoinRequest mapped from table <tenant_join_requests>
type TenantJoinRequest struct {
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true;comment:主键ID自增" json:"id"` // 主键ID自增
TenantID int64 `gorm:"column:tenant_id;type:bigint;not null;comment:租户ID多租户隔离关键字段所有查询/写入必须限定 tenant_id" json:"tenant_id"` // 租户ID多租户隔离关键字段所有查询/写入必须限定 tenant_id
UserID int64 `gorm:"column:user_id;type:bigint;not null;comment:申请人用户ID发起加入申请的用户" json:"user_id"` // 申请人用户ID发起加入申请的用户
Status consts.TenantJoinRequestStatus `gorm:"column:status;type:character varying(32);not null;default:pending;comment:申请状态pending/approved/rejected状态变更需记录 decided_at 与 decided_operator_user_id" json:"status"` // 申请状态pending/approved/rejected状态变更需记录 decided_at 与 decided_operator_user_id
Reason string `gorm:"column:reason;type:character varying(255);not null;comment:申请原因:用户填写的加入说明(可选)" json:"reason"` // 申请原因:用户填写的加入说明(可选)
DecidedAt time.Time `gorm:"column:decided_at;type:timestamp with time zone;comment:处理时间:审核通过/拒绝时记录UTC" json:"decided_at"` // 处理时间:审核通过/拒绝时记录UTC
DecidedOperatorUserID int64 `gorm:"column:decided_operator_user_id;type:bigint;comment:处理人用户ID租户管理员审计用" json:"decided_operator_user_id"` // 处理人用户ID租户管理员审计用
DecidedReason string `gorm:"column:decided_reason;type:character varying(255);not null;comment:处理说明:管理员通过/拒绝的原因(可选,审计用)" json:"decided_reason"` // 处理说明:管理员通过/拒绝的原因(可选,审计用)
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;not null;default:now();comment:创建时间:默认 now()" json:"created_at"` // 创建时间:默认 now()
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp with time zone;not null;default:now();comment:更新时间:默认 now()" json:"updated_at"` // 更新时间:默认 now()
ID int64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement:true" json:"id"`
TenantID int64 `gorm:"column:tenant_id;type:bigint;not null" json:"tenant_id"`
UserID int64 `gorm:"column:user_id;type:bigint;not null" json:"user_id"`
Status string `gorm:"column:status;type:character varying(32);default:pending" json:"status"`
Reason string `gorm:"column:reason;type:character varying(255);not null" json:"reason"`
DecidedAt time.Time `gorm:"column:decided_at;type:timestamp with time zone" json:"decided_at"`
DecidedOperatorUserID int64 `gorm:"column:decided_operator_user_id;type:bigint" json:"decided_operator_user_id"`
DecidedReason string `gorm:"column:decided_reason;type:character varying(255)" json:"decided_reason"`
CreatedAt time.Time `gorm:"column:created_at;type:timestamp with time zone;default:now()" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp with time zone;default:now()" json:"updated_at"`
}
// Quick operations without importing query package