article_category.go 1.5 KB
package domain

import (
	"context"
	"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
)

type ArticleCategory struct {
	Id        int64  // 唯一标识
	CompanyId int64  `json:"companyId"`
	Name      string `json:"name"`
	SortBy    int    `json:"sortBy"`           // 排序
	Enable    int    `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用
	Other     string `json:"other"`            // 其他备注说明
	CreatedAt int64  `json:"createdAt,omitempty"`
	UpdatedAt int64  `json:"updatedAt,omitempty"`
	DeletedAt int64  `json:"deletedAt,omitempty"`
	Version   int    `json:"version,omitempty"`
}

type ArticleCategoryRepository interface {
	Insert(ctx context.Context, conn transaction.Conn, dm *ArticleCategory) (*ArticleCategory, error)
	Update(ctx context.Context, conn transaction.Conn, dm *ArticleCategory) (*ArticleCategory, error)
	UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *ArticleCategory) (*ArticleCategory, error)
	Delete(ctx context.Context, conn transaction.Conn, dm *ArticleCategory) (*ArticleCategory, error)
	FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleCategory, error)
	FindOneByName(ctx context.Context, conn transaction.Conn, companyId int64, name string) (*ArticleCategory, error)
	Find(ctx context.Context, conn transaction.Conn, companyId int64, queryOptions map[string]interface{}) (int64, []*ArticleCategory, error)
}

func (m *ArticleCategory) Identify() interface{} {
	if m.Id == 0 {
		return nil
	}
	return m.Id
}