department.go
1.3 KB
package domain
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
)
type Department struct {
Id int64 `json:"id,omitempty"` // 部门ID
CompanyId int64 `json:"companyId,omitempty"` // 公司ID
ParentId int64 `json:"parentId,omitempty"` // 父级ID
Name string `json:"name,omitempty"` // 部门名称
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
}
type DepartmentRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *Department) (*Department, error)
Update(ctx context.Context, conn transaction.Conn, dm *Department) (*Department, error)
UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *Department) (*Department, error)
Delete(ctx context.Context, conn transaction.Conn, dm *Department) (*Department, error)
FindOne(ctx context.Context, conn transaction.Conn, id int64) (*Department, error)
Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*Department, error)
}
func (m *Department) Identify() interface{} {
if m.Id == 0 {
return nil
}
return m.Id
}