Browse Source

Merge branch 'feature/label_tagging'

* feature/label_tagging:
  fix bug
  删除支持批量操作
  自动打标列表返回值增加返现
  优化
  变更自动打标时清空缓存
  第一版
  临时提交
  临时提交

# Conflicts:
#	ent/client.go
#	ent/ent.go
#	ent/mutation.go
boweniac 2 months ago
parent
commit
a8d4f42e7b

+ 1 - 0
desc/all.api

@@ -6,6 +6,7 @@ import "./wechat/contact.api"
 import "./wechat/message.api"
 import "./wechat/label.api"
 import "./wechat/label_relationship.api"
+import "./wechat/label_tagging.api"
 import "./wechat/sop_task.api"
 import "./wechat/sop_stage.api"
 import "./wechat/sop_node.api"

+ 85 - 0
desc/wechat/label_tagging.api

@@ -0,0 +1,85 @@
+import "../base.api"
+
+type (
+    // The data of label tagging information | LabelTagging信息
+    LabelTaggingInfo {
+        BaseIDInfo
+
+        // Status 1: normal 2: ban | 状态 1 正常 2 禁用 
+        Status  *uint8 `json:"status,optional"`
+
+        // 机构 ID
+        OrganizationId  *uint64 `json:"organizationId,optional"`
+
+        // 标签类型:1好友,2群组,3公众号,4企业微信联系人
+        Type  *int `json:"type,optional"`
+
+        // 关键词 
+        Conditions  string `json:"conditions,optional"`
+
+        // 命中后需要打的标签 
+        ActionLabelAdd  []uint64 `json:"actionLabelAdd,optional"`
+
+        // 命中后需要移除的标签 
+        ActionLabelDel  []uint64 `json:"actionLabelDel,optional"`
+
+        LabelAddInfo  []string `json:"labelAddInfo,optional"`
+    }
+
+    // The response data of label tagging list | LabelTagging信息列表数据
+    LabelTaggingListResp {
+        BaseDataInfo
+
+        // The label tagging list data | LabelTagging信息列表数据
+        Data LabelTaggingListInfo `json:"data"`
+    }
+
+    // The label tagging list data | LabelTagging信息列表数据
+    LabelTaggingListInfo {
+        BaseListInfo
+
+        // The label tagging list data | LabelTagging信息列表数据
+        Data  []LabelTaggingInfo  `json:"data"`
+    }
+
+    // Get label tagging list request params | LabelTagging信息列表请求参数
+    LabelTaggingListReq {
+        PageInfo
+    }
+
+    // The label tagging information response | LabelTagging信息返回体
+    LabelTaggingInfoResp {
+        BaseDataInfo
+
+        // label tagging information | LabelTagging信息数据
+        Data LabelTaggingInfo `json:"data"`
+    }
+)
+
+@server(
+    jwt: Auth
+    group: label_tagging
+    middleware: Authority
+)
+
+service Wechat {
+    // Create label tagging information | 创建LabelTagging信息
+    @handler createLabelTagging
+    post /label_tagging/create (LabelTaggingInfo) returns (BaseMsgResp)
+
+    // Update label tagging information | 更新LabelTagging信息
+    @handler updateLabelTagging
+    post /label_tagging/update (LabelTaggingInfo) returns (BaseMsgResp)
+
+    // Delete label tagging information | 删除LabelTagging信息
+    @handler deleteLabelTagging
+    post /label_tagging/delete (IDsReq) returns (BaseMsgResp)
+
+    // Get label tagging list | 获取LabelTagging信息列表
+    @handler getLabelTaggingList
+    post /label_tagging/list (LabelTaggingListReq) returns (LabelTaggingListResp)
+
+    // Get label tagging by ID | 通过ID获取LabelTagging信息
+    @handler getLabelTaggingById
+    post /label_tagging (IDReq) returns (LabelTaggingInfoResp)
+}

+ 155 - 10
ent/client.go

@@ -23,6 +23,7 @@ import (
 	"wechat-api/ent/employeeconfig"
 	"wechat-api/ent/label"
 	"wechat-api/ent/labelrelationship"
+	"wechat-api/ent/labeltagging"
 	"wechat-api/ent/message"
 	"wechat-api/ent/messagerecords"
 	"wechat-api/ent/msg"
@@ -82,6 +83,8 @@ type Client struct {
 	Label *LabelClient
 	// LabelRelationship is the client for interacting with the LabelRelationship builders.
 	LabelRelationship *LabelRelationshipClient
+	// LabelTagging is the client for interacting with the LabelTagging builders.
+	LabelTagging *LabelTaggingClient
 	// Message is the client for interacting with the Message builders.
 	Message *MessageClient
 	// MessageRecords is the client for interacting with the MessageRecords builders.
@@ -147,6 +150,7 @@ func (c *Client) init() {
 	c.EmployeeConfig = NewEmployeeConfigClient(c.config)
 	c.Label = NewLabelClient(c.config)
 	c.LabelRelationship = NewLabelRelationshipClient(c.config)
+	c.LabelTagging = NewLabelTaggingClient(c.config)
 	c.Message = NewMessageClient(c.config)
 	c.MessageRecords = NewMessageRecordsClient(c.config)
 	c.Msg = NewMsgClient(c.config)
@@ -272,6 +276,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
 		EmployeeConfig:      NewEmployeeConfigClient(cfg),
 		Label:               NewLabelClient(cfg),
 		LabelRelationship:   NewLabelRelationshipClient(cfg),
+		LabelTagging:      NewLabelTaggingClient(cfg),
 		Message:             NewMessageClient(cfg),
 		MessageRecords:      NewMessageRecordsClient(cfg),
 		Msg:                 NewMsgClient(cfg),
@@ -324,6 +329,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
 		EmployeeConfig:      NewEmployeeConfigClient(cfg),
 		Label:               NewLabelClient(cfg),
 		LabelRelationship:   NewLabelRelationshipClient(cfg),
+		LabelTagging:      NewLabelTaggingClient(cfg),
 		Message:             NewMessageClient(cfg),
 		MessageRecords:      NewMessageRecordsClient(cfg),
 		Msg:                 NewMsgClient(cfg),
@@ -376,8 +382,9 @@ func (c *Client) Use(hooks ...Hook) {
 	for _, n := range []interface{ Use(...Hook) }{
 		c.Agent, c.AgentBase, c.AliyunAvatar, c.BatchMsg, c.Category, c.ChatRecords,
 		c.ChatSession, c.Contact, c.Employee, c.EmployeeConfig, c.Label,
-		c.LabelRelationship, c.Message, c.MessageRecords, c.Msg, c.Server, c.SopNode,
-		c.SopStage, c.SopTask, c.Token, c.Tutorial, c.UsageDetail, c.UsageStatisticDay,
+		c.LabelRelationship, c.LabelTagging, c.Message, c.MessageRecords, c.Msg,
+		c.Server, c.SopNode, c.SopStage, c.SopTask, c.Token, c.Tutorial, c.UsageDetail,
+		c.UsageStatisticDay,
 		c.UsageStatisticHour, c.UsageStatisticMonth, c.UsageTotal, c.WorkExperience,
 		c.WpChatroom, c.WpChatroomMember, c.Wx, c.WxCard, c.WxCardUser, c.WxCardVisit,
 	} {
@@ -391,8 +398,9 @@ func (c *Client) Intercept(interceptors ...Interceptor) {
 	for _, n := range []interface{ Intercept(...Interceptor) }{
 		c.Agent, c.AgentBase, c.AliyunAvatar, c.BatchMsg, c.Category, c.ChatRecords,
 		c.ChatSession, c.Contact, c.Employee, c.EmployeeConfig, c.Label,
-		c.LabelRelationship, c.Message, c.MessageRecords, c.Msg, c.Server, c.SopNode,
-		c.SopStage, c.SopTask, c.Token, c.Tutorial, c.UsageDetail, c.UsageStatisticDay,
+		c.LabelRelationship, c.LabelTagging, c.Message, c.MessageRecords, c.Msg,
+		c.Server, c.SopNode, c.SopStage, c.SopTask, c.Token, c.Tutorial, c.UsageDetail,
+		c.UsageStatisticDay,
 		c.UsageStatisticHour, c.UsageStatisticMonth, c.UsageTotal, c.WorkExperience,
 		c.WpChatroom, c.WpChatroomMember, c.Wx, c.WxCard, c.WxCardUser, c.WxCardVisit,
 	} {
@@ -427,6 +435,8 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
 		return c.Label.mutate(ctx, m)
 	case *LabelRelationshipMutation:
 		return c.LabelRelationship.mutate(ctx, m)
+	case *LabelTaggingMutation:
+		return c.LabelTagging.mutate(ctx, m)
 	case *MessageMutation:
 		return c.Message.mutate(ctx, m)
 	case *MessageRecordsMutation:
@@ -2250,6 +2260,141 @@ func (c *LabelRelationshipClient) mutate(ctx context.Context, m *LabelRelationsh
 	}
 }
 
+// LabelTaggingClient is a client for the LabelTagging schema.
+type LabelTaggingClient struct {
+	config
+}
+
+// NewLabelTaggingClient returns a client for the LabelTagging from the given config.
+func NewLabelTaggingClient(c config) *LabelTaggingClient {
+	return &LabelTaggingClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `labeltagging.Hooks(f(g(h())))`.
+func (c *LabelTaggingClient) Use(hooks ...Hook) {
+	c.hooks.LabelTagging = append(c.hooks.LabelTagging, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `labeltagging.Intercept(f(g(h())))`.
+func (c *LabelTaggingClient) Intercept(interceptors ...Interceptor) {
+	c.inters.LabelTagging = append(c.inters.LabelTagging, interceptors...)
+}
+
+// Create returns a builder for creating a LabelTagging entity.
+func (c *LabelTaggingClient) Create() *LabelTaggingCreate {
+	mutation := newLabelTaggingMutation(c.config, OpCreate)
+	return &LabelTaggingCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of LabelTagging entities.
+func (c *LabelTaggingClient) CreateBulk(builders ...*LabelTaggingCreate) *LabelTaggingCreateBulk {
+	return &LabelTaggingCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *LabelTaggingClient) MapCreateBulk(slice any, setFunc func(*LabelTaggingCreate, int)) *LabelTaggingCreateBulk {
+	rv := reflect.ValueOf(slice)
+	if rv.Kind() != reflect.Slice {
+		return &LabelTaggingCreateBulk{err: fmt.Errorf("calling to LabelTaggingClient.MapCreateBulk with wrong type %T, need slice", slice)}
+	}
+	builders := make([]*LabelTaggingCreate, rv.Len())
+	for i := 0; i < rv.Len(); i++ {
+		builders[i] = c.Create()
+		setFunc(builders[i], i)
+	}
+	return &LabelTaggingCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for LabelTagging.
+func (c *LabelTaggingClient) Update() *LabelTaggingUpdate {
+	mutation := newLabelTaggingMutation(c.config, OpUpdate)
+	return &LabelTaggingUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *LabelTaggingClient) UpdateOne(lt *LabelTagging) *LabelTaggingUpdateOne {
+	mutation := newLabelTaggingMutation(c.config, OpUpdateOne, withLabelTagging(lt))
+	return &LabelTaggingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *LabelTaggingClient) UpdateOneID(id uint64) *LabelTaggingUpdateOne {
+	mutation := newLabelTaggingMutation(c.config, OpUpdateOne, withLabelTaggingID(id))
+	return &LabelTaggingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for LabelTagging.
+func (c *LabelTaggingClient) Delete() *LabelTaggingDelete {
+	mutation := newLabelTaggingMutation(c.config, OpDelete)
+	return &LabelTaggingDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *LabelTaggingClient) DeleteOne(lt *LabelTagging) *LabelTaggingDeleteOne {
+	return c.DeleteOneID(lt.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *LabelTaggingClient) DeleteOneID(id uint64) *LabelTaggingDeleteOne {
+	builder := c.Delete().Where(labeltagging.ID(id))
+	builder.mutation.id = &id
+	builder.mutation.op = OpDeleteOne
+	return &LabelTaggingDeleteOne{builder}
+}
+
+// Query returns a query builder for LabelTagging.
+func (c *LabelTaggingClient) Query() *LabelTaggingQuery {
+	return &LabelTaggingQuery{
+		config: c.config,
+		ctx:    &QueryContext{Type: TypeLabelTagging},
+		inters: c.Interceptors(),
+	}
+}
+
+// Get returns a LabelTagging entity by its id.
+func (c *LabelTaggingClient) Get(ctx context.Context, id uint64) (*LabelTagging, error) {
+	return c.Query().Where(labeltagging.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *LabelTaggingClient) GetX(ctx context.Context, id uint64) *LabelTagging {
+	obj, err := c.Get(ctx, id)
+	if err != nil {
+		panic(err)
+	}
+	return obj
+}
+
+// Hooks returns the client hooks.
+func (c *LabelTaggingClient) Hooks() []Hook {
+	hooks := c.hooks.LabelTagging
+	return append(hooks[:len(hooks):len(hooks)], labeltagging.Hooks[:]...)
+}
+
+// Interceptors returns the client interceptors.
+func (c *LabelTaggingClient) Interceptors() []Interceptor {
+	inters := c.inters.LabelTagging
+	return append(inters[:len(inters):len(inters)], labeltagging.Interceptors[:]...)
+}
+
+func (c *LabelTaggingClient) mutate(ctx context.Context, m *LabelTaggingMutation) (Value, error) {
+	switch m.Op() {
+	case OpCreate:
+		return (&LabelTaggingCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpUpdate:
+		return (&LabelTaggingUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpUpdateOne:
+		return (&LabelTaggingUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+	case OpDelete, OpDeleteOne:
+		return (&LabelTaggingDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+	default:
+		return nil, fmt.Errorf("ent: unknown LabelTagging mutation op: %q", m.Op())
+	}
+}
+
 // MessageClient is a client for the Message schema.
 type MessageClient struct {
 	config
@@ -5317,17 +5462,17 @@ func (c *WxCardVisitClient) mutate(ctx context.Context, m *WxCardVisitMutation)
 type (
 	hooks struct {
 		Agent, AgentBase, AliyunAvatar, BatchMsg, Category, ChatRecords, ChatSession,
-		Contact, Employee, EmployeeConfig, Label, LabelRelationship, Message,
-		MessageRecords, Msg, Server, SopNode, SopStage, SopTask, Token, Tutorial,
-		UsageDetail, UsageStatisticDay, UsageStatisticHour, UsageStatisticMonth,
+		Contact, Employee, EmployeeConfig, Label, LabelRelationship, LabelTagging,
+		Message, MessageRecords, Msg, Server, SopNode, SopStage, SopTask, Token,
+		Tutorial, UsageDetail, UsageStatisticDay, UsageStatisticHour, UsageStatisticMonth,
 		UsageTotal, WorkExperience, WpChatroom, WpChatroomMember, Wx, WxCard,
 		WxCardUser, WxCardVisit []ent.Hook
 	}
 	inters struct {
 		Agent, AgentBase, AliyunAvatar, BatchMsg, Category, ChatRecords, ChatSession,
-		Contact, Employee, EmployeeConfig, Label, LabelRelationship, Message,
-		MessageRecords, Msg, Server, SopNode, SopStage, SopTask, Token, Tutorial,
-		UsageDetail, UsageStatisticDay, UsageStatisticHour, UsageStatisticMonth,
+		Contact, Employee, EmployeeConfig, Label, LabelRelationship, LabelTagging,
+		Message, MessageRecords, Msg, Server, SopNode, SopStage, SopTask, Token,
+		Tutorial, UsageDetail, UsageStatisticDay, UsageStatisticHour, UsageStatisticMonth,
 		UsageTotal, WorkExperience, WpChatroom, WpChatroomMember, Wx, WxCard,
 		WxCardUser, WxCardVisit []ent.Interceptor
 	}

+ 2 - 0
ent/ent.go

@@ -20,6 +20,7 @@ import (
 	"wechat-api/ent/employeeconfig"
 	"wechat-api/ent/label"
 	"wechat-api/ent/labelrelationship"
+	"wechat-api/ent/labeltagging"
 	"wechat-api/ent/message"
 	"wechat-api/ent/messagerecords"
 	"wechat-api/ent/msg"
@@ -117,6 +118,7 @@ func checkColumn(table, column string) error {
 			employeeconfig.Table:      employeeconfig.ValidColumn,
 			label.Table:               label.ValidColumn,
 			labelrelationship.Table:   labelrelationship.ValidColumn,
+			labeltagging.Table:      labeltagging.ValidColumn,
 			message.Table:             message.ValidColumn,
 			messagerecords.Table:      messagerecords.ValidColumn,
 			msg.Table:                 msg.ValidColumn,

+ 12 - 0
ent/hook/hook.go

@@ -152,6 +152,18 @@ func (f LabelRelationshipFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.
 	return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.LabelRelationshipMutation", m)
 }
 
+// The LabelTaggingFunc type is an adapter to allow the use of ordinary
+// function as LabelTagging mutator.
+type LabelTaggingFunc func(context.Context, *ent.LabelTaggingMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f LabelTaggingFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+	if mv, ok := m.(*ent.LabelTaggingMutation); ok {
+		return f(ctx, mv)
+	}
+	return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.LabelTaggingMutation", m)
+}
+
 // The MessageFunc type is an adapter to allow the use of ordinary
 // function as Message mutator.
 type MessageFunc func(context.Context, *ent.MessageMutation) (ent.Value, error)

+ 30 - 0
ent/intercept/intercept.go

@@ -18,6 +18,7 @@ import (
 	"wechat-api/ent/employeeconfig"
 	"wechat-api/ent/label"
 	"wechat-api/ent/labelrelationship"
+	"wechat-api/ent/labeltagging"
 	"wechat-api/ent/message"
 	"wechat-api/ent/messagerecords"
 	"wechat-api/ent/msg"
@@ -424,6 +425,33 @@ func (f TraverseLabelRelationship) Traverse(ctx context.Context, q ent.Query) er
 	return fmt.Errorf("unexpected query type %T. expect *ent.LabelRelationshipQuery", q)
 }
 
+// The LabelTaggingFunc type is an adapter to allow the use of ordinary function as a Querier.
+type LabelTaggingFunc func(context.Context, *ent.LabelTaggingQuery) (ent.Value, error)
+
+// Query calls f(ctx, q).
+func (f LabelTaggingFunc) Query(ctx context.Context, q ent.Query) (ent.Value, error) {
+	if q, ok := q.(*ent.LabelTaggingQuery); ok {
+		return f(ctx, q)
+	}
+	return nil, fmt.Errorf("unexpected query type %T. expect *ent.LabelTaggingQuery", q)
+}
+
+// The TraverseLabelTagging type is an adapter to allow the use of ordinary function as Traverser.
+type TraverseLabelTagging func(context.Context, *ent.LabelTaggingQuery) error
+
+// Intercept is a dummy implementation of Intercept that returns the next Querier in the pipeline.
+func (f TraverseLabelTagging) Intercept(next ent.Querier) ent.Querier {
+	return next
+}
+
+// Traverse calls f(ctx, q).
+func (f TraverseLabelTagging) Traverse(ctx context.Context, q ent.Query) error {
+	if q, ok := q.(*ent.LabelTaggingQuery); ok {
+		return f(ctx, q)
+	}
+	return fmt.Errorf("unexpected query type %T. expect *ent.LabelTaggingQuery", q)
+}
+
 // The MessageFunc type is an adapter to allow the use of ordinary function as a Querier.
 type MessageFunc func(context.Context, *ent.MessageQuery) (ent.Value, error)
 
@@ -1018,6 +1046,8 @@ func NewQuery(q ent.Query) (Query, error) {
 		return &query[*ent.LabelQuery, predicate.Label, label.OrderOption]{typ: ent.TypeLabel, tq: q}, nil
 	case *ent.LabelRelationshipQuery:
 		return &query[*ent.LabelRelationshipQuery, predicate.LabelRelationship, labelrelationship.OrderOption]{typ: ent.TypeLabelRelationship, tq: q}, nil
+	case *ent.LabelTaggingQuery:
+		return &query[*ent.LabelTaggingQuery, predicate.LabelTagging, labeltagging.OrderOption]{typ: ent.TypeLabelTagging, tq: q}, nil
 	case *ent.MessageQuery:
 		return &query[*ent.MessageQuery, predicate.Message, message.OrderOption]{typ: ent.TypeMessage, tq: q}, nil
 	case *ent.MessageRecordsQuery:

+ 201 - 0
ent/labeltagging.go

@@ -0,0 +1,201 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"encoding/json"
+	"fmt"
+	"strings"
+	"time"
+	"wechat-api/ent/labeltagging"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/sql"
+)
+
+// LabelTagging is the model entity for the LabelTagging schema.
+type LabelTagging struct {
+	config `json:"-"`
+	// ID of the ent.
+	ID uint64 `json:"id,omitempty"`
+	// Create Time | 创建日期
+	CreatedAt time.Time `json:"created_at,omitempty"`
+	// Update Time | 修改日期
+	UpdatedAt time.Time `json:"updated_at,omitempty"`
+	// Status 1: normal 2: ban | 状态 1 正常 2 禁用
+	Status uint8 `json:"status,omitempty"`
+	// Delete Time | 删除日期
+	DeletedAt time.Time `json:"deleted_at,omitempty"`
+	// 机构 ID
+	OrganizationID uint64 `json:"organization_id,omitempty"`
+	// 标签类型:1好友,2群组,3公众号,4企业微信联系人
+	Type int `json:"type,omitempty"`
+	// 关键词
+	Conditions string `json:"conditions,omitempty"`
+	// 命中后需要打的标签
+	ActionLabelAdd []uint64 `json:"action_label_add,omitempty"`
+	// 命中后需要移除的标签
+	ActionLabelDel []uint64 `json:"action_label_del,omitempty"`
+	selectValues   sql.SelectValues
+}
+
+// scanValues returns the types for scanning values from sql.Rows.
+func (*LabelTagging) scanValues(columns []string) ([]any, error) {
+	values := make([]any, len(columns))
+	for i := range columns {
+		switch columns[i] {
+		case labeltagging.FieldActionLabelAdd, labeltagging.FieldActionLabelDel:
+			values[i] = new([]byte)
+		case labeltagging.FieldID, labeltagging.FieldStatus, labeltagging.FieldOrganizationID, labeltagging.FieldType:
+			values[i] = new(sql.NullInt64)
+		case labeltagging.FieldConditions:
+			values[i] = new(sql.NullString)
+		case labeltagging.FieldCreatedAt, labeltagging.FieldUpdatedAt, labeltagging.FieldDeletedAt:
+			values[i] = new(sql.NullTime)
+		default:
+			values[i] = new(sql.UnknownType)
+		}
+	}
+	return values, nil
+}
+
+// assignValues assigns the values that were returned from sql.Rows (after scanning)
+// to the LabelTagging fields.
+func (lt *LabelTagging) assignValues(columns []string, values []any) error {
+	if m, n := len(values), len(columns); m < n {
+		return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
+	}
+	for i := range columns {
+		switch columns[i] {
+		case labeltagging.FieldID:
+			value, ok := values[i].(*sql.NullInt64)
+			if !ok {
+				return fmt.Errorf("unexpected type %T for field id", value)
+			}
+			lt.ID = uint64(value.Int64)
+		case labeltagging.FieldCreatedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field created_at", values[i])
+			} else if value.Valid {
+				lt.CreatedAt = value.Time
+			}
+		case labeltagging.FieldUpdatedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field updated_at", values[i])
+			} else if value.Valid {
+				lt.UpdatedAt = value.Time
+			}
+		case labeltagging.FieldStatus:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field status", values[i])
+			} else if value.Valid {
+				lt.Status = uint8(value.Int64)
+			}
+		case labeltagging.FieldDeletedAt:
+			if value, ok := values[i].(*sql.NullTime); !ok {
+				return fmt.Errorf("unexpected type %T for field deleted_at", values[i])
+			} else if value.Valid {
+				lt.DeletedAt = value.Time
+			}
+		case labeltagging.FieldOrganizationID:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field organization_id", values[i])
+			} else if value.Valid {
+				lt.OrganizationID = uint64(value.Int64)
+			}
+		case labeltagging.FieldType:
+			if value, ok := values[i].(*sql.NullInt64); !ok {
+				return fmt.Errorf("unexpected type %T for field type", values[i])
+			} else if value.Valid {
+				lt.Type = int(value.Int64)
+			}
+		case labeltagging.FieldConditions:
+			if value, ok := values[i].(*sql.NullString); !ok {
+				return fmt.Errorf("unexpected type %T for field conditions", values[i])
+			} else if value.Valid {
+				lt.Conditions = value.String
+			}
+		case labeltagging.FieldActionLabelAdd:
+			if value, ok := values[i].(*[]byte); !ok {
+				return fmt.Errorf("unexpected type %T for field action_label_add", values[i])
+			} else if value != nil && len(*value) > 0 {
+				if err := json.Unmarshal(*value, &lt.ActionLabelAdd); err != nil {
+					return fmt.Errorf("unmarshal field action_label_add: %w", err)
+				}
+			}
+		case labeltagging.FieldActionLabelDel:
+			if value, ok := values[i].(*[]byte); !ok {
+				return fmt.Errorf("unexpected type %T for field action_label_del", values[i])
+			} else if value != nil && len(*value) > 0 {
+				if err := json.Unmarshal(*value, &lt.ActionLabelDel); err != nil {
+					return fmt.Errorf("unmarshal field action_label_del: %w", err)
+				}
+			}
+		default:
+			lt.selectValues.Set(columns[i], values[i])
+		}
+	}
+	return nil
+}
+
+// Value returns the ent.Value that was dynamically selected and assigned to the LabelTagging.
+// This includes values selected through modifiers, order, etc.
+func (lt *LabelTagging) Value(name string) (ent.Value, error) {
+	return lt.selectValues.Get(name)
+}
+
+// Update returns a builder for updating this LabelTagging.
+// Note that you need to call LabelTagging.Unwrap() before calling this method if this LabelTagging
+// was returned from a transaction, and the transaction was committed or rolled back.
+func (lt *LabelTagging) Update() *LabelTaggingUpdateOne {
+	return NewLabelTaggingClient(lt.config).UpdateOne(lt)
+}
+
+// Unwrap unwraps the LabelTagging entity that was returned from a transaction after it was closed,
+// so that all future queries will be executed through the driver which created the transaction.
+func (lt *LabelTagging) Unwrap() *LabelTagging {
+	_tx, ok := lt.config.driver.(*txDriver)
+	if !ok {
+		panic("ent: LabelTagging is not a transactional entity")
+	}
+	lt.config.driver = _tx.drv
+	return lt
+}
+
+// String implements the fmt.Stringer.
+func (lt *LabelTagging) String() string {
+	var builder strings.Builder
+	builder.WriteString("LabelTagging(")
+	builder.WriteString(fmt.Sprintf("id=%v, ", lt.ID))
+	builder.WriteString("created_at=")
+	builder.WriteString(lt.CreatedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("updated_at=")
+	builder.WriteString(lt.UpdatedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("status=")
+	builder.WriteString(fmt.Sprintf("%v", lt.Status))
+	builder.WriteString(", ")
+	builder.WriteString("deleted_at=")
+	builder.WriteString(lt.DeletedAt.Format(time.ANSIC))
+	builder.WriteString(", ")
+	builder.WriteString("organization_id=")
+	builder.WriteString(fmt.Sprintf("%v", lt.OrganizationID))
+	builder.WriteString(", ")
+	builder.WriteString("type=")
+	builder.WriteString(fmt.Sprintf("%v", lt.Type))
+	builder.WriteString(", ")
+	builder.WriteString("conditions=")
+	builder.WriteString(lt.Conditions)
+	builder.WriteString(", ")
+	builder.WriteString("action_label_add=")
+	builder.WriteString(fmt.Sprintf("%v", lt.ActionLabelAdd))
+	builder.WriteString(", ")
+	builder.WriteString("action_label_del=")
+	builder.WriteString(fmt.Sprintf("%v", lt.ActionLabelDel))
+	builder.WriteByte(')')
+	return builder.String()
+}
+
+// LabelTaggings is a parsable slice of LabelTagging.
+type LabelTaggings []*LabelTagging

+ 128 - 0
ent/labeltagging/labeltagging.go

@@ -0,0 +1,128 @@
+// Code generated by ent, DO NOT EDIT.
+
+package labeltagging
+
+import (
+	"time"
+
+	"entgo.io/ent"
+	"entgo.io/ent/dialect/sql"
+)
+
+const (
+	// Label holds the string label denoting the labeltagging type in the database.
+	Label = "label_tagging"
+	// FieldID holds the string denoting the id field in the database.
+	FieldID = "id"
+	// FieldCreatedAt holds the string denoting the created_at field in the database.
+	FieldCreatedAt = "created_at"
+	// FieldUpdatedAt holds the string denoting the updated_at field in the database.
+	FieldUpdatedAt = "updated_at"
+	// FieldStatus holds the string denoting the status field in the database.
+	FieldStatus = "status"
+	// FieldDeletedAt holds the string denoting the deleted_at field in the database.
+	FieldDeletedAt = "deleted_at"
+	// FieldOrganizationID holds the string denoting the organization_id field in the database.
+	FieldOrganizationID = "organization_id"
+	// FieldType holds the string denoting the type field in the database.
+	FieldType = "type"
+	// FieldConditions holds the string denoting the conditions field in the database.
+	FieldConditions = "conditions"
+	// FieldActionLabelAdd holds the string denoting the action_label_add field in the database.
+	FieldActionLabelAdd = "action_label_add"
+	// FieldActionLabelDel holds the string denoting the action_label_del field in the database.
+	FieldActionLabelDel = "action_label_del"
+	// Table holds the table name of the labeltagging in the database.
+	Table = "label_tagging"
+)
+
+// Columns holds all SQL columns for labeltagging fields.
+var Columns = []string{
+	FieldID,
+	FieldCreatedAt,
+	FieldUpdatedAt,
+	FieldStatus,
+	FieldDeletedAt,
+	FieldOrganizationID,
+	FieldType,
+	FieldConditions,
+	FieldActionLabelAdd,
+	FieldActionLabelDel,
+}
+
+// ValidColumn reports if the column name is valid (part of the table columns).
+func ValidColumn(column string) bool {
+	for i := range Columns {
+		if column == Columns[i] {
+			return true
+		}
+	}
+	return false
+}
+
+// Note that the variables below are initialized by the runtime
+// package on the initialization of the application. Therefore,
+// it should be imported in the main as follows:
+//
+//	import _ "wechat-api/ent/runtime"
+var (
+	Hooks        [1]ent.Hook
+	Interceptors [1]ent.Interceptor
+	// DefaultCreatedAt holds the default value on creation for the "created_at" field.
+	DefaultCreatedAt func() time.Time
+	// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
+	DefaultUpdatedAt func() time.Time
+	// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
+	UpdateDefaultUpdatedAt func() time.Time
+	// DefaultStatus holds the default value on creation for the "status" field.
+	DefaultStatus uint8
+	// DefaultOrganizationID holds the default value on creation for the "organization_id" field.
+	DefaultOrganizationID uint64
+	// DefaultType holds the default value on creation for the "type" field.
+	DefaultType int
+	// DefaultConditions holds the default value on creation for the "conditions" field.
+	DefaultConditions string
+)
+
+// OrderOption defines the ordering options for the LabelTagging queries.
+type OrderOption func(*sql.Selector)
+
+// ByID orders the results by the id field.
+func ByID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldID, opts...).ToFunc()
+}
+
+// ByCreatedAt orders the results by the created_at field.
+func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
+}
+
+// ByUpdatedAt orders the results by the updated_at field.
+func ByUpdatedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldUpdatedAt, opts...).ToFunc()
+}
+
+// ByStatus orders the results by the status field.
+func ByStatus(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldStatus, opts...).ToFunc()
+}
+
+// ByDeletedAt orders the results by the deleted_at field.
+func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldDeletedAt, opts...).ToFunc()
+}
+
+// ByOrganizationID orders the results by the organization_id field.
+func ByOrganizationID(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldOrganizationID, opts...).ToFunc()
+}
+
+// ByType orders the results by the type field.
+func ByType(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldType, opts...).ToFunc()
+}
+
+// ByConditions orders the results by the conditions field.
+func ByConditions(opts ...sql.OrderTermOption) OrderOption {
+	return sql.OrderByField(FieldConditions, opts...).ToFunc()
+}

+ 450 - 0
ent/labeltagging/where.go

@@ -0,0 +1,450 @@
+// Code generated by ent, DO NOT EDIT.
+
+package labeltagging
+
+import (
+	"time"
+	"wechat-api/ent/predicate"
+
+	"entgo.io/ent/dialect/sql"
+)
+
+// ID filters vertices based on their ID field.
+func ID(id uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldID, id))
+}
+
+// IDEQ applies the EQ predicate on the ID field.
+func IDEQ(id uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldID, id))
+}
+
+// IDNEQ applies the NEQ predicate on the ID field.
+func IDNEQ(id uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNEQ(FieldID, id))
+}
+
+// IDIn applies the In predicate on the ID field.
+func IDIn(ids ...uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldIn(FieldID, ids...))
+}
+
+// IDNotIn applies the NotIn predicate on the ID field.
+func IDNotIn(ids ...uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNotIn(FieldID, ids...))
+}
+
+// IDGT applies the GT predicate on the ID field.
+func IDGT(id uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGT(FieldID, id))
+}
+
+// IDGTE applies the GTE predicate on the ID field.
+func IDGTE(id uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGTE(FieldID, id))
+}
+
+// IDLT applies the LT predicate on the ID field.
+func IDLT(id uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLT(FieldID, id))
+}
+
+// IDLTE applies the LTE predicate on the ID field.
+func IDLTE(id uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLTE(FieldID, id))
+}
+
+// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
+func UpdatedAt(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// Status applies equality check predicate on the "status" field. It's identical to StatusEQ.
+func Status(v uint8) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldStatus, v))
+}
+
+// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ.
+func DeletedAt(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldDeletedAt, v))
+}
+
+// OrganizationID applies equality check predicate on the "organization_id" field. It's identical to OrganizationIDEQ.
+func OrganizationID(v uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldOrganizationID, v))
+}
+
+// Type applies equality check predicate on the "type" field. It's identical to TypeEQ.
+func Type(v int) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldType, v))
+}
+
+// Conditions applies equality check predicate on the "conditions" field. It's identical to ConditionsEQ.
+func Conditions(v string) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldConditions, v))
+}
+
+// CreatedAtEQ applies the EQ predicate on the "created_at" field.
+func CreatedAtEQ(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
+func CreatedAtNEQ(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNEQ(FieldCreatedAt, v))
+}
+
+// CreatedAtIn applies the In predicate on the "created_at" field.
+func CreatedAtIn(vs ...time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNotIn(FieldCreatedAt, vs...))
+}
+
+// CreatedAtGT applies the GT predicate on the "created_at" field.
+func CreatedAtGT(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGT(FieldCreatedAt, v))
+}
+
+// CreatedAtGTE applies the GTE predicate on the "created_at" field.
+func CreatedAtGTE(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGTE(FieldCreatedAt, v))
+}
+
+// CreatedAtLT applies the LT predicate on the "created_at" field.
+func CreatedAtLT(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLT(FieldCreatedAt, v))
+}
+
+// CreatedAtLTE applies the LTE predicate on the "created_at" field.
+func CreatedAtLTE(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLTE(FieldCreatedAt, v))
+}
+
+// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
+func UpdatedAtEQ(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
+func UpdatedAtNEQ(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNEQ(FieldUpdatedAt, v))
+}
+
+// UpdatedAtIn applies the In predicate on the "updated_at" field.
+func UpdatedAtIn(vs ...time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
+func UpdatedAtNotIn(vs ...time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNotIn(FieldUpdatedAt, vs...))
+}
+
+// UpdatedAtGT applies the GT predicate on the "updated_at" field.
+func UpdatedAtGT(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
+func UpdatedAtGTE(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGTE(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLT applies the LT predicate on the "updated_at" field.
+func UpdatedAtLT(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLT(FieldUpdatedAt, v))
+}
+
+// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
+func UpdatedAtLTE(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLTE(FieldUpdatedAt, v))
+}
+
+// StatusEQ applies the EQ predicate on the "status" field.
+func StatusEQ(v uint8) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldStatus, v))
+}
+
+// StatusNEQ applies the NEQ predicate on the "status" field.
+func StatusNEQ(v uint8) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNEQ(FieldStatus, v))
+}
+
+// StatusIn applies the In predicate on the "status" field.
+func StatusIn(vs ...uint8) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldIn(FieldStatus, vs...))
+}
+
+// StatusNotIn applies the NotIn predicate on the "status" field.
+func StatusNotIn(vs ...uint8) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNotIn(FieldStatus, vs...))
+}
+
+// StatusGT applies the GT predicate on the "status" field.
+func StatusGT(v uint8) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGT(FieldStatus, v))
+}
+
+// StatusGTE applies the GTE predicate on the "status" field.
+func StatusGTE(v uint8) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGTE(FieldStatus, v))
+}
+
+// StatusLT applies the LT predicate on the "status" field.
+func StatusLT(v uint8) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLT(FieldStatus, v))
+}
+
+// StatusLTE applies the LTE predicate on the "status" field.
+func StatusLTE(v uint8) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLTE(FieldStatus, v))
+}
+
+// StatusIsNil applies the IsNil predicate on the "status" field.
+func StatusIsNil() predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldIsNull(FieldStatus))
+}
+
+// StatusNotNil applies the NotNil predicate on the "status" field.
+func StatusNotNil() predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNotNull(FieldStatus))
+}
+
+// DeletedAtEQ applies the EQ predicate on the "deleted_at" field.
+func DeletedAtEQ(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldDeletedAt, v))
+}
+
+// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field.
+func DeletedAtNEQ(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNEQ(FieldDeletedAt, v))
+}
+
+// DeletedAtIn applies the In predicate on the "deleted_at" field.
+func DeletedAtIn(vs ...time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldIn(FieldDeletedAt, vs...))
+}
+
+// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field.
+func DeletedAtNotIn(vs ...time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNotIn(FieldDeletedAt, vs...))
+}
+
+// DeletedAtGT applies the GT predicate on the "deleted_at" field.
+func DeletedAtGT(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGT(FieldDeletedAt, v))
+}
+
+// DeletedAtGTE applies the GTE predicate on the "deleted_at" field.
+func DeletedAtGTE(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGTE(FieldDeletedAt, v))
+}
+
+// DeletedAtLT applies the LT predicate on the "deleted_at" field.
+func DeletedAtLT(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLT(FieldDeletedAt, v))
+}
+
+// DeletedAtLTE applies the LTE predicate on the "deleted_at" field.
+func DeletedAtLTE(v time.Time) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLTE(FieldDeletedAt, v))
+}
+
+// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field.
+func DeletedAtIsNil() predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldIsNull(FieldDeletedAt))
+}
+
+// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field.
+func DeletedAtNotNil() predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNotNull(FieldDeletedAt))
+}
+
+// OrganizationIDEQ applies the EQ predicate on the "organization_id" field.
+func OrganizationIDEQ(v uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldOrganizationID, v))
+}
+
+// OrganizationIDNEQ applies the NEQ predicate on the "organization_id" field.
+func OrganizationIDNEQ(v uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNEQ(FieldOrganizationID, v))
+}
+
+// OrganizationIDIn applies the In predicate on the "organization_id" field.
+func OrganizationIDIn(vs ...uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldIn(FieldOrganizationID, vs...))
+}
+
+// OrganizationIDNotIn applies the NotIn predicate on the "organization_id" field.
+func OrganizationIDNotIn(vs ...uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNotIn(FieldOrganizationID, vs...))
+}
+
+// OrganizationIDGT applies the GT predicate on the "organization_id" field.
+func OrganizationIDGT(v uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGT(FieldOrganizationID, v))
+}
+
+// OrganizationIDGTE applies the GTE predicate on the "organization_id" field.
+func OrganizationIDGTE(v uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGTE(FieldOrganizationID, v))
+}
+
+// OrganizationIDLT applies the LT predicate on the "organization_id" field.
+func OrganizationIDLT(v uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLT(FieldOrganizationID, v))
+}
+
+// OrganizationIDLTE applies the LTE predicate on the "organization_id" field.
+func OrganizationIDLTE(v uint64) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLTE(FieldOrganizationID, v))
+}
+
+// TypeEQ applies the EQ predicate on the "type" field.
+func TypeEQ(v int) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldType, v))
+}
+
+// TypeNEQ applies the NEQ predicate on the "type" field.
+func TypeNEQ(v int) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNEQ(FieldType, v))
+}
+
+// TypeIn applies the In predicate on the "type" field.
+func TypeIn(vs ...int) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldIn(FieldType, vs...))
+}
+
+// TypeNotIn applies the NotIn predicate on the "type" field.
+func TypeNotIn(vs ...int) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNotIn(FieldType, vs...))
+}
+
+// TypeGT applies the GT predicate on the "type" field.
+func TypeGT(v int) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGT(FieldType, v))
+}
+
+// TypeGTE applies the GTE predicate on the "type" field.
+func TypeGTE(v int) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGTE(FieldType, v))
+}
+
+// TypeLT applies the LT predicate on the "type" field.
+func TypeLT(v int) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLT(FieldType, v))
+}
+
+// TypeLTE applies the LTE predicate on the "type" field.
+func TypeLTE(v int) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLTE(FieldType, v))
+}
+
+// ConditionsEQ applies the EQ predicate on the "conditions" field.
+func ConditionsEQ(v string) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEQ(FieldConditions, v))
+}
+
+// ConditionsNEQ applies the NEQ predicate on the "conditions" field.
+func ConditionsNEQ(v string) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNEQ(FieldConditions, v))
+}
+
+// ConditionsIn applies the In predicate on the "conditions" field.
+func ConditionsIn(vs ...string) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldIn(FieldConditions, vs...))
+}
+
+// ConditionsNotIn applies the NotIn predicate on the "conditions" field.
+func ConditionsNotIn(vs ...string) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNotIn(FieldConditions, vs...))
+}
+
+// ConditionsGT applies the GT predicate on the "conditions" field.
+func ConditionsGT(v string) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGT(FieldConditions, v))
+}
+
+// ConditionsGTE applies the GTE predicate on the "conditions" field.
+func ConditionsGTE(v string) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldGTE(FieldConditions, v))
+}
+
+// ConditionsLT applies the LT predicate on the "conditions" field.
+func ConditionsLT(v string) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLT(FieldConditions, v))
+}
+
+// ConditionsLTE applies the LTE predicate on the "conditions" field.
+func ConditionsLTE(v string) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldLTE(FieldConditions, v))
+}
+
+// ConditionsContains applies the Contains predicate on the "conditions" field.
+func ConditionsContains(v string) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldContains(FieldConditions, v))
+}
+
+// ConditionsHasPrefix applies the HasPrefix predicate on the "conditions" field.
+func ConditionsHasPrefix(v string) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldHasPrefix(FieldConditions, v))
+}
+
+// ConditionsHasSuffix applies the HasSuffix predicate on the "conditions" field.
+func ConditionsHasSuffix(v string) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldHasSuffix(FieldConditions, v))
+}
+
+// ConditionsEqualFold applies the EqualFold predicate on the "conditions" field.
+func ConditionsEqualFold(v string) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldEqualFold(FieldConditions, v))
+}
+
+// ConditionsContainsFold applies the ContainsFold predicate on the "conditions" field.
+func ConditionsContainsFold(v string) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldContainsFold(FieldConditions, v))
+}
+
+// ActionLabelAddIsNil applies the IsNil predicate on the "action_label_add" field.
+func ActionLabelAddIsNil() predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldIsNull(FieldActionLabelAdd))
+}
+
+// ActionLabelAddNotNil applies the NotNil predicate on the "action_label_add" field.
+func ActionLabelAddNotNil() predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNotNull(FieldActionLabelAdd))
+}
+
+// ActionLabelDelIsNil applies the IsNil predicate on the "action_label_del" field.
+func ActionLabelDelIsNil() predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldIsNull(FieldActionLabelDel))
+}
+
+// ActionLabelDelNotNil applies the NotNil predicate on the "action_label_del" field.
+func ActionLabelDelNotNil() predicate.LabelTagging {
+	return predicate.LabelTagging(sql.FieldNotNull(FieldActionLabelDel))
+}
+
+// And groups predicates with the AND operator between them.
+func And(predicates ...predicate.LabelTagging) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.AndPredicates(predicates...))
+}
+
+// Or groups predicates with the OR operator between them.
+func Or(predicates ...predicate.LabelTagging) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.OrPredicates(predicates...))
+}
+
+// Not applies the not operator on the given predicate.
+func Not(p predicate.LabelTagging) predicate.LabelTagging {
+	return predicate.LabelTagging(sql.NotPredicates(p))
+}

+ 1098 - 0
ent/labeltagging_create.go

@@ -0,0 +1,1098 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"time"
+	"wechat-api/ent/labeltagging"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// LabelTaggingCreate is the builder for creating a LabelTagging entity.
+type LabelTaggingCreate struct {
+	config
+	mutation *LabelTaggingMutation
+	hooks    []Hook
+	conflict []sql.ConflictOption
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (ltc *LabelTaggingCreate) SetCreatedAt(t time.Time) *LabelTaggingCreate {
+	ltc.mutation.SetCreatedAt(t)
+	return ltc
+}
+
+// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
+func (ltc *LabelTaggingCreate) SetNillableCreatedAt(t *time.Time) *LabelTaggingCreate {
+	if t != nil {
+		ltc.SetCreatedAt(*t)
+	}
+	return ltc
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (ltc *LabelTaggingCreate) SetUpdatedAt(t time.Time) *LabelTaggingCreate {
+	ltc.mutation.SetUpdatedAt(t)
+	return ltc
+}
+
+// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
+func (ltc *LabelTaggingCreate) SetNillableUpdatedAt(t *time.Time) *LabelTaggingCreate {
+	if t != nil {
+		ltc.SetUpdatedAt(*t)
+	}
+	return ltc
+}
+
+// SetStatus sets the "status" field.
+func (ltc *LabelTaggingCreate) SetStatus(u uint8) *LabelTaggingCreate {
+	ltc.mutation.SetStatus(u)
+	return ltc
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (ltc *LabelTaggingCreate) SetNillableStatus(u *uint8) *LabelTaggingCreate {
+	if u != nil {
+		ltc.SetStatus(*u)
+	}
+	return ltc
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (ltc *LabelTaggingCreate) SetDeletedAt(t time.Time) *LabelTaggingCreate {
+	ltc.mutation.SetDeletedAt(t)
+	return ltc
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (ltc *LabelTaggingCreate) SetNillableDeletedAt(t *time.Time) *LabelTaggingCreate {
+	if t != nil {
+		ltc.SetDeletedAt(*t)
+	}
+	return ltc
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (ltc *LabelTaggingCreate) SetOrganizationID(u uint64) *LabelTaggingCreate {
+	ltc.mutation.SetOrganizationID(u)
+	return ltc
+}
+
+// SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
+func (ltc *LabelTaggingCreate) SetNillableOrganizationID(u *uint64) *LabelTaggingCreate {
+	if u != nil {
+		ltc.SetOrganizationID(*u)
+	}
+	return ltc
+}
+
+// SetType sets the "type" field.
+func (ltc *LabelTaggingCreate) SetType(i int) *LabelTaggingCreate {
+	ltc.mutation.SetType(i)
+	return ltc
+}
+
+// SetNillableType sets the "type" field if the given value is not nil.
+func (ltc *LabelTaggingCreate) SetNillableType(i *int) *LabelTaggingCreate {
+	if i != nil {
+		ltc.SetType(*i)
+	}
+	return ltc
+}
+
+// SetConditions sets the "conditions" field.
+func (ltc *LabelTaggingCreate) SetConditions(s string) *LabelTaggingCreate {
+	ltc.mutation.SetConditions(s)
+	return ltc
+}
+
+// SetNillableConditions sets the "conditions" field if the given value is not nil.
+func (ltc *LabelTaggingCreate) SetNillableConditions(s *string) *LabelTaggingCreate {
+	if s != nil {
+		ltc.SetConditions(*s)
+	}
+	return ltc
+}
+
+// SetActionLabelAdd sets the "action_label_add" field.
+func (ltc *LabelTaggingCreate) SetActionLabelAdd(u []uint64) *LabelTaggingCreate {
+	ltc.mutation.SetActionLabelAdd(u)
+	return ltc
+}
+
+// SetActionLabelDel sets the "action_label_del" field.
+func (ltc *LabelTaggingCreate) SetActionLabelDel(u []uint64) *LabelTaggingCreate {
+	ltc.mutation.SetActionLabelDel(u)
+	return ltc
+}
+
+// SetID sets the "id" field.
+func (ltc *LabelTaggingCreate) SetID(u uint64) *LabelTaggingCreate {
+	ltc.mutation.SetID(u)
+	return ltc
+}
+
+// Mutation returns the LabelTaggingMutation object of the builder.
+func (ltc *LabelTaggingCreate) Mutation() *LabelTaggingMutation {
+	return ltc.mutation
+}
+
+// Save creates the LabelTagging in the database.
+func (ltc *LabelTaggingCreate) Save(ctx context.Context) (*LabelTagging, error) {
+	if err := ltc.defaults(); err != nil {
+		return nil, err
+	}
+	return withHooks(ctx, ltc.sqlSave, ltc.mutation, ltc.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (ltc *LabelTaggingCreate) SaveX(ctx context.Context) *LabelTagging {
+	v, err := ltc.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return v
+}
+
+// Exec executes the query.
+func (ltc *LabelTaggingCreate) Exec(ctx context.Context) error {
+	_, err := ltc.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ltc *LabelTaggingCreate) ExecX(ctx context.Context) {
+	if err := ltc.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (ltc *LabelTaggingCreate) defaults() error {
+	if _, ok := ltc.mutation.CreatedAt(); !ok {
+		if labeltagging.DefaultCreatedAt == nil {
+			return fmt.Errorf("ent: uninitialized labeltagging.DefaultCreatedAt (forgotten import ent/runtime?)")
+		}
+		v := labeltagging.DefaultCreatedAt()
+		ltc.mutation.SetCreatedAt(v)
+	}
+	if _, ok := ltc.mutation.UpdatedAt(); !ok {
+		if labeltagging.DefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized labeltagging.DefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := labeltagging.DefaultUpdatedAt()
+		ltc.mutation.SetUpdatedAt(v)
+	}
+	if _, ok := ltc.mutation.Status(); !ok {
+		v := labeltagging.DefaultStatus
+		ltc.mutation.SetStatus(v)
+	}
+	if _, ok := ltc.mutation.OrganizationID(); !ok {
+		v := labeltagging.DefaultOrganizationID
+		ltc.mutation.SetOrganizationID(v)
+	}
+	if _, ok := ltc.mutation.GetType(); !ok {
+		v := labeltagging.DefaultType
+		ltc.mutation.SetType(v)
+	}
+	if _, ok := ltc.mutation.Conditions(); !ok {
+		v := labeltagging.DefaultConditions
+		ltc.mutation.SetConditions(v)
+	}
+	return nil
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (ltc *LabelTaggingCreate) check() error {
+	if _, ok := ltc.mutation.CreatedAt(); !ok {
+		return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "LabelTagging.created_at"`)}
+	}
+	if _, ok := ltc.mutation.UpdatedAt(); !ok {
+		return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "LabelTagging.updated_at"`)}
+	}
+	if _, ok := ltc.mutation.OrganizationID(); !ok {
+		return &ValidationError{Name: "organization_id", err: errors.New(`ent: missing required field "LabelTagging.organization_id"`)}
+	}
+	if _, ok := ltc.mutation.GetType(); !ok {
+		return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "LabelTagging.type"`)}
+	}
+	if _, ok := ltc.mutation.Conditions(); !ok {
+		return &ValidationError{Name: "conditions", err: errors.New(`ent: missing required field "LabelTagging.conditions"`)}
+	}
+	return nil
+}
+
+func (ltc *LabelTaggingCreate) sqlSave(ctx context.Context) (*LabelTagging, error) {
+	if err := ltc.check(); err != nil {
+		return nil, err
+	}
+	_node, _spec := ltc.createSpec()
+	if err := sqlgraph.CreateNode(ctx, ltc.driver, _spec); err != nil {
+		if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return nil, err
+	}
+	if _spec.ID.Value != _node.ID {
+		id := _spec.ID.Value.(int64)
+		_node.ID = uint64(id)
+	}
+	ltc.mutation.id = &_node.ID
+	ltc.mutation.done = true
+	return _node, nil
+}
+
+func (ltc *LabelTaggingCreate) createSpec() (*LabelTagging, *sqlgraph.CreateSpec) {
+	var (
+		_node = &LabelTagging{config: ltc.config}
+		_spec = sqlgraph.NewCreateSpec(labeltagging.Table, sqlgraph.NewFieldSpec(labeltagging.FieldID, field.TypeUint64))
+	)
+	_spec.OnConflict = ltc.conflict
+	if id, ok := ltc.mutation.ID(); ok {
+		_node.ID = id
+		_spec.ID.Value = id
+	}
+	if value, ok := ltc.mutation.CreatedAt(); ok {
+		_spec.SetField(labeltagging.FieldCreatedAt, field.TypeTime, value)
+		_node.CreatedAt = value
+	}
+	if value, ok := ltc.mutation.UpdatedAt(); ok {
+		_spec.SetField(labeltagging.FieldUpdatedAt, field.TypeTime, value)
+		_node.UpdatedAt = value
+	}
+	if value, ok := ltc.mutation.Status(); ok {
+		_spec.SetField(labeltagging.FieldStatus, field.TypeUint8, value)
+		_node.Status = value
+	}
+	if value, ok := ltc.mutation.DeletedAt(); ok {
+		_spec.SetField(labeltagging.FieldDeletedAt, field.TypeTime, value)
+		_node.DeletedAt = value
+	}
+	if value, ok := ltc.mutation.OrganizationID(); ok {
+		_spec.SetField(labeltagging.FieldOrganizationID, field.TypeUint64, value)
+		_node.OrganizationID = value
+	}
+	if value, ok := ltc.mutation.GetType(); ok {
+		_spec.SetField(labeltagging.FieldType, field.TypeInt, value)
+		_node.Type = value
+	}
+	if value, ok := ltc.mutation.Conditions(); ok {
+		_spec.SetField(labeltagging.FieldConditions, field.TypeString, value)
+		_node.Conditions = value
+	}
+	if value, ok := ltc.mutation.ActionLabelAdd(); ok {
+		_spec.SetField(labeltagging.FieldActionLabelAdd, field.TypeJSON, value)
+		_node.ActionLabelAdd = value
+	}
+	if value, ok := ltc.mutation.ActionLabelDel(); ok {
+		_spec.SetField(labeltagging.FieldActionLabelDel, field.TypeJSON, value)
+		_node.ActionLabelDel = value
+	}
+	return _node, _spec
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+//	client.LabelTagging.Create().
+//		SetCreatedAt(v).
+//		OnConflict(
+//			// Update the row with the new values
+//			// the was proposed for insertion.
+//			sql.ResolveWithNewValues(),
+//		).
+//		// Override some of the fields with custom
+//		// update values.
+//		Update(func(u *ent.LabelTaggingUpsert) {
+//			SetCreatedAt(v+v).
+//		}).
+//		Exec(ctx)
+func (ltc *LabelTaggingCreate) OnConflict(opts ...sql.ConflictOption) *LabelTaggingUpsertOne {
+	ltc.conflict = opts
+	return &LabelTaggingUpsertOne{
+		create: ltc,
+	}
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+//	client.LabelTagging.Create().
+//		OnConflict(sql.ConflictColumns(columns...)).
+//		Exec(ctx)
+func (ltc *LabelTaggingCreate) OnConflictColumns(columns ...string) *LabelTaggingUpsertOne {
+	ltc.conflict = append(ltc.conflict, sql.ConflictColumns(columns...))
+	return &LabelTaggingUpsertOne{
+		create: ltc,
+	}
+}
+
+type (
+	// LabelTaggingUpsertOne is the builder for "upsert"-ing
+	//  one LabelTagging node.
+	LabelTaggingUpsertOne struct {
+		create *LabelTaggingCreate
+	}
+
+	// LabelTaggingUpsert is the "OnConflict" setter.
+	LabelTaggingUpsert struct {
+		*sql.UpdateSet
+	}
+)
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *LabelTaggingUpsert) SetUpdatedAt(v time.Time) *LabelTaggingUpsert {
+	u.Set(labeltagging.FieldUpdatedAt, v)
+	return u
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *LabelTaggingUpsert) UpdateUpdatedAt() *LabelTaggingUpsert {
+	u.SetExcluded(labeltagging.FieldUpdatedAt)
+	return u
+}
+
+// SetStatus sets the "status" field.
+func (u *LabelTaggingUpsert) SetStatus(v uint8) *LabelTaggingUpsert {
+	u.Set(labeltagging.FieldStatus, v)
+	return u
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *LabelTaggingUpsert) UpdateStatus() *LabelTaggingUpsert {
+	u.SetExcluded(labeltagging.FieldStatus)
+	return u
+}
+
+// AddStatus adds v to the "status" field.
+func (u *LabelTaggingUpsert) AddStatus(v uint8) *LabelTaggingUpsert {
+	u.Add(labeltagging.FieldStatus, v)
+	return u
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *LabelTaggingUpsert) ClearStatus() *LabelTaggingUpsert {
+	u.SetNull(labeltagging.FieldStatus)
+	return u
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *LabelTaggingUpsert) SetDeletedAt(v time.Time) *LabelTaggingUpsert {
+	u.Set(labeltagging.FieldDeletedAt, v)
+	return u
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *LabelTaggingUpsert) UpdateDeletedAt() *LabelTaggingUpsert {
+	u.SetExcluded(labeltagging.FieldDeletedAt)
+	return u
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *LabelTaggingUpsert) ClearDeletedAt() *LabelTaggingUpsert {
+	u.SetNull(labeltagging.FieldDeletedAt)
+	return u
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (u *LabelTaggingUpsert) SetOrganizationID(v uint64) *LabelTaggingUpsert {
+	u.Set(labeltagging.FieldOrganizationID, v)
+	return u
+}
+
+// UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
+func (u *LabelTaggingUpsert) UpdateOrganizationID() *LabelTaggingUpsert {
+	u.SetExcluded(labeltagging.FieldOrganizationID)
+	return u
+}
+
+// AddOrganizationID adds v to the "organization_id" field.
+func (u *LabelTaggingUpsert) AddOrganizationID(v uint64) *LabelTaggingUpsert {
+	u.Add(labeltagging.FieldOrganizationID, v)
+	return u
+}
+
+// SetType sets the "type" field.
+func (u *LabelTaggingUpsert) SetType(v int) *LabelTaggingUpsert {
+	u.Set(labeltagging.FieldType, v)
+	return u
+}
+
+// UpdateType sets the "type" field to the value that was provided on create.
+func (u *LabelTaggingUpsert) UpdateType() *LabelTaggingUpsert {
+	u.SetExcluded(labeltagging.FieldType)
+	return u
+}
+
+// AddType adds v to the "type" field.
+func (u *LabelTaggingUpsert) AddType(v int) *LabelTaggingUpsert {
+	u.Add(labeltagging.FieldType, v)
+	return u
+}
+
+// SetConditions sets the "conditions" field.
+func (u *LabelTaggingUpsert) SetConditions(v string) *LabelTaggingUpsert {
+	u.Set(labeltagging.FieldConditions, v)
+	return u
+}
+
+// UpdateConditions sets the "conditions" field to the value that was provided on create.
+func (u *LabelTaggingUpsert) UpdateConditions() *LabelTaggingUpsert {
+	u.SetExcluded(labeltagging.FieldConditions)
+	return u
+}
+
+// SetActionLabelAdd sets the "action_label_add" field.
+func (u *LabelTaggingUpsert) SetActionLabelAdd(v []uint64) *LabelTaggingUpsert {
+	u.Set(labeltagging.FieldActionLabelAdd, v)
+	return u
+}
+
+// UpdateActionLabelAdd sets the "action_label_add" field to the value that was provided on create.
+func (u *LabelTaggingUpsert) UpdateActionLabelAdd() *LabelTaggingUpsert {
+	u.SetExcluded(labeltagging.FieldActionLabelAdd)
+	return u
+}
+
+// ClearActionLabelAdd clears the value of the "action_label_add" field.
+func (u *LabelTaggingUpsert) ClearActionLabelAdd() *LabelTaggingUpsert {
+	u.SetNull(labeltagging.FieldActionLabelAdd)
+	return u
+}
+
+// SetActionLabelDel sets the "action_label_del" field.
+func (u *LabelTaggingUpsert) SetActionLabelDel(v []uint64) *LabelTaggingUpsert {
+	u.Set(labeltagging.FieldActionLabelDel, v)
+	return u
+}
+
+// UpdateActionLabelDel sets the "action_label_del" field to the value that was provided on create.
+func (u *LabelTaggingUpsert) UpdateActionLabelDel() *LabelTaggingUpsert {
+	u.SetExcluded(labeltagging.FieldActionLabelDel)
+	return u
+}
+
+// ClearActionLabelDel clears the value of the "action_label_del" field.
+func (u *LabelTaggingUpsert) ClearActionLabelDel() *LabelTaggingUpsert {
+	u.SetNull(labeltagging.FieldActionLabelDel)
+	return u
+}
+
+// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field.
+// Using this option is equivalent to using:
+//
+//	client.LabelTagging.Create().
+//		OnConflict(
+//			sql.ResolveWithNewValues(),
+//			sql.ResolveWith(func(u *sql.UpdateSet) {
+//				u.SetIgnore(labeltagging.FieldID)
+//			}),
+//		).
+//		Exec(ctx)
+func (u *LabelTaggingUpsertOne) UpdateNewValues() *LabelTaggingUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+		if _, exists := u.create.mutation.ID(); exists {
+			s.SetIgnore(labeltagging.FieldID)
+		}
+		if _, exists := u.create.mutation.CreatedAt(); exists {
+			s.SetIgnore(labeltagging.FieldCreatedAt)
+		}
+	}))
+	return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+//	client.LabelTagging.Create().
+//	    OnConflict(sql.ResolveWithIgnore()).
+//	    Exec(ctx)
+func (u *LabelTaggingUpsertOne) Ignore() *LabelTaggingUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+	return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *LabelTaggingUpsertOne) DoNothing() *LabelTaggingUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.DoNothing())
+	return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the LabelTaggingCreate.OnConflict
+// documentation for more info.
+func (u *LabelTaggingUpsertOne) Update(set func(*LabelTaggingUpsert)) *LabelTaggingUpsertOne {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+		set(&LabelTaggingUpsert{UpdateSet: update})
+	}))
+	return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *LabelTaggingUpsertOne) SetUpdatedAt(v time.Time) *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetUpdatedAt(v)
+	})
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *LabelTaggingUpsertOne) UpdateUpdatedAt() *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateUpdatedAt()
+	})
+}
+
+// SetStatus sets the "status" field.
+func (u *LabelTaggingUpsertOne) SetStatus(v uint8) *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetStatus(v)
+	})
+}
+
+// AddStatus adds v to the "status" field.
+func (u *LabelTaggingUpsertOne) AddStatus(v uint8) *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.AddStatus(v)
+	})
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *LabelTaggingUpsertOne) UpdateStatus() *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateStatus()
+	})
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *LabelTaggingUpsertOne) ClearStatus() *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.ClearStatus()
+	})
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *LabelTaggingUpsertOne) SetDeletedAt(v time.Time) *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetDeletedAt(v)
+	})
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *LabelTaggingUpsertOne) UpdateDeletedAt() *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateDeletedAt()
+	})
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *LabelTaggingUpsertOne) ClearDeletedAt() *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.ClearDeletedAt()
+	})
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (u *LabelTaggingUpsertOne) SetOrganizationID(v uint64) *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetOrganizationID(v)
+	})
+}
+
+// AddOrganizationID adds v to the "organization_id" field.
+func (u *LabelTaggingUpsertOne) AddOrganizationID(v uint64) *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.AddOrganizationID(v)
+	})
+}
+
+// UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
+func (u *LabelTaggingUpsertOne) UpdateOrganizationID() *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateOrganizationID()
+	})
+}
+
+// SetType sets the "type" field.
+func (u *LabelTaggingUpsertOne) SetType(v int) *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetType(v)
+	})
+}
+
+// AddType adds v to the "type" field.
+func (u *LabelTaggingUpsertOne) AddType(v int) *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.AddType(v)
+	})
+}
+
+// UpdateType sets the "type" field to the value that was provided on create.
+func (u *LabelTaggingUpsertOne) UpdateType() *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateType()
+	})
+}
+
+// SetConditions sets the "conditions" field.
+func (u *LabelTaggingUpsertOne) SetConditions(v string) *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetConditions(v)
+	})
+}
+
+// UpdateConditions sets the "conditions" field to the value that was provided on create.
+func (u *LabelTaggingUpsertOne) UpdateConditions() *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateConditions()
+	})
+}
+
+// SetActionLabelAdd sets the "action_label_add" field.
+func (u *LabelTaggingUpsertOne) SetActionLabelAdd(v []uint64) *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetActionLabelAdd(v)
+	})
+}
+
+// UpdateActionLabelAdd sets the "action_label_add" field to the value that was provided on create.
+func (u *LabelTaggingUpsertOne) UpdateActionLabelAdd() *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateActionLabelAdd()
+	})
+}
+
+// ClearActionLabelAdd clears the value of the "action_label_add" field.
+func (u *LabelTaggingUpsertOne) ClearActionLabelAdd() *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.ClearActionLabelAdd()
+	})
+}
+
+// SetActionLabelDel sets the "action_label_del" field.
+func (u *LabelTaggingUpsertOne) SetActionLabelDel(v []uint64) *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetActionLabelDel(v)
+	})
+}
+
+// UpdateActionLabelDel sets the "action_label_del" field to the value that was provided on create.
+func (u *LabelTaggingUpsertOne) UpdateActionLabelDel() *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateActionLabelDel()
+	})
+}
+
+// ClearActionLabelDel clears the value of the "action_label_del" field.
+func (u *LabelTaggingUpsertOne) ClearActionLabelDel() *LabelTaggingUpsertOne {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.ClearActionLabelDel()
+	})
+}
+
+// Exec executes the query.
+func (u *LabelTaggingUpsertOne) Exec(ctx context.Context) error {
+	if len(u.create.conflict) == 0 {
+		return errors.New("ent: missing options for LabelTaggingCreate.OnConflict")
+	}
+	return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *LabelTaggingUpsertOne) ExecX(ctx context.Context) {
+	if err := u.create.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// Exec executes the UPSERT query and returns the inserted/updated ID.
+func (u *LabelTaggingUpsertOne) ID(ctx context.Context) (id uint64, err error) {
+	node, err := u.create.Save(ctx)
+	if err != nil {
+		return id, err
+	}
+	return node.ID, nil
+}
+
+// IDX is like ID, but panics if an error occurs.
+func (u *LabelTaggingUpsertOne) IDX(ctx context.Context) uint64 {
+	id, err := u.ID(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return id
+}
+
+// LabelTaggingCreateBulk is the builder for creating many LabelTagging entities in bulk.
+type LabelTaggingCreateBulk struct {
+	config
+	err      error
+	builders []*LabelTaggingCreate
+	conflict []sql.ConflictOption
+}
+
+// Save creates the LabelTagging entities in the database.
+func (ltcb *LabelTaggingCreateBulk) Save(ctx context.Context) ([]*LabelTagging, error) {
+	if ltcb.err != nil {
+		return nil, ltcb.err
+	}
+	specs := make([]*sqlgraph.CreateSpec, len(ltcb.builders))
+	nodes := make([]*LabelTagging, len(ltcb.builders))
+	mutators := make([]Mutator, len(ltcb.builders))
+	for i := range ltcb.builders {
+		func(i int, root context.Context) {
+			builder := ltcb.builders[i]
+			builder.defaults()
+			var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+				mutation, ok := m.(*LabelTaggingMutation)
+				if !ok {
+					return nil, fmt.Errorf("unexpected mutation type %T", m)
+				}
+				if err := builder.check(); err != nil {
+					return nil, err
+				}
+				builder.mutation = mutation
+				var err error
+				nodes[i], specs[i] = builder.createSpec()
+				if i < len(mutators)-1 {
+					_, err = mutators[i+1].Mutate(root, ltcb.builders[i+1].mutation)
+				} else {
+					spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+					spec.OnConflict = ltcb.conflict
+					// Invoke the actual operation on the latest mutation in the chain.
+					if err = sqlgraph.BatchCreate(ctx, ltcb.driver, spec); err != nil {
+						if sqlgraph.IsConstraintError(err) {
+							err = &ConstraintError{msg: err.Error(), wrap: err}
+						}
+					}
+				}
+				if err != nil {
+					return nil, err
+				}
+				mutation.id = &nodes[i].ID
+				if specs[i].ID.Value != nil && nodes[i].ID == 0 {
+					id := specs[i].ID.Value.(int64)
+					nodes[i].ID = uint64(id)
+				}
+				mutation.done = true
+				return nodes[i], nil
+			})
+			for i := len(builder.hooks) - 1; i >= 0; i-- {
+				mut = builder.hooks[i](mut)
+			}
+			mutators[i] = mut
+		}(i, ctx)
+	}
+	if len(mutators) > 0 {
+		if _, err := mutators[0].Mutate(ctx, ltcb.builders[0].mutation); err != nil {
+			return nil, err
+		}
+	}
+	return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (ltcb *LabelTaggingCreateBulk) SaveX(ctx context.Context) []*LabelTagging {
+	v, err := ltcb.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return v
+}
+
+// Exec executes the query.
+func (ltcb *LabelTaggingCreateBulk) Exec(ctx context.Context) error {
+	_, err := ltcb.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ltcb *LabelTaggingCreateBulk) ExecX(ctx context.Context) {
+	if err := ltcb.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
+// of the `INSERT` statement. For example:
+//
+//	client.LabelTagging.CreateBulk(builders...).
+//		OnConflict(
+//			// Update the row with the new values
+//			// the was proposed for insertion.
+//			sql.ResolveWithNewValues(),
+//		).
+//		// Override some of the fields with custom
+//		// update values.
+//		Update(func(u *ent.LabelTaggingUpsert) {
+//			SetCreatedAt(v+v).
+//		}).
+//		Exec(ctx)
+func (ltcb *LabelTaggingCreateBulk) OnConflict(opts ...sql.ConflictOption) *LabelTaggingUpsertBulk {
+	ltcb.conflict = opts
+	return &LabelTaggingUpsertBulk{
+		create: ltcb,
+	}
+}
+
+// OnConflictColumns calls `OnConflict` and configures the columns
+// as conflict target. Using this option is equivalent to using:
+//
+//	client.LabelTagging.Create().
+//		OnConflict(sql.ConflictColumns(columns...)).
+//		Exec(ctx)
+func (ltcb *LabelTaggingCreateBulk) OnConflictColumns(columns ...string) *LabelTaggingUpsertBulk {
+	ltcb.conflict = append(ltcb.conflict, sql.ConflictColumns(columns...))
+	return &LabelTaggingUpsertBulk{
+		create: ltcb,
+	}
+}
+
+// LabelTaggingUpsertBulk is the builder for "upsert"-ing
+// a bulk of LabelTagging nodes.
+type LabelTaggingUpsertBulk struct {
+	create *LabelTaggingCreateBulk
+}
+
+// UpdateNewValues updates the mutable fields using the new values that
+// were set on create. Using this option is equivalent to using:
+//
+//	client.LabelTagging.Create().
+//		OnConflict(
+//			sql.ResolveWithNewValues(),
+//			sql.ResolveWith(func(u *sql.UpdateSet) {
+//				u.SetIgnore(labeltagging.FieldID)
+//			}),
+//		).
+//		Exec(ctx)
+func (u *LabelTaggingUpsertBulk) UpdateNewValues() *LabelTaggingUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) {
+		for _, b := range u.create.builders {
+			if _, exists := b.mutation.ID(); exists {
+				s.SetIgnore(labeltagging.FieldID)
+			}
+			if _, exists := b.mutation.CreatedAt(); exists {
+				s.SetIgnore(labeltagging.FieldCreatedAt)
+			}
+		}
+	}))
+	return u
+}
+
+// Ignore sets each column to itself in case of conflict.
+// Using this option is equivalent to using:
+//
+//	client.LabelTagging.Create().
+//		OnConflict(sql.ResolveWithIgnore()).
+//		Exec(ctx)
+func (u *LabelTaggingUpsertBulk) Ignore() *LabelTaggingUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
+	return u
+}
+
+// DoNothing configures the conflict_action to `DO NOTHING`.
+// Supported only by SQLite and PostgreSQL.
+func (u *LabelTaggingUpsertBulk) DoNothing() *LabelTaggingUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.DoNothing())
+	return u
+}
+
+// Update allows overriding fields `UPDATE` values. See the LabelTaggingCreateBulk.OnConflict
+// documentation for more info.
+func (u *LabelTaggingUpsertBulk) Update(set func(*LabelTaggingUpsert)) *LabelTaggingUpsertBulk {
+	u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
+		set(&LabelTaggingUpsert{UpdateSet: update})
+	}))
+	return u
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (u *LabelTaggingUpsertBulk) SetUpdatedAt(v time.Time) *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetUpdatedAt(v)
+	})
+}
+
+// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create.
+func (u *LabelTaggingUpsertBulk) UpdateUpdatedAt() *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateUpdatedAt()
+	})
+}
+
+// SetStatus sets the "status" field.
+func (u *LabelTaggingUpsertBulk) SetStatus(v uint8) *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetStatus(v)
+	})
+}
+
+// AddStatus adds v to the "status" field.
+func (u *LabelTaggingUpsertBulk) AddStatus(v uint8) *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.AddStatus(v)
+	})
+}
+
+// UpdateStatus sets the "status" field to the value that was provided on create.
+func (u *LabelTaggingUpsertBulk) UpdateStatus() *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateStatus()
+	})
+}
+
+// ClearStatus clears the value of the "status" field.
+func (u *LabelTaggingUpsertBulk) ClearStatus() *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.ClearStatus()
+	})
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (u *LabelTaggingUpsertBulk) SetDeletedAt(v time.Time) *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetDeletedAt(v)
+	})
+}
+
+// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create.
+func (u *LabelTaggingUpsertBulk) UpdateDeletedAt() *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateDeletedAt()
+	})
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (u *LabelTaggingUpsertBulk) ClearDeletedAt() *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.ClearDeletedAt()
+	})
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (u *LabelTaggingUpsertBulk) SetOrganizationID(v uint64) *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetOrganizationID(v)
+	})
+}
+
+// AddOrganizationID adds v to the "organization_id" field.
+func (u *LabelTaggingUpsertBulk) AddOrganizationID(v uint64) *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.AddOrganizationID(v)
+	})
+}
+
+// UpdateOrganizationID sets the "organization_id" field to the value that was provided on create.
+func (u *LabelTaggingUpsertBulk) UpdateOrganizationID() *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateOrganizationID()
+	})
+}
+
+// SetType sets the "type" field.
+func (u *LabelTaggingUpsertBulk) SetType(v int) *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetType(v)
+	})
+}
+
+// AddType adds v to the "type" field.
+func (u *LabelTaggingUpsertBulk) AddType(v int) *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.AddType(v)
+	})
+}
+
+// UpdateType sets the "type" field to the value that was provided on create.
+func (u *LabelTaggingUpsertBulk) UpdateType() *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateType()
+	})
+}
+
+// SetConditions sets the "conditions" field.
+func (u *LabelTaggingUpsertBulk) SetConditions(v string) *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetConditions(v)
+	})
+}
+
+// UpdateConditions sets the "conditions" field to the value that was provided on create.
+func (u *LabelTaggingUpsertBulk) UpdateConditions() *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateConditions()
+	})
+}
+
+// SetActionLabelAdd sets the "action_label_add" field.
+func (u *LabelTaggingUpsertBulk) SetActionLabelAdd(v []uint64) *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetActionLabelAdd(v)
+	})
+}
+
+// UpdateActionLabelAdd sets the "action_label_add" field to the value that was provided on create.
+func (u *LabelTaggingUpsertBulk) UpdateActionLabelAdd() *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateActionLabelAdd()
+	})
+}
+
+// ClearActionLabelAdd clears the value of the "action_label_add" field.
+func (u *LabelTaggingUpsertBulk) ClearActionLabelAdd() *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.ClearActionLabelAdd()
+	})
+}
+
+// SetActionLabelDel sets the "action_label_del" field.
+func (u *LabelTaggingUpsertBulk) SetActionLabelDel(v []uint64) *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.SetActionLabelDel(v)
+	})
+}
+
+// UpdateActionLabelDel sets the "action_label_del" field to the value that was provided on create.
+func (u *LabelTaggingUpsertBulk) UpdateActionLabelDel() *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.UpdateActionLabelDel()
+	})
+}
+
+// ClearActionLabelDel clears the value of the "action_label_del" field.
+func (u *LabelTaggingUpsertBulk) ClearActionLabelDel() *LabelTaggingUpsertBulk {
+	return u.Update(func(s *LabelTaggingUpsert) {
+		s.ClearActionLabelDel()
+	})
+}
+
+// Exec executes the query.
+func (u *LabelTaggingUpsertBulk) Exec(ctx context.Context) error {
+	if u.create.err != nil {
+		return u.create.err
+	}
+	for i, b := range u.create.builders {
+		if len(b.conflict) != 0 {
+			return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the LabelTaggingCreateBulk instead", i)
+		}
+	}
+	if len(u.create.conflict) == 0 {
+		return errors.New("ent: missing options for LabelTaggingCreateBulk.OnConflict")
+	}
+	return u.create.Exec(ctx)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (u *LabelTaggingUpsertBulk) ExecX(ctx context.Context) {
+	if err := u.create.Exec(ctx); err != nil {
+		panic(err)
+	}
+}

+ 88 - 0
ent/labeltagging_delete.go

@@ -0,0 +1,88 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"wechat-api/ent/labeltagging"
+	"wechat-api/ent/predicate"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// LabelTaggingDelete is the builder for deleting a LabelTagging entity.
+type LabelTaggingDelete struct {
+	config
+	hooks    []Hook
+	mutation *LabelTaggingMutation
+}
+
+// Where appends a list predicates to the LabelTaggingDelete builder.
+func (ltd *LabelTaggingDelete) Where(ps ...predicate.LabelTagging) *LabelTaggingDelete {
+	ltd.mutation.Where(ps...)
+	return ltd
+}
+
+// Exec executes the deletion query and returns how many vertices were deleted.
+func (ltd *LabelTaggingDelete) Exec(ctx context.Context) (int, error) {
+	return withHooks(ctx, ltd.sqlExec, ltd.mutation, ltd.hooks)
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ltd *LabelTaggingDelete) ExecX(ctx context.Context) int {
+	n, err := ltd.Exec(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return n
+}
+
+func (ltd *LabelTaggingDelete) sqlExec(ctx context.Context) (int, error) {
+	_spec := sqlgraph.NewDeleteSpec(labeltagging.Table, sqlgraph.NewFieldSpec(labeltagging.FieldID, field.TypeUint64))
+	if ps := ltd.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	affected, err := sqlgraph.DeleteNodes(ctx, ltd.driver, _spec)
+	if err != nil && sqlgraph.IsConstraintError(err) {
+		err = &ConstraintError{msg: err.Error(), wrap: err}
+	}
+	ltd.mutation.done = true
+	return affected, err
+}
+
+// LabelTaggingDeleteOne is the builder for deleting a single LabelTagging entity.
+type LabelTaggingDeleteOne struct {
+	ltd *LabelTaggingDelete
+}
+
+// Where appends a list predicates to the LabelTaggingDelete builder.
+func (ltdo *LabelTaggingDeleteOne) Where(ps ...predicate.LabelTagging) *LabelTaggingDeleteOne {
+	ltdo.ltd.mutation.Where(ps...)
+	return ltdo
+}
+
+// Exec executes the deletion query.
+func (ltdo *LabelTaggingDeleteOne) Exec(ctx context.Context) error {
+	n, err := ltdo.ltd.Exec(ctx)
+	switch {
+	case err != nil:
+		return err
+	case n == 0:
+		return &NotFoundError{labeltagging.Label}
+	default:
+		return nil
+	}
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ltdo *LabelTaggingDeleteOne) ExecX(ctx context.Context) {
+	if err := ltdo.Exec(ctx); err != nil {
+		panic(err)
+	}
+}

+ 526 - 0
ent/labeltagging_query.go

@@ -0,0 +1,526 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"fmt"
+	"math"
+	"wechat-api/ent/labeltagging"
+	"wechat-api/ent/predicate"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/schema/field"
+)
+
+// LabelTaggingQuery is the builder for querying LabelTagging entities.
+type LabelTaggingQuery struct {
+	config
+	ctx        *QueryContext
+	order      []labeltagging.OrderOption
+	inters     []Interceptor
+	predicates []predicate.LabelTagging
+	// intermediate query (i.e. traversal path).
+	sql  *sql.Selector
+	path func(context.Context) (*sql.Selector, error)
+}
+
+// Where adds a new predicate for the LabelTaggingQuery builder.
+func (ltq *LabelTaggingQuery) Where(ps ...predicate.LabelTagging) *LabelTaggingQuery {
+	ltq.predicates = append(ltq.predicates, ps...)
+	return ltq
+}
+
+// Limit the number of records to be returned by this query.
+func (ltq *LabelTaggingQuery) Limit(limit int) *LabelTaggingQuery {
+	ltq.ctx.Limit = &limit
+	return ltq
+}
+
+// Offset to start from.
+func (ltq *LabelTaggingQuery) Offset(offset int) *LabelTaggingQuery {
+	ltq.ctx.Offset = &offset
+	return ltq
+}
+
+// Unique configures the query builder to filter duplicate records on query.
+// By default, unique is set to true, and can be disabled using this method.
+func (ltq *LabelTaggingQuery) Unique(unique bool) *LabelTaggingQuery {
+	ltq.ctx.Unique = &unique
+	return ltq
+}
+
+// Order specifies how the records should be ordered.
+func (ltq *LabelTaggingQuery) Order(o ...labeltagging.OrderOption) *LabelTaggingQuery {
+	ltq.order = append(ltq.order, o...)
+	return ltq
+}
+
+// First returns the first LabelTagging entity from the query.
+// Returns a *NotFoundError when no LabelTagging was found.
+func (ltq *LabelTaggingQuery) First(ctx context.Context) (*LabelTagging, error) {
+	nodes, err := ltq.Limit(1).All(setContextOp(ctx, ltq.ctx, "First"))
+	if err != nil {
+		return nil, err
+	}
+	if len(nodes) == 0 {
+		return nil, &NotFoundError{labeltagging.Label}
+	}
+	return nodes[0], nil
+}
+
+// FirstX is like First, but panics if an error occurs.
+func (ltq *LabelTaggingQuery) FirstX(ctx context.Context) *LabelTagging {
+	node, err := ltq.First(ctx)
+	if err != nil && !IsNotFound(err) {
+		panic(err)
+	}
+	return node
+}
+
+// FirstID returns the first LabelTagging ID from the query.
+// Returns a *NotFoundError when no LabelTagging ID was found.
+func (ltq *LabelTaggingQuery) FirstID(ctx context.Context) (id uint64, err error) {
+	var ids []uint64
+	if ids, err = ltq.Limit(1).IDs(setContextOp(ctx, ltq.ctx, "FirstID")); err != nil {
+		return
+	}
+	if len(ids) == 0 {
+		err = &NotFoundError{labeltagging.Label}
+		return
+	}
+	return ids[0], nil
+}
+
+// FirstIDX is like FirstID, but panics if an error occurs.
+func (ltq *LabelTaggingQuery) FirstIDX(ctx context.Context) uint64 {
+	id, err := ltq.FirstID(ctx)
+	if err != nil && !IsNotFound(err) {
+		panic(err)
+	}
+	return id
+}
+
+// Only returns a single LabelTagging entity found by the query, ensuring it only returns one.
+// Returns a *NotSingularError when more than one LabelTagging entity is found.
+// Returns a *NotFoundError when no LabelTagging entities are found.
+func (ltq *LabelTaggingQuery) Only(ctx context.Context) (*LabelTagging, error) {
+	nodes, err := ltq.Limit(2).All(setContextOp(ctx, ltq.ctx, "Only"))
+	if err != nil {
+		return nil, err
+	}
+	switch len(nodes) {
+	case 1:
+		return nodes[0], nil
+	case 0:
+		return nil, &NotFoundError{labeltagging.Label}
+	default:
+		return nil, &NotSingularError{labeltagging.Label}
+	}
+}
+
+// OnlyX is like Only, but panics if an error occurs.
+func (ltq *LabelTaggingQuery) OnlyX(ctx context.Context) *LabelTagging {
+	node, err := ltq.Only(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return node
+}
+
+// OnlyID is like Only, but returns the only LabelTagging ID in the query.
+// Returns a *NotSingularError when more than one LabelTagging ID is found.
+// Returns a *NotFoundError when no entities are found.
+func (ltq *LabelTaggingQuery) OnlyID(ctx context.Context) (id uint64, err error) {
+	var ids []uint64
+	if ids, err = ltq.Limit(2).IDs(setContextOp(ctx, ltq.ctx, "OnlyID")); err != nil {
+		return
+	}
+	switch len(ids) {
+	case 1:
+		id = ids[0]
+	case 0:
+		err = &NotFoundError{labeltagging.Label}
+	default:
+		err = &NotSingularError{labeltagging.Label}
+	}
+	return
+}
+
+// OnlyIDX is like OnlyID, but panics if an error occurs.
+func (ltq *LabelTaggingQuery) OnlyIDX(ctx context.Context) uint64 {
+	id, err := ltq.OnlyID(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return id
+}
+
+// All executes the query and returns a list of LabelTaggings.
+func (ltq *LabelTaggingQuery) All(ctx context.Context) ([]*LabelTagging, error) {
+	ctx = setContextOp(ctx, ltq.ctx, "All")
+	if err := ltq.prepareQuery(ctx); err != nil {
+		return nil, err
+	}
+	qr := querierAll[[]*LabelTagging, *LabelTaggingQuery]()
+	return withInterceptors[[]*LabelTagging](ctx, ltq, qr, ltq.inters)
+}
+
+// AllX is like All, but panics if an error occurs.
+func (ltq *LabelTaggingQuery) AllX(ctx context.Context) []*LabelTagging {
+	nodes, err := ltq.All(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return nodes
+}
+
+// IDs executes the query and returns a list of LabelTagging IDs.
+func (ltq *LabelTaggingQuery) IDs(ctx context.Context) (ids []uint64, err error) {
+	if ltq.ctx.Unique == nil && ltq.path != nil {
+		ltq.Unique(true)
+	}
+	ctx = setContextOp(ctx, ltq.ctx, "IDs")
+	if err = ltq.Select(labeltagging.FieldID).Scan(ctx, &ids); err != nil {
+		return nil, err
+	}
+	return ids, nil
+}
+
+// IDsX is like IDs, but panics if an error occurs.
+func (ltq *LabelTaggingQuery) IDsX(ctx context.Context) []uint64 {
+	ids, err := ltq.IDs(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return ids
+}
+
+// Count returns the count of the given query.
+func (ltq *LabelTaggingQuery) Count(ctx context.Context) (int, error) {
+	ctx = setContextOp(ctx, ltq.ctx, "Count")
+	if err := ltq.prepareQuery(ctx); err != nil {
+		return 0, err
+	}
+	return withInterceptors[int](ctx, ltq, querierCount[*LabelTaggingQuery](), ltq.inters)
+}
+
+// CountX is like Count, but panics if an error occurs.
+func (ltq *LabelTaggingQuery) CountX(ctx context.Context) int {
+	count, err := ltq.Count(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return count
+}
+
+// Exist returns true if the query has elements in the graph.
+func (ltq *LabelTaggingQuery) Exist(ctx context.Context) (bool, error) {
+	ctx = setContextOp(ctx, ltq.ctx, "Exist")
+	switch _, err := ltq.FirstID(ctx); {
+	case IsNotFound(err):
+		return false, nil
+	case err != nil:
+		return false, fmt.Errorf("ent: check existence: %w", err)
+	default:
+		return true, nil
+	}
+}
+
+// ExistX is like Exist, but panics if an error occurs.
+func (ltq *LabelTaggingQuery) ExistX(ctx context.Context) bool {
+	exist, err := ltq.Exist(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return exist
+}
+
+// Clone returns a duplicate of the LabelTaggingQuery builder, including all associated steps. It can be
+// used to prepare common query builders and use them differently after the clone is made.
+func (ltq *LabelTaggingQuery) Clone() *LabelTaggingQuery {
+	if ltq == nil {
+		return nil
+	}
+	return &LabelTaggingQuery{
+		config:     ltq.config,
+		ctx:        ltq.ctx.Clone(),
+		order:      append([]labeltagging.OrderOption{}, ltq.order...),
+		inters:     append([]Interceptor{}, ltq.inters...),
+		predicates: append([]predicate.LabelTagging{}, ltq.predicates...),
+		// clone intermediate query.
+		sql:  ltq.sql.Clone(),
+		path: ltq.path,
+	}
+}
+
+// GroupBy is used to group vertices by one or more fields/columns.
+// It is often used with aggregate functions, like: count, max, mean, min, sum.
+//
+// Example:
+//
+//	var v []struct {
+//		CreatedAt time.Time `json:"created_at,omitempty"`
+//		Count int `json:"count,omitempty"`
+//	}
+//
+//	client.LabelTagging.Query().
+//		GroupBy(labeltagging.FieldCreatedAt).
+//		Aggregate(ent.Count()).
+//		Scan(ctx, &v)
+func (ltq *LabelTaggingQuery) GroupBy(field string, fields ...string) *LabelTaggingGroupBy {
+	ltq.ctx.Fields = append([]string{field}, fields...)
+	grbuild := &LabelTaggingGroupBy{build: ltq}
+	grbuild.flds = &ltq.ctx.Fields
+	grbuild.label = labeltagging.Label
+	grbuild.scan = grbuild.Scan
+	return grbuild
+}
+
+// Select allows the selection one or more fields/columns for the given query,
+// instead of selecting all fields in the entity.
+//
+// Example:
+//
+//	var v []struct {
+//		CreatedAt time.Time `json:"created_at,omitempty"`
+//	}
+//
+//	client.LabelTagging.Query().
+//		Select(labeltagging.FieldCreatedAt).
+//		Scan(ctx, &v)
+func (ltq *LabelTaggingQuery) Select(fields ...string) *LabelTaggingSelect {
+	ltq.ctx.Fields = append(ltq.ctx.Fields, fields...)
+	sbuild := &LabelTaggingSelect{LabelTaggingQuery: ltq}
+	sbuild.label = labeltagging.Label
+	sbuild.flds, sbuild.scan = &ltq.ctx.Fields, sbuild.Scan
+	return sbuild
+}
+
+// Aggregate returns a LabelTaggingSelect configured with the given aggregations.
+func (ltq *LabelTaggingQuery) Aggregate(fns ...AggregateFunc) *LabelTaggingSelect {
+	return ltq.Select().Aggregate(fns...)
+}
+
+func (ltq *LabelTaggingQuery) prepareQuery(ctx context.Context) error {
+	for _, inter := range ltq.inters {
+		if inter == nil {
+			return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
+		}
+		if trv, ok := inter.(Traverser); ok {
+			if err := trv.Traverse(ctx, ltq); err != nil {
+				return err
+			}
+		}
+	}
+	for _, f := range ltq.ctx.Fields {
+		if !labeltagging.ValidColumn(f) {
+			return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+		}
+	}
+	if ltq.path != nil {
+		prev, err := ltq.path(ctx)
+		if err != nil {
+			return err
+		}
+		ltq.sql = prev
+	}
+	return nil
+}
+
+func (ltq *LabelTaggingQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*LabelTagging, error) {
+	var (
+		nodes = []*LabelTagging{}
+		_spec = ltq.querySpec()
+	)
+	_spec.ScanValues = func(columns []string) ([]any, error) {
+		return (*LabelTagging).scanValues(nil, columns)
+	}
+	_spec.Assign = func(columns []string, values []any) error {
+		node := &LabelTagging{config: ltq.config}
+		nodes = append(nodes, node)
+		return node.assignValues(columns, values)
+	}
+	for i := range hooks {
+		hooks[i](ctx, _spec)
+	}
+	if err := sqlgraph.QueryNodes(ctx, ltq.driver, _spec); err != nil {
+		return nil, err
+	}
+	if len(nodes) == 0 {
+		return nodes, nil
+	}
+	return nodes, nil
+}
+
+func (ltq *LabelTaggingQuery) sqlCount(ctx context.Context) (int, error) {
+	_spec := ltq.querySpec()
+	_spec.Node.Columns = ltq.ctx.Fields
+	if len(ltq.ctx.Fields) > 0 {
+		_spec.Unique = ltq.ctx.Unique != nil && *ltq.ctx.Unique
+	}
+	return sqlgraph.CountNodes(ctx, ltq.driver, _spec)
+}
+
+func (ltq *LabelTaggingQuery) querySpec() *sqlgraph.QuerySpec {
+	_spec := sqlgraph.NewQuerySpec(labeltagging.Table, labeltagging.Columns, sqlgraph.NewFieldSpec(labeltagging.FieldID, field.TypeUint64))
+	_spec.From = ltq.sql
+	if unique := ltq.ctx.Unique; unique != nil {
+		_spec.Unique = *unique
+	} else if ltq.path != nil {
+		_spec.Unique = true
+	}
+	if fields := ltq.ctx.Fields; len(fields) > 0 {
+		_spec.Node.Columns = make([]string, 0, len(fields))
+		_spec.Node.Columns = append(_spec.Node.Columns, labeltagging.FieldID)
+		for i := range fields {
+			if fields[i] != labeltagging.FieldID {
+				_spec.Node.Columns = append(_spec.Node.Columns, fields[i])
+			}
+		}
+	}
+	if ps := ltq.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if limit := ltq.ctx.Limit; limit != nil {
+		_spec.Limit = *limit
+	}
+	if offset := ltq.ctx.Offset; offset != nil {
+		_spec.Offset = *offset
+	}
+	if ps := ltq.order; len(ps) > 0 {
+		_spec.Order = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	return _spec
+}
+
+func (ltq *LabelTaggingQuery) sqlQuery(ctx context.Context) *sql.Selector {
+	builder := sql.Dialect(ltq.driver.Dialect())
+	t1 := builder.Table(labeltagging.Table)
+	columns := ltq.ctx.Fields
+	if len(columns) == 0 {
+		columns = labeltagging.Columns
+	}
+	selector := builder.Select(t1.Columns(columns...)...).From(t1)
+	if ltq.sql != nil {
+		selector = ltq.sql
+		selector.Select(selector.Columns(columns...)...)
+	}
+	if ltq.ctx.Unique != nil && *ltq.ctx.Unique {
+		selector.Distinct()
+	}
+	for _, p := range ltq.predicates {
+		p(selector)
+	}
+	for _, p := range ltq.order {
+		p(selector)
+	}
+	if offset := ltq.ctx.Offset; offset != nil {
+		// limit is mandatory for offset clause. We start
+		// with default value, and override it below if needed.
+		selector.Offset(*offset).Limit(math.MaxInt32)
+	}
+	if limit := ltq.ctx.Limit; limit != nil {
+		selector.Limit(*limit)
+	}
+	return selector
+}
+
+// LabelTaggingGroupBy is the group-by builder for LabelTagging entities.
+type LabelTaggingGroupBy struct {
+	selector
+	build *LabelTaggingQuery
+}
+
+// Aggregate adds the given aggregation functions to the group-by query.
+func (ltgb *LabelTaggingGroupBy) Aggregate(fns ...AggregateFunc) *LabelTaggingGroupBy {
+	ltgb.fns = append(ltgb.fns, fns...)
+	return ltgb
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (ltgb *LabelTaggingGroupBy) Scan(ctx context.Context, v any) error {
+	ctx = setContextOp(ctx, ltgb.build.ctx, "GroupBy")
+	if err := ltgb.build.prepareQuery(ctx); err != nil {
+		return err
+	}
+	return scanWithInterceptors[*LabelTaggingQuery, *LabelTaggingGroupBy](ctx, ltgb.build, ltgb, ltgb.build.inters, v)
+}
+
+func (ltgb *LabelTaggingGroupBy) sqlScan(ctx context.Context, root *LabelTaggingQuery, v any) error {
+	selector := root.sqlQuery(ctx).Select()
+	aggregation := make([]string, 0, len(ltgb.fns))
+	for _, fn := range ltgb.fns {
+		aggregation = append(aggregation, fn(selector))
+	}
+	if len(selector.SelectedColumns()) == 0 {
+		columns := make([]string, 0, len(*ltgb.flds)+len(ltgb.fns))
+		for _, f := range *ltgb.flds {
+			columns = append(columns, selector.C(f))
+		}
+		columns = append(columns, aggregation...)
+		selector.Select(columns...)
+	}
+	selector.GroupBy(selector.Columns(*ltgb.flds...)...)
+	if err := selector.Err(); err != nil {
+		return err
+	}
+	rows := &sql.Rows{}
+	query, args := selector.Query()
+	if err := ltgb.build.driver.Query(ctx, query, args, rows); err != nil {
+		return err
+	}
+	defer rows.Close()
+	return sql.ScanSlice(rows, v)
+}
+
+// LabelTaggingSelect is the builder for selecting fields of LabelTagging entities.
+type LabelTaggingSelect struct {
+	*LabelTaggingQuery
+	selector
+}
+
+// Aggregate adds the given aggregation functions to the selector query.
+func (lts *LabelTaggingSelect) Aggregate(fns ...AggregateFunc) *LabelTaggingSelect {
+	lts.fns = append(lts.fns, fns...)
+	return lts
+}
+
+// Scan applies the selector query and scans the result into the given value.
+func (lts *LabelTaggingSelect) Scan(ctx context.Context, v any) error {
+	ctx = setContextOp(ctx, lts.ctx, "Select")
+	if err := lts.prepareQuery(ctx); err != nil {
+		return err
+	}
+	return scanWithInterceptors[*LabelTaggingQuery, *LabelTaggingSelect](ctx, lts.LabelTaggingQuery, lts, lts.inters, v)
+}
+
+func (lts *LabelTaggingSelect) sqlScan(ctx context.Context, root *LabelTaggingQuery, v any) error {
+	selector := root.sqlQuery(ctx)
+	aggregation := make([]string, 0, len(lts.fns))
+	for _, fn := range lts.fns {
+		aggregation = append(aggregation, fn(selector))
+	}
+	switch n := len(*lts.selector.flds); {
+	case n == 0 && len(aggregation) > 0:
+		selector.Select(aggregation...)
+	case n != 0 && len(aggregation) > 0:
+		selector.AppendSelect(aggregation...)
+	}
+	rows := &sql.Rows{}
+	query, args := selector.Query()
+	if err := lts.driver.Query(ctx, query, args, rows); err != nil {
+		return err
+	}
+	defer rows.Close()
+	return sql.ScanSlice(rows, v)
+}

+ 607 - 0
ent/labeltagging_update.go

@@ -0,0 +1,607 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+	"context"
+	"errors"
+	"fmt"
+	"time"
+	"wechat-api/ent/labeltagging"
+	"wechat-api/ent/predicate"
+
+	"entgo.io/ent/dialect/sql"
+	"entgo.io/ent/dialect/sql/sqlgraph"
+	"entgo.io/ent/dialect/sql/sqljson"
+	"entgo.io/ent/schema/field"
+)
+
+// LabelTaggingUpdate is the builder for updating LabelTagging entities.
+type LabelTaggingUpdate struct {
+	config
+	hooks    []Hook
+	mutation *LabelTaggingMutation
+}
+
+// Where appends a list predicates to the LabelTaggingUpdate builder.
+func (ltu *LabelTaggingUpdate) Where(ps ...predicate.LabelTagging) *LabelTaggingUpdate {
+	ltu.mutation.Where(ps...)
+	return ltu
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (ltu *LabelTaggingUpdate) SetUpdatedAt(t time.Time) *LabelTaggingUpdate {
+	ltu.mutation.SetUpdatedAt(t)
+	return ltu
+}
+
+// SetStatus sets the "status" field.
+func (ltu *LabelTaggingUpdate) SetStatus(u uint8) *LabelTaggingUpdate {
+	ltu.mutation.ResetStatus()
+	ltu.mutation.SetStatus(u)
+	return ltu
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (ltu *LabelTaggingUpdate) SetNillableStatus(u *uint8) *LabelTaggingUpdate {
+	if u != nil {
+		ltu.SetStatus(*u)
+	}
+	return ltu
+}
+
+// AddStatus adds u to the "status" field.
+func (ltu *LabelTaggingUpdate) AddStatus(u int8) *LabelTaggingUpdate {
+	ltu.mutation.AddStatus(u)
+	return ltu
+}
+
+// ClearStatus clears the value of the "status" field.
+func (ltu *LabelTaggingUpdate) ClearStatus() *LabelTaggingUpdate {
+	ltu.mutation.ClearStatus()
+	return ltu
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (ltu *LabelTaggingUpdate) SetDeletedAt(t time.Time) *LabelTaggingUpdate {
+	ltu.mutation.SetDeletedAt(t)
+	return ltu
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (ltu *LabelTaggingUpdate) SetNillableDeletedAt(t *time.Time) *LabelTaggingUpdate {
+	if t != nil {
+		ltu.SetDeletedAt(*t)
+	}
+	return ltu
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (ltu *LabelTaggingUpdate) ClearDeletedAt() *LabelTaggingUpdate {
+	ltu.mutation.ClearDeletedAt()
+	return ltu
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (ltu *LabelTaggingUpdate) SetOrganizationID(u uint64) *LabelTaggingUpdate {
+	ltu.mutation.ResetOrganizationID()
+	ltu.mutation.SetOrganizationID(u)
+	return ltu
+}
+
+// SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
+func (ltu *LabelTaggingUpdate) SetNillableOrganizationID(u *uint64) *LabelTaggingUpdate {
+	if u != nil {
+		ltu.SetOrganizationID(*u)
+	}
+	return ltu
+}
+
+// AddOrganizationID adds u to the "organization_id" field.
+func (ltu *LabelTaggingUpdate) AddOrganizationID(u int64) *LabelTaggingUpdate {
+	ltu.mutation.AddOrganizationID(u)
+	return ltu
+}
+
+// SetType sets the "type" field.
+func (ltu *LabelTaggingUpdate) SetType(i int) *LabelTaggingUpdate {
+	ltu.mutation.ResetType()
+	ltu.mutation.SetType(i)
+	return ltu
+}
+
+// SetNillableType sets the "type" field if the given value is not nil.
+func (ltu *LabelTaggingUpdate) SetNillableType(i *int) *LabelTaggingUpdate {
+	if i != nil {
+		ltu.SetType(*i)
+	}
+	return ltu
+}
+
+// AddType adds i to the "type" field.
+func (ltu *LabelTaggingUpdate) AddType(i int) *LabelTaggingUpdate {
+	ltu.mutation.AddType(i)
+	return ltu
+}
+
+// SetConditions sets the "conditions" field.
+func (ltu *LabelTaggingUpdate) SetConditions(s string) *LabelTaggingUpdate {
+	ltu.mutation.SetConditions(s)
+	return ltu
+}
+
+// SetNillableConditions sets the "conditions" field if the given value is not nil.
+func (ltu *LabelTaggingUpdate) SetNillableConditions(s *string) *LabelTaggingUpdate {
+	if s != nil {
+		ltu.SetConditions(*s)
+	}
+	return ltu
+}
+
+// SetActionLabelAdd sets the "action_label_add" field.
+func (ltu *LabelTaggingUpdate) SetActionLabelAdd(u []uint64) *LabelTaggingUpdate {
+	ltu.mutation.SetActionLabelAdd(u)
+	return ltu
+}
+
+// AppendActionLabelAdd appends u to the "action_label_add" field.
+func (ltu *LabelTaggingUpdate) AppendActionLabelAdd(u []uint64) *LabelTaggingUpdate {
+	ltu.mutation.AppendActionLabelAdd(u)
+	return ltu
+}
+
+// ClearActionLabelAdd clears the value of the "action_label_add" field.
+func (ltu *LabelTaggingUpdate) ClearActionLabelAdd() *LabelTaggingUpdate {
+	ltu.mutation.ClearActionLabelAdd()
+	return ltu
+}
+
+// SetActionLabelDel sets the "action_label_del" field.
+func (ltu *LabelTaggingUpdate) SetActionLabelDel(u []uint64) *LabelTaggingUpdate {
+	ltu.mutation.SetActionLabelDel(u)
+	return ltu
+}
+
+// AppendActionLabelDel appends u to the "action_label_del" field.
+func (ltu *LabelTaggingUpdate) AppendActionLabelDel(u []uint64) *LabelTaggingUpdate {
+	ltu.mutation.AppendActionLabelDel(u)
+	return ltu
+}
+
+// ClearActionLabelDel clears the value of the "action_label_del" field.
+func (ltu *LabelTaggingUpdate) ClearActionLabelDel() *LabelTaggingUpdate {
+	ltu.mutation.ClearActionLabelDel()
+	return ltu
+}
+
+// Mutation returns the LabelTaggingMutation object of the builder.
+func (ltu *LabelTaggingUpdate) Mutation() *LabelTaggingMutation {
+	return ltu.mutation
+}
+
+// Save executes the query and returns the number of nodes affected by the update operation.
+func (ltu *LabelTaggingUpdate) Save(ctx context.Context) (int, error) {
+	if err := ltu.defaults(); err != nil {
+		return 0, err
+	}
+	return withHooks(ctx, ltu.sqlSave, ltu.mutation, ltu.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (ltu *LabelTaggingUpdate) SaveX(ctx context.Context) int {
+	affected, err := ltu.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return affected
+}
+
+// Exec executes the query.
+func (ltu *LabelTaggingUpdate) Exec(ctx context.Context) error {
+	_, err := ltu.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ltu *LabelTaggingUpdate) ExecX(ctx context.Context) {
+	if err := ltu.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (ltu *LabelTaggingUpdate) defaults() error {
+	if _, ok := ltu.mutation.UpdatedAt(); !ok {
+		if labeltagging.UpdateDefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized labeltagging.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := labeltagging.UpdateDefaultUpdatedAt()
+		ltu.mutation.SetUpdatedAt(v)
+	}
+	return nil
+}
+
+func (ltu *LabelTaggingUpdate) sqlSave(ctx context.Context) (n int, err error) {
+	_spec := sqlgraph.NewUpdateSpec(labeltagging.Table, labeltagging.Columns, sqlgraph.NewFieldSpec(labeltagging.FieldID, field.TypeUint64))
+	if ps := ltu.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if value, ok := ltu.mutation.UpdatedAt(); ok {
+		_spec.SetField(labeltagging.FieldUpdatedAt, field.TypeTime, value)
+	}
+	if value, ok := ltu.mutation.Status(); ok {
+		_spec.SetField(labeltagging.FieldStatus, field.TypeUint8, value)
+	}
+	if value, ok := ltu.mutation.AddedStatus(); ok {
+		_spec.AddField(labeltagging.FieldStatus, field.TypeUint8, value)
+	}
+	if ltu.mutation.StatusCleared() {
+		_spec.ClearField(labeltagging.FieldStatus, field.TypeUint8)
+	}
+	if value, ok := ltu.mutation.DeletedAt(); ok {
+		_spec.SetField(labeltagging.FieldDeletedAt, field.TypeTime, value)
+	}
+	if ltu.mutation.DeletedAtCleared() {
+		_spec.ClearField(labeltagging.FieldDeletedAt, field.TypeTime)
+	}
+	if value, ok := ltu.mutation.OrganizationID(); ok {
+		_spec.SetField(labeltagging.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if value, ok := ltu.mutation.AddedOrganizationID(); ok {
+		_spec.AddField(labeltagging.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if value, ok := ltu.mutation.GetType(); ok {
+		_spec.SetField(labeltagging.FieldType, field.TypeInt, value)
+	}
+	if value, ok := ltu.mutation.AddedType(); ok {
+		_spec.AddField(labeltagging.FieldType, field.TypeInt, value)
+	}
+	if value, ok := ltu.mutation.Conditions(); ok {
+		_spec.SetField(labeltagging.FieldConditions, field.TypeString, value)
+	}
+	if value, ok := ltu.mutation.ActionLabelAdd(); ok {
+		_spec.SetField(labeltagging.FieldActionLabelAdd, field.TypeJSON, value)
+	}
+	if value, ok := ltu.mutation.AppendedActionLabelAdd(); ok {
+		_spec.AddModifier(func(u *sql.UpdateBuilder) {
+			sqljson.Append(u, labeltagging.FieldActionLabelAdd, value)
+		})
+	}
+	if ltu.mutation.ActionLabelAddCleared() {
+		_spec.ClearField(labeltagging.FieldActionLabelAdd, field.TypeJSON)
+	}
+	if value, ok := ltu.mutation.ActionLabelDel(); ok {
+		_spec.SetField(labeltagging.FieldActionLabelDel, field.TypeJSON, value)
+	}
+	if value, ok := ltu.mutation.AppendedActionLabelDel(); ok {
+		_spec.AddModifier(func(u *sql.UpdateBuilder) {
+			sqljson.Append(u, labeltagging.FieldActionLabelDel, value)
+		})
+	}
+	if ltu.mutation.ActionLabelDelCleared() {
+		_spec.ClearField(labeltagging.FieldActionLabelDel, field.TypeJSON)
+	}
+	if n, err = sqlgraph.UpdateNodes(ctx, ltu.driver, _spec); err != nil {
+		if _, ok := err.(*sqlgraph.NotFoundError); ok {
+			err = &NotFoundError{labeltagging.Label}
+		} else if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return 0, err
+	}
+	ltu.mutation.done = true
+	return n, nil
+}
+
+// LabelTaggingUpdateOne is the builder for updating a single LabelTagging entity.
+type LabelTaggingUpdateOne struct {
+	config
+	fields   []string
+	hooks    []Hook
+	mutation *LabelTaggingMutation
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (ltuo *LabelTaggingUpdateOne) SetUpdatedAt(t time.Time) *LabelTaggingUpdateOne {
+	ltuo.mutation.SetUpdatedAt(t)
+	return ltuo
+}
+
+// SetStatus sets the "status" field.
+func (ltuo *LabelTaggingUpdateOne) SetStatus(u uint8) *LabelTaggingUpdateOne {
+	ltuo.mutation.ResetStatus()
+	ltuo.mutation.SetStatus(u)
+	return ltuo
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (ltuo *LabelTaggingUpdateOne) SetNillableStatus(u *uint8) *LabelTaggingUpdateOne {
+	if u != nil {
+		ltuo.SetStatus(*u)
+	}
+	return ltuo
+}
+
+// AddStatus adds u to the "status" field.
+func (ltuo *LabelTaggingUpdateOne) AddStatus(u int8) *LabelTaggingUpdateOne {
+	ltuo.mutation.AddStatus(u)
+	return ltuo
+}
+
+// ClearStatus clears the value of the "status" field.
+func (ltuo *LabelTaggingUpdateOne) ClearStatus() *LabelTaggingUpdateOne {
+	ltuo.mutation.ClearStatus()
+	return ltuo
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (ltuo *LabelTaggingUpdateOne) SetDeletedAt(t time.Time) *LabelTaggingUpdateOne {
+	ltuo.mutation.SetDeletedAt(t)
+	return ltuo
+}
+
+// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
+func (ltuo *LabelTaggingUpdateOne) SetNillableDeletedAt(t *time.Time) *LabelTaggingUpdateOne {
+	if t != nil {
+		ltuo.SetDeletedAt(*t)
+	}
+	return ltuo
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (ltuo *LabelTaggingUpdateOne) ClearDeletedAt() *LabelTaggingUpdateOne {
+	ltuo.mutation.ClearDeletedAt()
+	return ltuo
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (ltuo *LabelTaggingUpdateOne) SetOrganizationID(u uint64) *LabelTaggingUpdateOne {
+	ltuo.mutation.ResetOrganizationID()
+	ltuo.mutation.SetOrganizationID(u)
+	return ltuo
+}
+
+// SetNillableOrganizationID sets the "organization_id" field if the given value is not nil.
+func (ltuo *LabelTaggingUpdateOne) SetNillableOrganizationID(u *uint64) *LabelTaggingUpdateOne {
+	if u != nil {
+		ltuo.SetOrganizationID(*u)
+	}
+	return ltuo
+}
+
+// AddOrganizationID adds u to the "organization_id" field.
+func (ltuo *LabelTaggingUpdateOne) AddOrganizationID(u int64) *LabelTaggingUpdateOne {
+	ltuo.mutation.AddOrganizationID(u)
+	return ltuo
+}
+
+// SetType sets the "type" field.
+func (ltuo *LabelTaggingUpdateOne) SetType(i int) *LabelTaggingUpdateOne {
+	ltuo.mutation.ResetType()
+	ltuo.mutation.SetType(i)
+	return ltuo
+}
+
+// SetNillableType sets the "type" field if the given value is not nil.
+func (ltuo *LabelTaggingUpdateOne) SetNillableType(i *int) *LabelTaggingUpdateOne {
+	if i != nil {
+		ltuo.SetType(*i)
+	}
+	return ltuo
+}
+
+// AddType adds i to the "type" field.
+func (ltuo *LabelTaggingUpdateOne) AddType(i int) *LabelTaggingUpdateOne {
+	ltuo.mutation.AddType(i)
+	return ltuo
+}
+
+// SetConditions sets the "conditions" field.
+func (ltuo *LabelTaggingUpdateOne) SetConditions(s string) *LabelTaggingUpdateOne {
+	ltuo.mutation.SetConditions(s)
+	return ltuo
+}
+
+// SetNillableConditions sets the "conditions" field if the given value is not nil.
+func (ltuo *LabelTaggingUpdateOne) SetNillableConditions(s *string) *LabelTaggingUpdateOne {
+	if s != nil {
+		ltuo.SetConditions(*s)
+	}
+	return ltuo
+}
+
+// SetActionLabelAdd sets the "action_label_add" field.
+func (ltuo *LabelTaggingUpdateOne) SetActionLabelAdd(u []uint64) *LabelTaggingUpdateOne {
+	ltuo.mutation.SetActionLabelAdd(u)
+	return ltuo
+}
+
+// AppendActionLabelAdd appends u to the "action_label_add" field.
+func (ltuo *LabelTaggingUpdateOne) AppendActionLabelAdd(u []uint64) *LabelTaggingUpdateOne {
+	ltuo.mutation.AppendActionLabelAdd(u)
+	return ltuo
+}
+
+// ClearActionLabelAdd clears the value of the "action_label_add" field.
+func (ltuo *LabelTaggingUpdateOne) ClearActionLabelAdd() *LabelTaggingUpdateOne {
+	ltuo.mutation.ClearActionLabelAdd()
+	return ltuo
+}
+
+// SetActionLabelDel sets the "action_label_del" field.
+func (ltuo *LabelTaggingUpdateOne) SetActionLabelDel(u []uint64) *LabelTaggingUpdateOne {
+	ltuo.mutation.SetActionLabelDel(u)
+	return ltuo
+}
+
+// AppendActionLabelDel appends u to the "action_label_del" field.
+func (ltuo *LabelTaggingUpdateOne) AppendActionLabelDel(u []uint64) *LabelTaggingUpdateOne {
+	ltuo.mutation.AppendActionLabelDel(u)
+	return ltuo
+}
+
+// ClearActionLabelDel clears the value of the "action_label_del" field.
+func (ltuo *LabelTaggingUpdateOne) ClearActionLabelDel() *LabelTaggingUpdateOne {
+	ltuo.mutation.ClearActionLabelDel()
+	return ltuo
+}
+
+// Mutation returns the LabelTaggingMutation object of the builder.
+func (ltuo *LabelTaggingUpdateOne) Mutation() *LabelTaggingMutation {
+	return ltuo.mutation
+}
+
+// Where appends a list predicates to the LabelTaggingUpdate builder.
+func (ltuo *LabelTaggingUpdateOne) Where(ps ...predicate.LabelTagging) *LabelTaggingUpdateOne {
+	ltuo.mutation.Where(ps...)
+	return ltuo
+}
+
+// Select allows selecting one or more fields (columns) of the returned entity.
+// The default is selecting all fields defined in the entity schema.
+func (ltuo *LabelTaggingUpdateOne) Select(field string, fields ...string) *LabelTaggingUpdateOne {
+	ltuo.fields = append([]string{field}, fields...)
+	return ltuo
+}
+
+// Save executes the query and returns the updated LabelTagging entity.
+func (ltuo *LabelTaggingUpdateOne) Save(ctx context.Context) (*LabelTagging, error) {
+	if err := ltuo.defaults(); err != nil {
+		return nil, err
+	}
+	return withHooks(ctx, ltuo.sqlSave, ltuo.mutation, ltuo.hooks)
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (ltuo *LabelTaggingUpdateOne) SaveX(ctx context.Context) *LabelTagging {
+	node, err := ltuo.Save(ctx)
+	if err != nil {
+		panic(err)
+	}
+	return node
+}
+
+// Exec executes the query on the entity.
+func (ltuo *LabelTaggingUpdateOne) Exec(ctx context.Context) error {
+	_, err := ltuo.Save(ctx)
+	return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (ltuo *LabelTaggingUpdateOne) ExecX(ctx context.Context) {
+	if err := ltuo.Exec(ctx); err != nil {
+		panic(err)
+	}
+}
+
+// defaults sets the default values of the builder before save.
+func (ltuo *LabelTaggingUpdateOne) defaults() error {
+	if _, ok := ltuo.mutation.UpdatedAt(); !ok {
+		if labeltagging.UpdateDefaultUpdatedAt == nil {
+			return fmt.Errorf("ent: uninitialized labeltagging.UpdateDefaultUpdatedAt (forgotten import ent/runtime?)")
+		}
+		v := labeltagging.UpdateDefaultUpdatedAt()
+		ltuo.mutation.SetUpdatedAt(v)
+	}
+	return nil
+}
+
+func (ltuo *LabelTaggingUpdateOne) sqlSave(ctx context.Context) (_node *LabelTagging, err error) {
+	_spec := sqlgraph.NewUpdateSpec(labeltagging.Table, labeltagging.Columns, sqlgraph.NewFieldSpec(labeltagging.FieldID, field.TypeUint64))
+	id, ok := ltuo.mutation.ID()
+	if !ok {
+		return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "LabelTagging.id" for update`)}
+	}
+	_spec.Node.ID.Value = id
+	if fields := ltuo.fields; len(fields) > 0 {
+		_spec.Node.Columns = make([]string, 0, len(fields))
+		_spec.Node.Columns = append(_spec.Node.Columns, labeltagging.FieldID)
+		for _, f := range fields {
+			if !labeltagging.ValidColumn(f) {
+				return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
+			}
+			if f != labeltagging.FieldID {
+				_spec.Node.Columns = append(_spec.Node.Columns, f)
+			}
+		}
+	}
+	if ps := ltuo.mutation.predicates; len(ps) > 0 {
+		_spec.Predicate = func(selector *sql.Selector) {
+			for i := range ps {
+				ps[i](selector)
+			}
+		}
+	}
+	if value, ok := ltuo.mutation.UpdatedAt(); ok {
+		_spec.SetField(labeltagging.FieldUpdatedAt, field.TypeTime, value)
+	}
+	if value, ok := ltuo.mutation.Status(); ok {
+		_spec.SetField(labeltagging.FieldStatus, field.TypeUint8, value)
+	}
+	if value, ok := ltuo.mutation.AddedStatus(); ok {
+		_spec.AddField(labeltagging.FieldStatus, field.TypeUint8, value)
+	}
+	if ltuo.mutation.StatusCleared() {
+		_spec.ClearField(labeltagging.FieldStatus, field.TypeUint8)
+	}
+	if value, ok := ltuo.mutation.DeletedAt(); ok {
+		_spec.SetField(labeltagging.FieldDeletedAt, field.TypeTime, value)
+	}
+	if ltuo.mutation.DeletedAtCleared() {
+		_spec.ClearField(labeltagging.FieldDeletedAt, field.TypeTime)
+	}
+	if value, ok := ltuo.mutation.OrganizationID(); ok {
+		_spec.SetField(labeltagging.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if value, ok := ltuo.mutation.AddedOrganizationID(); ok {
+		_spec.AddField(labeltagging.FieldOrganizationID, field.TypeUint64, value)
+	}
+	if value, ok := ltuo.mutation.GetType(); ok {
+		_spec.SetField(labeltagging.FieldType, field.TypeInt, value)
+	}
+	if value, ok := ltuo.mutation.AddedType(); ok {
+		_spec.AddField(labeltagging.FieldType, field.TypeInt, value)
+	}
+	if value, ok := ltuo.mutation.Conditions(); ok {
+		_spec.SetField(labeltagging.FieldConditions, field.TypeString, value)
+	}
+	if value, ok := ltuo.mutation.ActionLabelAdd(); ok {
+		_spec.SetField(labeltagging.FieldActionLabelAdd, field.TypeJSON, value)
+	}
+	if value, ok := ltuo.mutation.AppendedActionLabelAdd(); ok {
+		_spec.AddModifier(func(u *sql.UpdateBuilder) {
+			sqljson.Append(u, labeltagging.FieldActionLabelAdd, value)
+		})
+	}
+	if ltuo.mutation.ActionLabelAddCleared() {
+		_spec.ClearField(labeltagging.FieldActionLabelAdd, field.TypeJSON)
+	}
+	if value, ok := ltuo.mutation.ActionLabelDel(); ok {
+		_spec.SetField(labeltagging.FieldActionLabelDel, field.TypeJSON, value)
+	}
+	if value, ok := ltuo.mutation.AppendedActionLabelDel(); ok {
+		_spec.AddModifier(func(u *sql.UpdateBuilder) {
+			sqljson.Append(u, labeltagging.FieldActionLabelDel, value)
+		})
+	}
+	if ltuo.mutation.ActionLabelDelCleared() {
+		_spec.ClearField(labeltagging.FieldActionLabelDel, field.TypeJSON)
+	}
+	_node = &LabelTagging{config: ltuo.config}
+	_spec.Assign = _node.assignValues
+	_spec.ScanValues = _node.scanValues
+	if err = sqlgraph.UpdateNode(ctx, ltuo.driver, _spec); err != nil {
+		if _, ok := err.(*sqlgraph.NotFoundError); ok {
+			err = &NotFoundError{labeltagging.Label}
+		} else if sqlgraph.IsConstraintError(err) {
+			err = &ConstraintError{msg: err.Error(), wrap: err}
+		}
+		return nil, err
+	}
+	ltuo.mutation.done = true
+	return _node, nil
+}

+ 23 - 0
ent/migrate/schema.go

@@ -387,6 +387,25 @@ var (
 			},
 		},
 	}
+	// LabelTaggingColumns holds the columns for the "label_tagging" table.
+	LabelTaggingColumns = []*schema.Column{
+		{Name: "id", Type: field.TypeUint64, Increment: true},
+		{Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
+		{Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
+		{Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
+		{Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
+		{Name: "organization_id", Type: field.TypeUint64, Comment: "机构 ID", Default: 1},
+		{Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3公众号,4企业微信联系人", Default: 1},
+		{Name: "conditions", Type: field.TypeString, Comment: "关键词", Default: ""},
+		{Name: "action_label_add", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"},
+		{Name: "action_label_del", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要移除的标签"},
+	}
+	// LabelTaggingTable holds the schema information for the "label_tagging" table.
+	LabelTaggingTable = &schema.Table{
+		Name:       "label_tagging",
+		Columns:    LabelTaggingColumns,
+		PrimaryKey: []*schema.Column{LabelTaggingColumns[0]},
+	}
 	// MessagesColumns holds the columns for the "messages" table.
 	MessagesColumns = []*schema.Column{
 		{Name: "id", Type: field.TypeInt, Increment: true},
@@ -1166,6 +1185,7 @@ var (
 		EmployeeConfigTable,
 		LabelTable,
 		LabelRelationshipTable,
+		LabelTaggingTable,
 		MessagesTable,
 		MessageRecordsTable,
 		MsgTable,
@@ -1229,6 +1249,9 @@ func init() {
 	LabelRelationshipTable.Annotation = &entsql.Annotation{
 		Table: "label_relationship",
 	}
+	LabelTaggingTable.Annotation = &entsql.Annotation{
+		Table: "label_tagging",
+	}
 	MessagesTable.Annotation = &entsql.Annotation{
 		Table: "messages",
 	}

+ 982 - 0
ent/mutation.go

@@ -21,6 +21,7 @@ import (
 	"wechat-api/ent/employeeconfig"
 	"wechat-api/ent/label"
 	"wechat-api/ent/labelrelationship"
+	"wechat-api/ent/labeltagging"
 	"wechat-api/ent/message"
 	"wechat-api/ent/messagerecords"
 	"wechat-api/ent/msg"
@@ -69,6 +70,7 @@ const (
 	TypeEmployeeConfig      = "EmployeeConfig"
 	TypeLabel               = "Label"
 	TypeLabelRelationship   = "LabelRelationship"
+	TypeLabelTagging      = "LabelTagging"
 	TypeMessage             = "Message"
 	TypeMessageRecords      = "MessageRecords"
 	TypeMsg                 = "Msg"
@@ -13997,6 +13999,986 @@ func (m *LabelRelationshipMutation) ResetEdge(name string) error {
 	return fmt.Errorf("unknown LabelRelationship edge %s", name)
 }
 
+// LabelTaggingMutation represents an operation that mutates the LabelTagging nodes in the graph.
+type LabelTaggingMutation struct {
+	config
+	op                     Op
+	typ                    string
+	id                     *uint64
+	created_at             *time.Time
+	updated_at             *time.Time
+	status                 *uint8
+	addstatus              *int8
+	deleted_at             *time.Time
+	organization_id        *uint64
+	addorganization_id     *int64
+	_type                  *int
+	add_type               *int
+	conditions             *string
+	action_label_add       *[]uint64
+	appendaction_label_add []uint64
+	action_label_del       *[]uint64
+	appendaction_label_del []uint64
+	clearedFields          map[string]struct{}
+	done                   bool
+	oldValue               func(context.Context) (*LabelTagging, error)
+	predicates             []predicate.LabelTagging
+}
+
+var _ ent.Mutation = (*LabelTaggingMutation)(nil)
+
+// labeltaggingOption allows management of the mutation configuration using functional options.
+type labeltaggingOption func(*LabelTaggingMutation)
+
+// newLabelTaggingMutation creates new mutation for the LabelTagging entity.
+func newLabelTaggingMutation(c config, op Op, opts ...labeltaggingOption) *LabelTaggingMutation {
+	m := &LabelTaggingMutation{
+		config:        c,
+		op:            op,
+		typ:           TypeLabelTagging,
+		clearedFields: make(map[string]struct{}),
+	}
+	for _, opt := range opts {
+		opt(m)
+	}
+	return m
+}
+
+// withLabelTaggingID sets the ID field of the mutation.
+func withLabelTaggingID(id uint64) labeltaggingOption {
+	return func(m *LabelTaggingMutation) {
+		var (
+			err   error
+			once  sync.Once
+			value *LabelTagging
+		)
+		m.oldValue = func(ctx context.Context) (*LabelTagging, error) {
+			once.Do(func() {
+				if m.done {
+					err = errors.New("querying old values post mutation is not allowed")
+				} else {
+					value, err = m.Client().LabelTagging.Get(ctx, id)
+				}
+			})
+			return value, err
+		}
+		m.id = &id
+	}
+}
+
+// withLabelTagging sets the old LabelTagging of the mutation.
+func withLabelTagging(node *LabelTagging) labeltaggingOption {
+	return func(m *LabelTaggingMutation) {
+		m.oldValue = func(context.Context) (*LabelTagging, error) {
+			return node, nil
+		}
+		m.id = &node.ID
+	}
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m LabelTaggingMutation) Client() *Client {
+	client := &Client{config: m.config}
+	client.init()
+	return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m LabelTaggingMutation) Tx() (*Tx, error) {
+	if _, ok := m.driver.(*txDriver); !ok {
+		return nil, errors.New("ent: mutation is not running in a transaction")
+	}
+	tx := &Tx{config: m.config}
+	tx.init()
+	return tx, nil
+}
+
+// SetID sets the value of the id field. Note that this
+// operation is only accepted on creation of LabelTagging entities.
+func (m *LabelTaggingMutation) SetID(id uint64) {
+	m.id = &id
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *LabelTaggingMutation) ID() (id uint64, exists bool) {
+	if m.id == nil {
+		return
+	}
+	return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *LabelTaggingMutation) IDs(ctx context.Context) ([]uint64, error) {
+	switch {
+	case m.op.Is(OpUpdateOne | OpDeleteOne):
+		id, exists := m.ID()
+		if exists {
+			return []uint64{id}, nil
+		}
+		fallthrough
+	case m.op.Is(OpUpdate | OpDelete):
+		return m.Client().LabelTagging.Query().Where(m.predicates...).IDs(ctx)
+	default:
+		return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+	}
+}
+
+// SetCreatedAt sets the "created_at" field.
+func (m *LabelTaggingMutation) SetCreatedAt(t time.Time) {
+	m.created_at = &t
+}
+
+// CreatedAt returns the value of the "created_at" field in the mutation.
+func (m *LabelTaggingMutation) CreatedAt() (r time.Time, exists bool) {
+	v := m.created_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldCreatedAt returns the old "created_at" field's value of the LabelTagging entity.
+// If the LabelTagging object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *LabelTaggingMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+	}
+	return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "created_at" field.
+func (m *LabelTaggingMutation) ResetCreatedAt() {
+	m.created_at = nil
+}
+
+// SetUpdatedAt sets the "updated_at" field.
+func (m *LabelTaggingMutation) SetUpdatedAt(t time.Time) {
+	m.updated_at = &t
+}
+
+// UpdatedAt returns the value of the "updated_at" field in the mutation.
+func (m *LabelTaggingMutation) UpdatedAt() (r time.Time, exists bool) {
+	v := m.updated_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldUpdatedAt returns the old "updated_at" field's value of the LabelTagging entity.
+// If the LabelTagging object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *LabelTaggingMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldUpdatedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err)
+	}
+	return oldValue.UpdatedAt, nil
+}
+
+// ResetUpdatedAt resets all changes to the "updated_at" field.
+func (m *LabelTaggingMutation) ResetUpdatedAt() {
+	m.updated_at = nil
+}
+
+// SetStatus sets the "status" field.
+func (m *LabelTaggingMutation) SetStatus(u uint8) {
+	m.status = &u
+	m.addstatus = nil
+}
+
+// Status returns the value of the "status" field in the mutation.
+func (m *LabelTaggingMutation) Status() (r uint8, exists bool) {
+	v := m.status
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldStatus returns the old "status" field's value of the LabelTagging entity.
+// If the LabelTagging object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *LabelTaggingMutation) OldStatus(ctx context.Context) (v uint8, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldStatus is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldStatus requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldStatus: %w", err)
+	}
+	return oldValue.Status, nil
+}
+
+// AddStatus adds u to the "status" field.
+func (m *LabelTaggingMutation) AddStatus(u int8) {
+	if m.addstatus != nil {
+		*m.addstatus += u
+	} else {
+		m.addstatus = &u
+	}
+}
+
+// AddedStatus returns the value that was added to the "status" field in this mutation.
+func (m *LabelTaggingMutation) AddedStatus() (r int8, exists bool) {
+	v := m.addstatus
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ClearStatus clears the value of the "status" field.
+func (m *LabelTaggingMutation) ClearStatus() {
+	m.status = nil
+	m.addstatus = nil
+	m.clearedFields[labeltagging.FieldStatus] = struct{}{}
+}
+
+// StatusCleared returns if the "status" field was cleared in this mutation.
+func (m *LabelTaggingMutation) StatusCleared() bool {
+	_, ok := m.clearedFields[labeltagging.FieldStatus]
+	return ok
+}
+
+// ResetStatus resets all changes to the "status" field.
+func (m *LabelTaggingMutation) ResetStatus() {
+	m.status = nil
+	m.addstatus = nil
+	delete(m.clearedFields, labeltagging.FieldStatus)
+}
+
+// SetDeletedAt sets the "deleted_at" field.
+func (m *LabelTaggingMutation) SetDeletedAt(t time.Time) {
+	m.deleted_at = &t
+}
+
+// DeletedAt returns the value of the "deleted_at" field in the mutation.
+func (m *LabelTaggingMutation) DeletedAt() (r time.Time, exists bool) {
+	v := m.deleted_at
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldDeletedAt returns the old "deleted_at" field's value of the LabelTagging entity.
+// If the LabelTagging object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *LabelTaggingMutation) OldDeletedAt(ctx context.Context) (v time.Time, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldDeletedAt is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldDeletedAt requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldDeletedAt: %w", err)
+	}
+	return oldValue.DeletedAt, nil
+}
+
+// ClearDeletedAt clears the value of the "deleted_at" field.
+func (m *LabelTaggingMutation) ClearDeletedAt() {
+	m.deleted_at = nil
+	m.clearedFields[labeltagging.FieldDeletedAt] = struct{}{}
+}
+
+// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation.
+func (m *LabelTaggingMutation) DeletedAtCleared() bool {
+	_, ok := m.clearedFields[labeltagging.FieldDeletedAt]
+	return ok
+}
+
+// ResetDeletedAt resets all changes to the "deleted_at" field.
+func (m *LabelTaggingMutation) ResetDeletedAt() {
+	m.deleted_at = nil
+	delete(m.clearedFields, labeltagging.FieldDeletedAt)
+}
+
+// SetOrganizationID sets the "organization_id" field.
+func (m *LabelTaggingMutation) SetOrganizationID(u uint64) {
+	m.organization_id = &u
+	m.addorganization_id = nil
+}
+
+// OrganizationID returns the value of the "organization_id" field in the mutation.
+func (m *LabelTaggingMutation) OrganizationID() (r uint64, exists bool) {
+	v := m.organization_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldOrganizationID returns the old "organization_id" field's value of the LabelTagging entity.
+// If the LabelTagging object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *LabelTaggingMutation) OldOrganizationID(ctx context.Context) (v uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldOrganizationID is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldOrganizationID requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldOrganizationID: %w", err)
+	}
+	return oldValue.OrganizationID, nil
+}
+
+// AddOrganizationID adds u to the "organization_id" field.
+func (m *LabelTaggingMutation) AddOrganizationID(u int64) {
+	if m.addorganization_id != nil {
+		*m.addorganization_id += u
+	} else {
+		m.addorganization_id = &u
+	}
+}
+
+// AddedOrganizationID returns the value that was added to the "organization_id" field in this mutation.
+func (m *LabelTaggingMutation) AddedOrganizationID() (r int64, exists bool) {
+	v := m.addorganization_id
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetOrganizationID resets all changes to the "organization_id" field.
+func (m *LabelTaggingMutation) ResetOrganizationID() {
+	m.organization_id = nil
+	m.addorganization_id = nil
+}
+
+// SetType sets the "type" field.
+func (m *LabelTaggingMutation) SetType(i int) {
+	m._type = &i
+	m.add_type = nil
+}
+
+// GetType returns the value of the "type" field in the mutation.
+func (m *LabelTaggingMutation) GetType() (r int, exists bool) {
+	v := m._type
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldType returns the old "type" field's value of the LabelTagging entity.
+// If the LabelTagging object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *LabelTaggingMutation) OldType(ctx context.Context) (v int, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldType is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldType requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldType: %w", err)
+	}
+	return oldValue.Type, nil
+}
+
+// AddType adds i to the "type" field.
+func (m *LabelTaggingMutation) AddType(i int) {
+	if m.add_type != nil {
+		*m.add_type += i
+	} else {
+		m.add_type = &i
+	}
+}
+
+// AddedType returns the value that was added to the "type" field in this mutation.
+func (m *LabelTaggingMutation) AddedType() (r int, exists bool) {
+	v := m.add_type
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// ResetType resets all changes to the "type" field.
+func (m *LabelTaggingMutation) ResetType() {
+	m._type = nil
+	m.add_type = nil
+}
+
+// SetConditions sets the "conditions" field.
+func (m *LabelTaggingMutation) SetConditions(s string) {
+	m.conditions = &s
+}
+
+// Conditions returns the value of the "conditions" field in the mutation.
+func (m *LabelTaggingMutation) Conditions() (r string, exists bool) {
+	v := m.conditions
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldConditions returns the old "conditions" field's value of the LabelTagging entity.
+// If the LabelTagging object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *LabelTaggingMutation) OldConditions(ctx context.Context) (v string, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldConditions is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldConditions requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldConditions: %w", err)
+	}
+	return oldValue.Conditions, nil
+}
+
+// ResetConditions resets all changes to the "conditions" field.
+func (m *LabelTaggingMutation) ResetConditions() {
+	m.conditions = nil
+}
+
+// SetActionLabelAdd sets the "action_label_add" field.
+func (m *LabelTaggingMutation) SetActionLabelAdd(u []uint64) {
+	m.action_label_add = &u
+	m.appendaction_label_add = nil
+}
+
+// ActionLabelAdd returns the value of the "action_label_add" field in the mutation.
+func (m *LabelTaggingMutation) ActionLabelAdd() (r []uint64, exists bool) {
+	v := m.action_label_add
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldActionLabelAdd returns the old "action_label_add" field's value of the LabelTagging entity.
+// If the LabelTagging object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *LabelTaggingMutation) OldActionLabelAdd(ctx context.Context) (v []uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldActionLabelAdd is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldActionLabelAdd requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldActionLabelAdd: %w", err)
+	}
+	return oldValue.ActionLabelAdd, nil
+}
+
+// AppendActionLabelAdd adds u to the "action_label_add" field.
+func (m *LabelTaggingMutation) AppendActionLabelAdd(u []uint64) {
+	m.appendaction_label_add = append(m.appendaction_label_add, u...)
+}
+
+// AppendedActionLabelAdd returns the list of values that were appended to the "action_label_add" field in this mutation.
+func (m *LabelTaggingMutation) AppendedActionLabelAdd() ([]uint64, bool) {
+	if len(m.appendaction_label_add) == 0 {
+		return nil, false
+	}
+	return m.appendaction_label_add, true
+}
+
+// ClearActionLabelAdd clears the value of the "action_label_add" field.
+func (m *LabelTaggingMutation) ClearActionLabelAdd() {
+	m.action_label_add = nil
+	m.appendaction_label_add = nil
+	m.clearedFields[labeltagging.FieldActionLabelAdd] = struct{}{}
+}
+
+// ActionLabelAddCleared returns if the "action_label_add" field was cleared in this mutation.
+func (m *LabelTaggingMutation) ActionLabelAddCleared() bool {
+	_, ok := m.clearedFields[labeltagging.FieldActionLabelAdd]
+	return ok
+}
+
+// ResetActionLabelAdd resets all changes to the "action_label_add" field.
+func (m *LabelTaggingMutation) ResetActionLabelAdd() {
+	m.action_label_add = nil
+	m.appendaction_label_add = nil
+	delete(m.clearedFields, labeltagging.FieldActionLabelAdd)
+}
+
+// SetActionLabelDel sets the "action_label_del" field.
+func (m *LabelTaggingMutation) SetActionLabelDel(u []uint64) {
+	m.action_label_del = &u
+	m.appendaction_label_del = nil
+}
+
+// ActionLabelDel returns the value of the "action_label_del" field in the mutation.
+func (m *LabelTaggingMutation) ActionLabelDel() (r []uint64, exists bool) {
+	v := m.action_label_del
+	if v == nil {
+		return
+	}
+	return *v, true
+}
+
+// OldActionLabelDel returns the old "action_label_del" field's value of the LabelTagging entity.
+// If the LabelTagging object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *LabelTaggingMutation) OldActionLabelDel(ctx context.Context) (v []uint64, err error) {
+	if !m.op.Is(OpUpdateOne) {
+		return v, errors.New("OldActionLabelDel is only allowed on UpdateOne operations")
+	}
+	if m.id == nil || m.oldValue == nil {
+		return v, errors.New("OldActionLabelDel requires an ID field in the mutation")
+	}
+	oldValue, err := m.oldValue(ctx)
+	if err != nil {
+		return v, fmt.Errorf("querying old value for OldActionLabelDel: %w", err)
+	}
+	return oldValue.ActionLabelDel, nil
+}
+
+// AppendActionLabelDel adds u to the "action_label_del" field.
+func (m *LabelTaggingMutation) AppendActionLabelDel(u []uint64) {
+	m.appendaction_label_del = append(m.appendaction_label_del, u...)
+}
+
+// AppendedActionLabelDel returns the list of values that were appended to the "action_label_del" field in this mutation.
+func (m *LabelTaggingMutation) AppendedActionLabelDel() ([]uint64, bool) {
+	if len(m.appendaction_label_del) == 0 {
+		return nil, false
+	}
+	return m.appendaction_label_del, true
+}
+
+// ClearActionLabelDel clears the value of the "action_label_del" field.
+func (m *LabelTaggingMutation) ClearActionLabelDel() {
+	m.action_label_del = nil
+	m.appendaction_label_del = nil
+	m.clearedFields[labeltagging.FieldActionLabelDel] = struct{}{}
+}
+
+// ActionLabelDelCleared returns if the "action_label_del" field was cleared in this mutation.
+func (m *LabelTaggingMutation) ActionLabelDelCleared() bool {
+	_, ok := m.clearedFields[labeltagging.FieldActionLabelDel]
+	return ok
+}
+
+// ResetActionLabelDel resets all changes to the "action_label_del" field.
+func (m *LabelTaggingMutation) ResetActionLabelDel() {
+	m.action_label_del = nil
+	m.appendaction_label_del = nil
+	delete(m.clearedFields, labeltagging.FieldActionLabelDel)
+}
+
+// Where appends a list predicates to the LabelTaggingMutation builder.
+func (m *LabelTaggingMutation) Where(ps ...predicate.LabelTagging) {
+	m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the LabelTaggingMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *LabelTaggingMutation) WhereP(ps ...func(*sql.Selector)) {
+	p := make([]predicate.LabelTagging, len(ps))
+	for i := range ps {
+		p[i] = ps[i]
+	}
+	m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *LabelTaggingMutation) Op() Op {
+	return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *LabelTaggingMutation) SetOp(op Op) {
+	m.op = op
+}
+
+// Type returns the node type of this mutation (LabelTagging).
+func (m *LabelTaggingMutation) Type() string {
+	return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *LabelTaggingMutation) Fields() []string {
+	fields := make([]string, 0, 9)
+	if m.created_at != nil {
+		fields = append(fields, labeltagging.FieldCreatedAt)
+	}
+	if m.updated_at != nil {
+		fields = append(fields, labeltagging.FieldUpdatedAt)
+	}
+	if m.status != nil {
+		fields = append(fields, labeltagging.FieldStatus)
+	}
+	if m.deleted_at != nil {
+		fields = append(fields, labeltagging.FieldDeletedAt)
+	}
+	if m.organization_id != nil {
+		fields = append(fields, labeltagging.FieldOrganizationID)
+	}
+	if m._type != nil {
+		fields = append(fields, labeltagging.FieldType)
+	}
+	if m.conditions != nil {
+		fields = append(fields, labeltagging.FieldConditions)
+	}
+	if m.action_label_add != nil {
+		fields = append(fields, labeltagging.FieldActionLabelAdd)
+	}
+	if m.action_label_del != nil {
+		fields = append(fields, labeltagging.FieldActionLabelDel)
+	}
+	return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *LabelTaggingMutation) Field(name string) (ent.Value, bool) {
+	switch name {
+	case labeltagging.FieldCreatedAt:
+		return m.CreatedAt()
+	case labeltagging.FieldUpdatedAt:
+		return m.UpdatedAt()
+	case labeltagging.FieldStatus:
+		return m.Status()
+	case labeltagging.FieldDeletedAt:
+		return m.DeletedAt()
+	case labeltagging.FieldOrganizationID:
+		return m.OrganizationID()
+	case labeltagging.FieldType:
+		return m.GetType()
+	case labeltagging.FieldConditions:
+		return m.Conditions()
+	case labeltagging.FieldActionLabelAdd:
+		return m.ActionLabelAdd()
+	case labeltagging.FieldActionLabelDel:
+		return m.ActionLabelDel()
+	}
+	return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *LabelTaggingMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+	switch name {
+	case labeltagging.FieldCreatedAt:
+		return m.OldCreatedAt(ctx)
+	case labeltagging.FieldUpdatedAt:
+		return m.OldUpdatedAt(ctx)
+	case labeltagging.FieldStatus:
+		return m.OldStatus(ctx)
+	case labeltagging.FieldDeletedAt:
+		return m.OldDeletedAt(ctx)
+	case labeltagging.FieldOrganizationID:
+		return m.OldOrganizationID(ctx)
+	case labeltagging.FieldType:
+		return m.OldType(ctx)
+	case labeltagging.FieldConditions:
+		return m.OldConditions(ctx)
+	case labeltagging.FieldActionLabelAdd:
+		return m.OldActionLabelAdd(ctx)
+	case labeltagging.FieldActionLabelDel:
+		return m.OldActionLabelDel(ctx)
+	}
+	return nil, fmt.Errorf("unknown LabelTagging field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *LabelTaggingMutation) SetField(name string, value ent.Value) error {
+	switch name {
+	case labeltagging.FieldCreatedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetCreatedAt(v)
+		return nil
+	case labeltagging.FieldUpdatedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetUpdatedAt(v)
+		return nil
+	case labeltagging.FieldStatus:
+		v, ok := value.(uint8)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetStatus(v)
+		return nil
+	case labeltagging.FieldDeletedAt:
+		v, ok := value.(time.Time)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetDeletedAt(v)
+		return nil
+	case labeltagging.FieldOrganizationID:
+		v, ok := value.(uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetOrganizationID(v)
+		return nil
+	case labeltagging.FieldType:
+		v, ok := value.(int)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetType(v)
+		return nil
+	case labeltagging.FieldConditions:
+		v, ok := value.(string)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetConditions(v)
+		return nil
+	case labeltagging.FieldActionLabelAdd:
+		v, ok := value.([]uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetActionLabelAdd(v)
+		return nil
+	case labeltagging.FieldActionLabelDel:
+		v, ok := value.([]uint64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.SetActionLabelDel(v)
+		return nil
+	}
+	return fmt.Errorf("unknown LabelTagging field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *LabelTaggingMutation) AddedFields() []string {
+	var fields []string
+	if m.addstatus != nil {
+		fields = append(fields, labeltagging.FieldStatus)
+	}
+	if m.addorganization_id != nil {
+		fields = append(fields, labeltagging.FieldOrganizationID)
+	}
+	if m.add_type != nil {
+		fields = append(fields, labeltagging.FieldType)
+	}
+	return fields
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *LabelTaggingMutation) AddedField(name string) (ent.Value, bool) {
+	switch name {
+	case labeltagging.FieldStatus:
+		return m.AddedStatus()
+	case labeltagging.FieldOrganizationID:
+		return m.AddedOrganizationID()
+	case labeltagging.FieldType:
+		return m.AddedType()
+	}
+	return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *LabelTaggingMutation) AddField(name string, value ent.Value) error {
+	switch name {
+	case labeltagging.FieldStatus:
+		v, ok := value.(int8)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddStatus(v)
+		return nil
+	case labeltagging.FieldOrganizationID:
+		v, ok := value.(int64)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddOrganizationID(v)
+		return nil
+	case labeltagging.FieldType:
+		v, ok := value.(int)
+		if !ok {
+			return fmt.Errorf("unexpected type %T for field %s", value, name)
+		}
+		m.AddType(v)
+		return nil
+	}
+	return fmt.Errorf("unknown LabelTagging numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *LabelTaggingMutation) ClearedFields() []string {
+	var fields []string
+	if m.FieldCleared(labeltagging.FieldStatus) {
+		fields = append(fields, labeltagging.FieldStatus)
+	}
+	if m.FieldCleared(labeltagging.FieldDeletedAt) {
+		fields = append(fields, labeltagging.FieldDeletedAt)
+	}
+	if m.FieldCleared(labeltagging.FieldActionLabelAdd) {
+		fields = append(fields, labeltagging.FieldActionLabelAdd)
+	}
+	if m.FieldCleared(labeltagging.FieldActionLabelDel) {
+		fields = append(fields, labeltagging.FieldActionLabelDel)
+	}
+	return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *LabelTaggingMutation) FieldCleared(name string) bool {
+	_, ok := m.clearedFields[name]
+	return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *LabelTaggingMutation) ClearField(name string) error {
+	switch name {
+	case labeltagging.FieldStatus:
+		m.ClearStatus()
+		return nil
+	case labeltagging.FieldDeletedAt:
+		m.ClearDeletedAt()
+		return nil
+	case labeltagging.FieldActionLabelAdd:
+		m.ClearActionLabelAdd()
+		return nil
+	case labeltagging.FieldActionLabelDel:
+		m.ClearActionLabelDel()
+		return nil
+	}
+	return fmt.Errorf("unknown LabelTagging nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *LabelTaggingMutation) ResetField(name string) error {
+	switch name {
+	case labeltagging.FieldCreatedAt:
+		m.ResetCreatedAt()
+		return nil
+	case labeltagging.FieldUpdatedAt:
+		m.ResetUpdatedAt()
+		return nil
+	case labeltagging.FieldStatus:
+		m.ResetStatus()
+		return nil
+	case labeltagging.FieldDeletedAt:
+		m.ResetDeletedAt()
+		return nil
+	case labeltagging.FieldOrganizationID:
+		m.ResetOrganizationID()
+		return nil
+	case labeltagging.FieldType:
+		m.ResetType()
+		return nil
+	case labeltagging.FieldConditions:
+		m.ResetConditions()
+		return nil
+	case labeltagging.FieldActionLabelAdd:
+		m.ResetActionLabelAdd()
+		return nil
+	case labeltagging.FieldActionLabelDel:
+		m.ResetActionLabelDel()
+		return nil
+	}
+	return fmt.Errorf("unknown LabelTagging field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *LabelTaggingMutation) AddedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *LabelTaggingMutation) AddedIDs(name string) []ent.Value {
+	return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *LabelTaggingMutation) RemovedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *LabelTaggingMutation) RemovedIDs(name string) []ent.Value {
+	return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *LabelTaggingMutation) ClearedEdges() []string {
+	edges := make([]string, 0, 0)
+	return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *LabelTaggingMutation) EdgeCleared(name string) bool {
+	return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *LabelTaggingMutation) ClearEdge(name string) error {
+	return fmt.Errorf("unknown LabelTagging unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *LabelTaggingMutation) ResetEdge(name string) error {
+	return fmt.Errorf("unknown LabelTagging edge %s", name)
+}
+
 // MessageMutation represents an operation that mutates the Message nodes in the graph.
 type MessageMutation struct {
 	config

+ 82 - 0
ent/pagination.go

@@ -17,6 +17,7 @@ import (
 	"wechat-api/ent/employeeconfig"
 	"wechat-api/ent/label"
 	"wechat-api/ent/labelrelationship"
+	"wechat-api/ent/labeltagging"
 	"wechat-api/ent/message"
 	"wechat-api/ent/messagerecords"
 	"wechat-api/ent/msg"
@@ -1058,6 +1059,87 @@ func (lr *LabelRelationshipQuery) Page(
 	return ret, nil
 }
 
+type LabelTaggingPager struct {
+	Order  labeltagging.OrderOption
+	Filter func(*LabelTaggingQuery) (*LabelTaggingQuery, error)
+}
+
+// LabelTaggingPaginateOption enables pagination customization.
+type LabelTaggingPaginateOption func(*LabelTaggingPager)
+
+// DefaultLabelTaggingOrder is the default ordering of LabelTagging.
+var DefaultLabelTaggingOrder = Desc(labeltagging.FieldID)
+
+func newLabelTaggingPager(opts []LabelTaggingPaginateOption) (*LabelTaggingPager, error) {
+	pager := &LabelTaggingPager{}
+	for _, opt := range opts {
+		opt(pager)
+	}
+	if pager.Order == nil {
+		pager.Order = DefaultLabelTaggingOrder
+	}
+	return pager, nil
+}
+
+func (p *LabelTaggingPager) ApplyFilter(query *LabelTaggingQuery) (*LabelTaggingQuery, error) {
+	if p.Filter != nil {
+		return p.Filter(query)
+	}
+	return query, nil
+}
+
+// LabelTaggingPageList is LabelTagging PageList result.
+type LabelTaggingPageList struct {
+	List        []*LabelTagging `json:"list"`
+	PageDetails *PageDetails    `json:"pageDetails"`
+}
+
+func (lt *LabelTaggingQuery) Page(
+	ctx context.Context, pageNum uint64, pageSize uint64, opts ...LabelTaggingPaginateOption,
+) (*LabelTaggingPageList, error) {
+
+	pager, err := newLabelTaggingPager(opts)
+	if err != nil {
+		return nil, err
+	}
+
+	if lt, err = pager.ApplyFilter(lt); err != nil {
+		return nil, err
+	}
+
+	ret := &LabelTaggingPageList{}
+
+	ret.PageDetails = &PageDetails{
+		Page: pageNum,
+		Size: pageSize,
+	}
+
+	query := lt.Clone()
+	query.ctx.Fields = nil
+	count, err := query.Count(ctx)
+
+	if err != nil {
+		return nil, err
+	}
+
+	ret.PageDetails.Total = uint64(count)
+
+	if pager.Order != nil {
+		lt = lt.Order(pager.Order)
+	} else {
+		lt = lt.Order(DefaultLabelTaggingOrder)
+	}
+
+	lt = lt.Offset(int((pageNum - 1) * pageSize)).Limit(int(pageSize))
+	list, err := lt.All(ctx)
+	if err != nil {
+		return nil, err
+	}
+	ret.List = list
+
+	return ret, nil
+}
+
 type MessagePager struct {
 	Order  message.OrderOption
 	Filter func(*MessageQuery) (*MessageQuery, error)

+ 3 - 0
ent/predicate/predicate.go

@@ -42,6 +42,9 @@ type Label func(*sql.Selector)
 // LabelRelationship is the predicate function for labelrelationship builders.
 type LabelRelationship func(*sql.Selector)
 
+// LabelTagging is the predicate function for labeltagging builders.
+type LabelTagging func(*sql.Selector)
+
 // Message is the predicate function for message builders.
 type Message func(*sql.Selector)
 

+ 38 - 0
ent/runtime/runtime.go

@@ -16,6 +16,7 @@ import (
 	"wechat-api/ent/employeeconfig"
 	"wechat-api/ent/label"
 	"wechat-api/ent/labelrelationship"
+	"wechat-api/ent/labeltagging"
 	"wechat-api/ent/message"
 	"wechat-api/ent/messagerecords"
 	"wechat-api/ent/msg"
@@ -577,6 +578,43 @@ func init() {
 	labelrelationshipDescOrganizationID := labelrelationshipFields[2].Descriptor()
 	// labelrelationship.DefaultOrganizationID holds the default value on creation for the organization_id field.
 	labelrelationship.DefaultOrganizationID = labelrelationshipDescOrganizationID.Default.(uint64)
+	labeltaggingMixin := schema.LabelTagging{}.Mixin()
+	labeltaggingMixinHooks2 := labeltaggingMixin[2].Hooks()
+	labeltagging.Hooks[0] = labeltaggingMixinHooks2[0]
+	labeltaggingMixinInters2 := labeltaggingMixin[2].Interceptors()
+	labeltagging.Interceptors[0] = labeltaggingMixinInters2[0]
+	labeltaggingMixinFields0 := labeltaggingMixin[0].Fields()
+	_ = labeltaggingMixinFields0
+	labeltaggingMixinFields1 := labeltaggingMixin[1].Fields()
+	_ = labeltaggingMixinFields1
+	labeltaggingFields := schema.LabelTagging{}.Fields()
+	_ = labeltaggingFields
+	// labeltaggingDescCreatedAt is the schema descriptor for created_at field.
+	labeltaggingDescCreatedAt := labeltaggingMixinFields0[1].Descriptor()
+	// labeltagging.DefaultCreatedAt holds the default value on creation for the created_at field.
+	labeltagging.DefaultCreatedAt = labeltaggingDescCreatedAt.Default.(func() time.Time)
+	// labeltaggingDescUpdatedAt is the schema descriptor for updated_at field.
+	labeltaggingDescUpdatedAt := labeltaggingMixinFields0[2].Descriptor()
+	// labeltagging.DefaultUpdatedAt holds the default value on creation for the updated_at field.
+	labeltagging.DefaultUpdatedAt = labeltaggingDescUpdatedAt.Default.(func() time.Time)
+	// labeltagging.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field.
+	labeltagging.UpdateDefaultUpdatedAt = labeltaggingDescUpdatedAt.UpdateDefault.(func() time.Time)
+	// labeltaggingDescStatus is the schema descriptor for status field.
+	labeltaggingDescStatus := labeltaggingMixinFields1[0].Descriptor()
+	// labeltagging.DefaultStatus holds the default value on creation for the status field.
+	labeltagging.DefaultStatus = labeltaggingDescStatus.Default.(uint8)
+	// labeltaggingDescOrganizationID is the schema descriptor for organization_id field.
+	labeltaggingDescOrganizationID := labeltaggingFields[0].Descriptor()
+	// labeltagging.DefaultOrganizationID holds the default value on creation for the organization_id field.
+	labeltagging.DefaultOrganizationID = labeltaggingDescOrganizationID.Default.(uint64)
+	// labeltaggingDescType is the schema descriptor for type field.
+	labeltaggingDescType := labeltaggingFields[1].Descriptor()
+	// labeltagging.DefaultType holds the default value on creation for the type field.
+	labeltagging.DefaultType = labeltaggingDescType.Default.(int)
+	// labeltaggingDescConditions is the schema descriptor for conditions field.
+	labeltaggingDescConditions := labeltaggingFields[2].Descriptor()
+	// labeltagging.DefaultConditions holds the default value on creation for the conditions field.
+	labeltagging.DefaultConditions = labeltaggingDescConditions.Default.(string)
 	messageFields := schema.Message{}.Fields()
 	_ = messageFields
 	// messageDescWxWxid is the schema descriptor for wx_wxid field.

+ 57 - 0
ent/schema/label_tagging.go

@@ -0,0 +1,57 @@
+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("organization_id").Default(1).
+			Comment("机构 ID").
+			Annotations(entsql.WithComments(true)),
+		field.Int("type").Default(1).
+			Annotations(entsql.WithComments(true)).
+			Comment("标签类型:1好友,2群组,3公众号,4企业微信联系人"),
+		field.String("conditions").Default("").
+			Annotations(entsql.WithComments(true)).
+			Comment("关键词"),
+		field.JSON("action_label_add", []uint64{}).Optional().
+			Annotations(entsql.WithComments(true)).
+			Comment("命中后需要打的标签"),
+		field.JSON("action_label_del", []uint64{}).Optional().
+			Annotations(entsql.WithComments(true)).
+			Comment("命中后需要移除的标签"),
+	}
+}
+
+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"},
+	}
+}

+ 192 - 0
ent/set_not_nil.go

@@ -3032,6 +3032,198 @@ func (lr *LabelRelationshipCreate) SetNotNilOrganizationID(value *uint64) *Label
 }
 
 // set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdate) SetNotNilUpdatedAt(value *time.Time) *LabelTaggingUpdate {
+	if value != nil {
+		return lt.SetUpdatedAt(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdateOne) SetNotNilUpdatedAt(value *time.Time) *LabelTaggingUpdateOne {
+	if value != nil {
+		return lt.SetUpdatedAt(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingCreate) SetNotNilUpdatedAt(value *time.Time) *LabelTaggingCreate {
+	if value != nil {
+		return lt.SetUpdatedAt(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdate) SetNotNilStatus(value *uint8) *LabelTaggingUpdate {
+	if value != nil {
+		return lt.SetStatus(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdateOne) SetNotNilStatus(value *uint8) *LabelTaggingUpdateOne {
+	if value != nil {
+		return lt.SetStatus(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingCreate) SetNotNilStatus(value *uint8) *LabelTaggingCreate {
+	if value != nil {
+		return lt.SetStatus(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdate) SetNotNilDeletedAt(value *time.Time) *LabelTaggingUpdate {
+	if value != nil {
+		return lt.SetDeletedAt(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdateOne) SetNotNilDeletedAt(value *time.Time) *LabelTaggingUpdateOne {
+	if value != nil {
+		return lt.SetDeletedAt(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingCreate) SetNotNilDeletedAt(value *time.Time) *LabelTaggingCreate {
+	if value != nil {
+		return lt.SetDeletedAt(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdate) SetNotNilOrganizationID(value *uint64) *LabelTaggingUpdate {
+	if value != nil {
+		return lt.SetOrganizationID(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdateOne) SetNotNilOrganizationID(value *uint64) *LabelTaggingUpdateOne {
+	if value != nil {
+		return lt.SetOrganizationID(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingCreate) SetNotNilOrganizationID(value *uint64) *LabelTaggingCreate {
+	if value != nil {
+		return lt.SetOrganizationID(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdate) SetNotNilType(value *int) *LabelTaggingUpdate {
+	if value != nil {
+		return lt.SetType(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdateOne) SetNotNilType(value *int) *LabelTaggingUpdateOne {
+	if value != nil {
+		return lt.SetType(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingCreate) SetNotNilType(value *int) *LabelTaggingCreate {
+	if value != nil {
+		return lt.SetType(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdate) SetNotNilConditions(value *string) *LabelTaggingUpdate {
+	if value != nil {
+		return lt.SetConditions(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdateOne) SetNotNilConditions(value *string) *LabelTaggingUpdateOne {
+	if value != nil {
+		return lt.SetConditions(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingCreate) SetNotNilConditions(value *string) *LabelTaggingCreate {
+	if value != nil {
+		return lt.SetConditions(*value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdate) SetNotNilActionLabelAdd(value []uint64) *LabelTaggingUpdate {
+	if value != nil {
+		return lt.SetActionLabelAdd(value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdateOne) SetNotNilActionLabelAdd(value []uint64) *LabelTaggingUpdateOne {
+	if value != nil {
+		return lt.SetActionLabelAdd(value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingCreate) SetNotNilActionLabelAdd(value []uint64) *LabelTaggingCreate {
+	if value != nil {
+		return lt.SetActionLabelAdd(value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdate) SetNotNilActionLabelDel(value []uint64) *LabelTaggingUpdate {
+	if value != nil {
+		return lt.SetActionLabelDel(value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingUpdateOne) SetNotNilActionLabelDel(value []uint64) *LabelTaggingUpdateOne {
+	if value != nil {
+		return lt.SetActionLabelDel(value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
+func (lt *LabelTaggingCreate) SetNotNilActionLabelDel(value []uint64) *LabelTaggingCreate {
+	if value != nil {
+		return lt.SetActionLabelDel(value)
+	}
+	return lt
+}
+
+// set field if value's pointer is not nil.
 func (m *MessageUpdate) SetNotNilWxWxid(value *string) *MessageUpdate {
 	if value != nil {
 		return m.SetWxWxid(*value)

+ 3 - 0
ent/tx.go

@@ -38,6 +38,8 @@ type Tx struct {
 	Label *LabelClient
 	// LabelRelationship is the client for interacting with the LabelRelationship builders.
 	LabelRelationship *LabelRelationshipClient
+	// LabelTagging is the client for interacting with the LabelTagging builders.
+	LabelTagging *LabelTaggingClient
 	// Message is the client for interacting with the Message builders.
 	Message *MessageClient
 	// MessageRecords is the client for interacting with the MessageRecords builders.
@@ -223,6 +225,7 @@ func (tx *Tx) init() {
 	tx.EmployeeConfig = NewEmployeeConfigClient(tx.config)
 	tx.Label = NewLabelClient(tx.config)
 	tx.LabelRelationship = NewLabelRelationshipClient(tx.config)
+	tx.LabelTagging = NewLabelTaggingClient(tx.config)
 	tx.Message = NewMessageClient(tx.config)
 	tx.MessageRecords = NewMessageRecordsClient(tx.config)
 	tx.Msg = NewMsgClient(tx.config)

+ 44 - 0
internal/handler/label_tagging/create_label_tagging_handler.go

@@ -0,0 +1,44 @@
+package label_tagging
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+
+	"wechat-api/internal/logic/label_tagging"
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+)
+
+// swagger:route post /label_tagging/create label_tagging CreateLabelTagging
+//
+// Create label tagging information | 创建LabelTagging信息
+//
+// Create label tagging information | 创建LabelTagging信息
+//
+// Parameters:
+//  + name: body
+//    require: true
+//    in: body
+//    type: LabelTaggingInfo
+//
+// Responses:
+//  200: BaseMsgResp
+
+func CreateLabelTaggingHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.LabelTaggingInfo
+		if err := httpx.Parse(r, &req, true); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := label_tagging.NewCreateLabelTaggingLogic(r.Context(), svcCtx)
+		resp, err := l.CreateLabelTagging(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 44 - 0
internal/handler/label_tagging/delete_label_tagging_handler.go

@@ -0,0 +1,44 @@
+package label_tagging
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+
+	"wechat-api/internal/logic/label_tagging"
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+)
+
+// swagger:route post /label_tagging/delete label_tagging DeleteLabelTagging
+//
+// Delete label tagging information | 删除LabelTagging信息
+//
+// Delete label tagging information | 删除LabelTagging信息
+//
+// Parameters:
+//  + name: body
+//    require: true
+//    in: body
+//    type: IDReq
+//
+// Responses:
+//  200: BaseMsgResp
+
+func DeleteLabelTaggingHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.IDsReq
+		if err := httpx.Parse(r, &req, true); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := label_tagging.NewDeleteLabelTaggingLogic(r.Context(), svcCtx)
+		resp, err := l.DeleteLabelTagging(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 44 - 0
internal/handler/label_tagging/get_label_tagging_by_id_handler.go

@@ -0,0 +1,44 @@
+package label_tagging
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+
+	"wechat-api/internal/logic/label_tagging"
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+)
+
+// swagger:route post /label_tagging label_tagging GetLabelTaggingById
+//
+// Get label tagging by ID | 通过ID获取LabelTagging信息
+//
+// Get label tagging by ID | 通过ID获取LabelTagging信息
+//
+// Parameters:
+//  + name: body
+//    require: true
+//    in: body
+//    type: IDReq
+//
+// Responses:
+//  200: LabelTaggingInfoResp
+
+func GetLabelTaggingByIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.IDReq
+		if err := httpx.Parse(r, &req, true); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := label_tagging.NewGetLabelTaggingByIdLogic(r.Context(), svcCtx)
+		resp, err := l.GetLabelTaggingById(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 44 - 0
internal/handler/label_tagging/get_label_tagging_list_handler.go

@@ -0,0 +1,44 @@
+package label_tagging
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+
+	"wechat-api/internal/logic/label_tagging"
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+)
+
+// swagger:route post /label_tagging/list label_tagging GetLabelTaggingList
+//
+// Get label tagging list | 获取LabelTagging信息列表
+//
+// Get label tagging list | 获取LabelTagging信息列表
+//
+// Parameters:
+//  + name: body
+//    require: true
+//    in: body
+//    type: LabelTaggingListReq
+//
+// Responses:
+//  200: LabelTaggingListResp
+
+func GetLabelTaggingListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.LabelTaggingListReq
+		if err := httpx.Parse(r, &req, true); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := label_tagging.NewGetLabelTaggingListLogic(r.Context(), svcCtx)
+		resp, err := l.GetLabelTaggingList(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 44 - 0
internal/handler/label_tagging/update_label_tagging_handler.go

@@ -0,0 +1,44 @@
+package label_tagging
+
+import (
+	"net/http"
+
+	"github.com/zeromicro/go-zero/rest/httpx"
+
+	"wechat-api/internal/logic/label_tagging"
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+)
+
+// swagger:route post /label_tagging/update label_tagging UpdateLabelTagging
+//
+// Update label tagging information | 更新LabelTagging信息
+//
+// Update label tagging information | 更新LabelTagging信息
+//
+// Parameters:
+//  + name: body
+//    require: true
+//    in: body
+//    type: LabelTaggingInfo
+//
+// Responses:
+//  200: BaseMsgResp
+
+func UpdateLabelTaggingHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.LabelTaggingInfo
+		if err := httpx.Parse(r, &req, true); err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+			return
+		}
+
+		l := label_tagging.NewUpdateLabelTaggingLogic(r.Context(), svcCtx)
+		resp, err := l.UpdateLabelTagging(&req)
+		if err != nil {
+			httpx.ErrorCtx(r.Context(), w, err)
+		} else {
+			httpx.OkJsonCtx(r.Context(), w, resp)
+		}
+	}
+}

+ 35 - 0
internal/handler/routes.go

@@ -29,6 +29,7 @@ import (
 	employee_config "wechat-api/internal/handler/employee_config"
 	label "wechat-api/internal/handler/label"
 	label_relationship "wechat-api/internal/handler/label_relationship"
+	label_tagging "wechat-api/internal/handler/label_tagging"
 	message_records "wechat-api/internal/handler/message_records"
 	openapi "wechat-api/internal/handler/openapi"
 	sop_node "wechat-api/internal/handler/sop_node"
@@ -445,6 +446,40 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 	)
 
 	server.AddRoutes(
+		rest.WithMiddlewares(
+			[]rest.Middleware{serverCtx.Authority},
+			[]rest.Route{
+				{
+					Method:  http.MethodPost,
+					Path:    "/label_tagging/create",
+					Handler: label_tagging.CreateLabelTaggingHandler(serverCtx),
+				},
+				{
+					Method:  http.MethodPost,
+					Path:    "/label_tagging/update",
+					Handler: label_tagging.UpdateLabelTaggingHandler(serverCtx),
+				},
+				{
+					Method:  http.MethodPost,
+					Path:    "/label_tagging/delete",
+					Handler: label_tagging.DeleteLabelTaggingHandler(serverCtx),
+				},
+				{
+					Method:  http.MethodPost,
+					Path:    "/label_tagging/list",
+					Handler: label_tagging.GetLabelTaggingListHandler(serverCtx),
+				},
+				{
+					Method:  http.MethodPost,
+					Path:    "/label_tagging",
+					Handler: label_tagging.GetLabelTaggingByIdHandler(serverCtx),
+				},
+			}...,
+		),
+		rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
+	)
+
+	server.AddRoutes(
 		[]rest.Route{
 			{
 				Method:  http.MethodPost,

+ 41 - 0
internal/logic/label_tagging/create_label_tagging_logic.go

@@ -0,0 +1,41 @@
+package label_tagging
+
+import (
+	"context"
+	"github.com/suyuan32/simple-admin-common/msg/errormsg"
+	"wechat-api/internal/utils/dberrorhandler"
+
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type CreateLabelTaggingLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewCreateLabelTaggingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateLabelTaggingLogic {
+	return &CreateLabelTaggingLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx}
+}
+
+func (l *CreateLabelTaggingLogic) CreateLabelTagging(req *types.LabelTaggingInfo) (resp *types.BaseMsgResp, err error) {
+	organizationId := l.ctx.Value("organizationId").(uint64)
+	_, err = l.svcCtx.DB.LabelTagging.Create().
+		SetOrganizationID(organizationId).
+		SetConditions(req.Conditions).
+		SetNotNilActionLabelAdd(req.ActionLabelAdd).
+		SetNotNilActionLabelDel(req.ActionLabelDel).
+		Save(l.ctx)
+
+	if err != nil {
+		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
+	}
+	l.svcCtx.Rds.Del(l.ctx, "label_tagging_info")
+	return &types.BaseMsgResp{Msg: errormsg.CreateSuccess}, nil
+}

+ 37 - 0
internal/logic/label_tagging/delete_label_tagging_logic.go

@@ -0,0 +1,37 @@
+package label_tagging
+
+import (
+	"context"
+	"github.com/suyuan32/simple-admin-common/msg/errormsg"
+	"wechat-api/ent/labeltagging"
+	"wechat-api/internal/utils/dberrorhandler"
+
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type DeleteLabelTaggingLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewDeleteLabelTaggingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteLabelTaggingLogic {
+	return &DeleteLabelTaggingLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx}
+}
+
+func (l *DeleteLabelTaggingLogic) DeleteLabelTagging(req *types.IDsReq) (resp *types.BaseMsgResp, err error) {
+	organizationId := l.ctx.Value("organizationId").(uint64)
+	_, err = l.svcCtx.DB.LabelTagging.Delete().Where(labeltagging.IDIn(req.Ids...), labeltagging.OrganizationID(organizationId)).Exec(l.ctx)
+
+	if err != nil {
+		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
+	}
+	l.svcCtx.Rds.Del(l.ctx, "label_tagging_info")
+	return &types.BaseMsgResp{Msg: errormsg.DeleteSuccess}, nil
+}

+ 55 - 0
internal/logic/label_tagging/get_label_tagging_by_id_logic.go

@@ -0,0 +1,55 @@
+package label_tagging
+
+import (
+	"context"
+	"github.com/suyuan32/simple-admin-common/msg/errormsg"
+	"github.com/suyuan32/simple-admin-common/utils/pointy"
+	"wechat-api/ent/labeltagging"
+	"wechat-api/internal/utils/dberrorhandler"
+
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetLabelTaggingByIdLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewGetLabelTaggingByIdLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLabelTaggingByIdLogic {
+	return &GetLabelTaggingByIdLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx}
+}
+
+func (l *GetLabelTaggingByIdLogic) GetLabelTaggingById(req *types.IDReq) (resp *types.LabelTaggingInfoResp, err error) {
+	organizationId := l.ctx.Value("organizationId").(uint64)
+	data, err := l.svcCtx.DB.LabelTagging.Query().Where(labeltagging.ID(req.Id), labeltagging.OrganizationID(organizationId)).Only(l.ctx)
+	if err != nil {
+		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
+	}
+
+	return &types.LabelTaggingInfoResp{
+		BaseDataInfo: types.BaseDataInfo{
+			Code: 0,
+			Msg:  errormsg.Success,
+		},
+		Data: types.LabelTaggingInfo{
+			BaseIDInfo: types.BaseIDInfo{
+				Id:        &data.ID,
+				CreatedAt: pointy.GetPointer(data.CreatedAt.UnixMilli()),
+				UpdatedAt: pointy.GetPointer(data.UpdatedAt.UnixMilli()),
+			},
+			Status:         &data.Status,
+			OrganizationId: &data.OrganizationID,
+			Type:           &data.Type,
+			Conditions:     data.Conditions,
+			ActionLabelAdd: data.ActionLabelAdd,
+			ActionLabelDel: data.ActionLabelDel,
+		},
+	}, nil
+}

+ 69 - 0
internal/logic/label_tagging/get_label_tagging_list_logic.go

@@ -0,0 +1,69 @@
+package label_tagging
+
+import (
+	"context"
+	"github.com/suyuan32/simple-admin-common/msg/errormsg"
+	"github.com/suyuan32/simple-admin-common/utils/pointy"
+	"wechat-api/ent/label"
+	"wechat-api/ent/labeltagging"
+	"wechat-api/ent/predicate"
+	"wechat-api/internal/utils/dberrorhandler"
+
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetLabelTaggingListLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewGetLabelTaggingListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLabelTaggingListLogic {
+	return &GetLabelTaggingListLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx}
+}
+
+func (l *GetLabelTaggingListLogic) GetLabelTaggingList(req *types.LabelTaggingListReq) (resp *types.LabelTaggingListResp, err error) {
+	organizationId := l.ctx.Value("organizationId").(uint64)
+	var predicates []predicate.LabelTagging
+	predicates = append(predicates, labeltagging.OrganizationIDEQ(organizationId))
+	data, err := l.svcCtx.DB.LabelTagging.Query().Where(predicates...).Page(l.ctx, req.Page, req.PageSize)
+
+	if err != nil {
+		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
+	}
+
+	resp = &types.LabelTaggingListResp{}
+	resp.Msg = errormsg.Success
+	resp.Data.Total = data.PageDetails.Total
+
+	for _, v := range data.List {
+		var labelAddInfo []string
+		labels, _ := l.svcCtx.DB.Label.Query().Where(label.IDIn(v.ActionLabelAdd...)).All(l.ctx)
+		for _, l := range labels {
+			labelAddInfo = append(labelAddInfo, l.Name)
+		}
+		resp.Data.Data = append(resp.Data.Data,
+			types.LabelTaggingInfo{
+				BaseIDInfo: types.BaseIDInfo{
+					Id:        &v.ID,
+					CreatedAt: pointy.GetPointer(v.CreatedAt.UnixMilli()),
+					UpdatedAt: pointy.GetPointer(v.UpdatedAt.UnixMilli()),
+				},
+				Status:         &v.Status,
+				OrganizationId: &v.OrganizationID,
+				Type:           &v.Type,
+				Conditions:     v.Conditions,
+				ActionLabelAdd: v.ActionLabelAdd,
+				LabelAddInfo:   labelAddInfo,
+				ActionLabelDel: v.ActionLabelDel,
+			})
+	}
+
+	return resp, nil
+}

+ 41 - 0
internal/logic/label_tagging/update_label_tagging_logic.go

@@ -0,0 +1,41 @@
+package label_tagging
+
+import (
+	"context"
+	"github.com/suyuan32/simple-admin-common/msg/errormsg"
+	"wechat-api/ent/labeltagging"
+	"wechat-api/internal/utils/dberrorhandler"
+
+	"wechat-api/internal/svc"
+	"wechat-api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type UpdateLabelTaggingLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewUpdateLabelTaggingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateLabelTaggingLogic {
+	return &UpdateLabelTaggingLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx}
+}
+
+func (l *UpdateLabelTaggingLogic) UpdateLabelTagging(req *types.LabelTaggingInfo) (resp *types.BaseMsgResp, err error) {
+	organizationId := l.ctx.Value("organizationId").(uint64)
+	err = l.svcCtx.DB.LabelTagging.Update().Where(labeltagging.ID(*req.Id), labeltagging.OrganizationID(organizationId)).
+		SetConditions(req.Conditions).
+		SetNotNilActionLabelAdd(req.ActionLabelAdd).
+		SetNotNilActionLabelDel(req.ActionLabelDel).
+		Exec(l.ctx)
+
+	if err != nil {
+		return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
+	}
+	l.svcCtx.Rds.Del(l.ctx, "label_tagging_info")
+	return &types.BaseMsgResp{Msg: errormsg.UpdateSuccess}, nil
+}

+ 49 - 0
internal/types/types.go

@@ -1128,6 +1128,55 @@ type LabelSelectListInfo struct {
 	Value *uint64 `json:"value,optional"`
 }
 
+// The data of label tagging information | LabelTagging信息
+// swagger:model LabelTaggingInfo
+type LabelTaggingInfo struct {
+	BaseIDInfo
+	// Status 1: normal 2: ban | 状态 1 正常 2 禁用
+	Status *uint8 `json:"status,optional"`
+	// 机构 ID
+	OrganizationId *uint64 `json:"organizationId,optional"`
+	// 标签类型:1好友,2群组,3公众号,4企业微信联系人
+	Type *int `json:"type,optional"`
+	// 关键词
+	Conditions string `json:"conditions,optional"`
+	// 命中后需要打的标签
+	ActionLabelAdd []uint64 `json:"actionLabelAdd,optional"`
+	// 命中后需要移除的标签
+	ActionLabelDel []uint64 `json:"actionLabelDel,optional"`
+	LabelAddInfo   []string `json:"labelAddInfo,optional"`
+}
+
+// The response data of label tagging list | LabelTagging信息列表数据
+// swagger:model LabelTaggingListResp
+type LabelTaggingListResp struct {
+	BaseDataInfo
+	// The label tagging list data | LabelTagging信息列表数据
+	Data LabelTaggingListInfo `json:"data"`
+}
+
+// The label tagging list data | LabelTagging信息列表数据
+// swagger:model LabelTaggingListInfo
+type LabelTaggingListInfo struct {
+	BaseListInfo
+	// The label tagging list data | LabelTagging信息列表数据
+	Data []LabelTaggingInfo `json:"data"`
+}
+
+// Get label tagging list request params | LabelTagging信息列表请求参数
+// swagger:model LabelTaggingListReq
+type LabelTaggingListReq struct {
+	PageInfo
+}
+
+// The label tagging information response | LabelTagging信息返回体
+// swagger:model LabelTaggingInfoResp
+type LabelTaggingInfoResp struct {
+	BaseDataInfo
+	// label tagging information | LabelTagging信息数据
+	Data LabelTaggingInfo `json:"data"`
+}
+
 // The response data of sop task list | SopTask列表数据
 // swagger:model SopTaskListResp
 type SopTaskListResp struct {