1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package schema
- import (
- "entgo.io/ent/schema/index"
- "wechat-api/ent/schema/localmixin"
- "entgo.io/ent"
- "entgo.io/ent/dialect/entsql"
- "entgo.io/ent/schema"
- "entgo.io/ent/schema/field"
- "github.com/suyuan32/simple-admin-common/orm/ent/mixins"
- )
- type AllocAgent struct {
- ent.Schema
- }
- func (AllocAgent) Fields() []ent.Field {
- return []ent.Field{
- field.String("user_id").Default("").Optional().Comment("user_id | 前台用户ID"),
- field.Uint64("organization_id").Optional().Default(0).Comment("organization_id | 租户ID"),
- field.JSON("agents", []uint64{}).Comment("agents | 分配的智能体IDs"),
- field.Int("status").Optional().Range(1, 2).Default(1).Comment("status | 状态 1-正常 2-禁用"),
- }
- }
- func (AllocAgent) Mixin() []ent.Mixin {
- return []ent.Mixin{
- mixins.IDMixin{},
- localmixin.SoftDeleteMixin{},
- }
- }
- func (AllocAgent) Edges() []ent.Edge {
- return nil
- }
- func (AllocAgent) Indexes() []ent.Index {
- return []ent.Index{
- index.Fields("organization_id"),
- index.Fields("user_id"),
- }
- }
- func (AllocAgent) Annotations() []schema.Annotation {
- return []schema.Annotation{
- entsql.WithComments(true),
- entsql.Annotation{Table: "alloc_agent"},
- }
- }
|