[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 {
|
||||
fieldsCopy := make([]ResField, len(fields))
|
||||
|
||||
copy(fieldsCopy, fields)
|
||||
|
||||
for i := 0; i < len(fieldsCopy); i++ {
|
||||
fieldsCopy[i].CodeResource = code
|
||||
}
|
||||
|
||||
return &Resource{
|
||||
Uuid: code,
|
||||
PUuid: pRes.GetUuid(),
|
||||
Code: code,
|
||||
Name: name,
|
||||
IsResVirtual: true,
|
||||
Table: sql,
|
||||
IsResSystem: pRes.IsSystem(),
|
||||
Table: sql,
|
||||
IsHistoryRecord: false,
|
||||
HistoryCacheMax: 0,
|
||||
Fields: fields,
|
||||
Fields: fieldsCopy,
|
||||
Roles: nil,
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user