[feat] 命名规范 GetOrmConditionByRes => GetOrmConditions
This commit is contained in:
parent
591bbabf6c
commit
6d3b2267b9
@ -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 语句
|
||||
|
2
orm.go
2
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
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user