[feat] 完善 NewVirtualResource 方法
This commit is contained in:
parent
6675dca359
commit
a911a305e1
@ -440,17 +440,25 @@ func (this Resource) onUserEvent(builder *db.Builder, user req.User) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewVirtualResource(pRes req.Resource, code, name, sql string, fields []ResField) req.Resource {
|
func NewVirtualResource(pRes req.Resource, code, name, sql string, fields []ResField) req.Resource {
|
||||||
|
fieldsCopy := make([]ResField, len(fields))
|
||||||
|
|
||||||
|
copy(fieldsCopy, fields)
|
||||||
|
|
||||||
|
for i := 0; i < len(fieldsCopy); i++ {
|
||||||
|
fieldsCopy[i].CodeResource = code
|
||||||
|
}
|
||||||
|
|
||||||
return &Resource{
|
return &Resource{
|
||||||
Uuid: code,
|
Uuid: code,
|
||||||
PUuid: pRes.GetUuid(),
|
PUuid: pRes.GetUuid(),
|
||||||
Code: code,
|
Code: code,
|
||||||
Name: name,
|
Name: name,
|
||||||
IsResVirtual: true,
|
IsResVirtual: true,
|
||||||
Table: sql,
|
|
||||||
IsResSystem: pRes.IsSystem(),
|
IsResSystem: pRes.IsSystem(),
|
||||||
|
Table: sql,
|
||||||
IsHistoryRecord: false,
|
IsHistoryRecord: false,
|
||||||
HistoryCacheMax: 0,
|
HistoryCacheMax: 0,
|
||||||
Fields: fields,
|
Fields: fieldsCopy,
|
||||||
Roles: nil,
|
Roles: nil,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user