[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"`
Code string `db:"code"`
Name string `db:"name"`
IsResSystem bool `db:"isSystem"`
IsResVirtual bool `db:"isVirtual"`
Table string `db:"table"`
Namespace string `db:"namespace"`
Workspace string `db:"workspace"`
Primarykey string `db:"primaryKey"`
IsHistoryRecord bool `db:"isHistoryRecord"`
HistoryCacheMax int `db:"historyCacheMax"`
@ -89,7 +88,7 @@ func (this Resource) IsVirtual() 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{
Uuid: code,
PUuid: pRes.Uuid,
PUuid: pRes.GetUuid(),
Code: code,
Name: name,
IsResVirtual: true,
Table: sql,
Namespace: pRes.Namespace,
Workspace: pRes.Workspace,
IsResSystem: pRes.IsSystem(),
IsHistoryRecord: false,
HistoryCacheMax: 0,
Fields: fields,