|
@@ -0,0 +1,51 @@
|
|
|
+package schema
|
|
|
+
|
|
|
+import (
|
|
|
+ "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"
|
|
|
+ "wechat-api/ent/schema/localmixin"
|
|
|
+)
|
|
|
+
|
|
|
+type LabelTagging struct {
|
|
|
+ ent.Schema
|
|
|
+}
|
|
|
+
|
|
|
+func (LabelTagging) Fields() []ent.Field {
|
|
|
+ return []ent.Field{
|
|
|
+ field.Uint64("label_id").Default(1).
|
|
|
+ Annotations(entsql.WithComments(true)).
|
|
|
+ Comment("标签 ID"),
|
|
|
+ field.Uint64("contact_id").Default(1).
|
|
|
+ Annotations(entsql.WithComments(true)).
|
|
|
+ Comment("联系人 ID"),
|
|
|
+ field.Uint64("organization_id").Optional().Default(1).
|
|
|
+ Comment("机构 ID").
|
|
|
+ Annotations(entsql.WithComments(true)),
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func (LabelTagging) Mixin() []ent.Mixin {
|
|
|
+ return []ent.Mixin{
|
|
|
+ mixins.IDMixin{},
|
|
|
+ mixins.StatusMixin{},
|
|
|
+ localmixin.SoftDeleteMixin{},
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+func (LabelTagging) Indexes() []ent.Index {
|
|
|
+ return []ent.Index{}
|
|
|
+}
|
|
|
+
|
|
|
+func (LabelTagging) Edges() []ent.Edge {
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+func (LabelTagging) Annotations() []schema.Annotation {
|
|
|
+ return []schema.Annotation{
|
|
|
+ entsql.WithComments(true),
|
|
|
+ entsql.Annotation{Table: "label_tagging"},
|
|
|
+ }
|
|
|
+}
|