12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- package schema
- import (
- "wechat-api/ent/schema/localmixin"
- "entgo.io/ent"
- "entgo.io/ent/dialect/entsql"
- "entgo.io/ent/schema"
- "entgo.io/ent/schema/edge"
- "entgo.io/ent/schema/field"
- "entgo.io/ent/schema/index"
- "github.com/suyuan32/simple-admin-common/orm/ent/mixins"
- )
- type SopTask struct {
- ent.Schema
- }
- func (SopTask) Fields() []ent.Field {
- return []ent.Field{
- field.String("name").NotEmpty().
- Annotations(entsql.WithComments(true)).
- Comment("SOP 任务名称"),
- field.JSON("bot_wxid_list", []string{}).Optional().
- Annotations(entsql.WithComments(true)).
- Comment("机器人微信 id 列表"),
- field.Int("type").Default(1).
- Annotations(entsql.WithComments(true)).
- Comment("标签类型:1好友,2群组,3企业微信联系人"),
- field.Time("plan_start_time").Optional().
- Annotations(entsql.WithComments(true)).
- Comment("任务计划开始时间"),
- field.Time("plan_end_time").Optional().
- Annotations(entsql.WithComments(true)).
- Comment("任务计划结束时间"),
- field.String("creator_id").Optional().
- Annotations(entsql.WithComments(true)).
- Comment("创建者 id"),
- }
- }
- func (SopTask) Mixin() []ent.Mixin {
- return []ent.Mixin{
- mixins.IDMixin{},
- mixins.StatusMixin{},
- localmixin.SoftDeleteMixin{},
- }
- }
- func (SopTask) Indexes() []ent.Index {
- return []ent.Index{
- index.Fields("name"),
- }
- }
- func (SopTask) Edges() []ent.Edge {
- return []ent.Edge{
- edge.To("task_stages", SopStage.Type),
- }
- }
- func (SopTask) Annotations() []schema.Annotation {
- return []schema.Annotation{
- entsql.WithComments(true),
- entsql.Annotation{Table: "sop_task"},
- }
- }
|