diff --git a/base/resource.go b/base/resource.go index 7cf9944..40593c0 100644 --- a/base/resource.go +++ b/base/resource.go @@ -10,6 +10,7 @@ import ( "github.com/samber/do" "github.com/samber/lo" + "git.fsdpf.net/go/condition" "git.fsdpf.net/go/contracts" "git.fsdpf.net/go/db" "git.fsdpf.net/go/req" @@ -247,12 +248,12 @@ func (this Resource) WithRolesCondition(b *db.Builder, t string, u req.User) err join := NewOrmJoin(contracts.RelationType(joins[i].Type), oResource, joins[i].Code, joins[i].RelationResource, joins[i].RelationField, joins[i].RelationForeignKey) // 关联扩展条件 - join.SetCondition(GetOrmConditions(joins[i].Uuid, "关联扩展条件")) + join.SetCondition(GetOrmConditions(joins[i].Uuid, condition.Describe("关联扩展条件"))) join.Inject(db, NewOrmModel(rResource, rResource.GetCode(), rResource.GetName())) } - conditions := GetOrmConditions(item.Uuid, "关联扩展条件") + conditions := GetOrmConditions(item.Uuid, condition.Describe("关联扩展条件")) if len(joins) == 0 && conditions.IsEmpty() { // 无权限, 直接跳过这个 unoin 语句 diff --git a/orm.go b/orm.go index 8ede30a..d43cd9c 100644 --- a/orm.go +++ b/orm.go @@ -139,4 +139,4 @@ type NewOrmModel func(res req.Resource, code, name string) Model type NewOrm func(res req.Resource, tx *db.Transaction) Orm -type GetOrmConditions func(categoryUuid string, describe string) *condition.Condition +type GetOrmConditions func(categoryUuid string, opts ...condition.Option) *condition.Condition diff --git a/support/list.go b/support/list.go index 03e145f..28ad605 100644 --- a/support/list.go +++ b/support/list.go @@ -52,7 +52,7 @@ func (o Operation) ToDBColumn(model contracts.Model, container *do.Injector) (co cond := lo.Ternary(o.AccessCondition != nil, o.AccessCondition, condition.New(condition.Describe("operation access condition "+uuid))) - if c := GetOrmConditions(o.Uuid, "operation access condition "+uuid); c.IsNotEmpty() { + if c := GetOrmConditions(o.Uuid, condition.Describe("operation access condition "+uuid)); c.IsNotEmpty() { cond.SetCondition(c) }