[feat] 移除资源 namespace 字段, 新增 isSystem 字段

This commit is contained in:
what 2024-11-25 15:05:06 +08:00
parent 6f5c443c81
commit 6675dca359

View File

@ -45,10 +45,9 @@ type Resource struct {
PUuid string `db:"pUuid"` PUuid string `db:"pUuid"`
Code string `db:"code"` Code string `db:"code"`
Name string `db:"name"` Name string `db:"name"`
IsResSystem bool `db:"isSystem"`
IsResVirtual bool `db:"isVirtual"` IsResVirtual bool `db:"isVirtual"`
Table string `db:"table"` Table string `db:"table"`
Namespace string `db:"namespace"`
Workspace string `db:"workspace"`
Primarykey string `db:"primaryKey"` Primarykey string `db:"primaryKey"`
IsHistoryRecord bool `db:"isHistoryRecord"` IsHistoryRecord bool `db:"isHistoryRecord"`
HistoryCacheMax int `db:"historyCacheMax"` HistoryCacheMax int `db:"historyCacheMax"`
@ -89,7 +88,7 @@ func (this Resource) IsVirtual() bool {
// 是否系统资源 // 是否系统资源
func (this Resource) IsSystem() bool { func (this Resource) IsSystem() bool {
return this.Namespace == "Framework\\Service" return this.IsResSystem
} }
// 资源字段 // 资源字段
@ -440,16 +439,15 @@ func (this Resource) onUserEvent(builder *db.Builder, user req.User) {
}) })
} }
func NewVirtualResource(pRes Resource, code, name, sql string, fields []ResField) req.Resource { func NewVirtualResource(pRes req.Resource, code, name, sql string, fields []ResField) req.Resource {
return &Resource{ return &Resource{
Uuid: code, Uuid: code,
PUuid: pRes.Uuid, PUuid: pRes.GetUuid(),
Code: code, Code: code,
Name: name, Name: name,
IsResVirtual: true, IsResVirtual: true,
Table: sql, Table: sql,
Namespace: pRes.Namespace, IsResSystem: pRes.IsSystem(),
Workspace: pRes.Workspace,
IsHistoryRecord: false, IsHistoryRecord: false,
HistoryCacheMax: 0, HistoryCacheMax: 0,
Fields: fields, Fields: fields,