log_opt.go 1.2 KB
package domain

import "time"

type OptMethod int

const (
	CREATE OptMethod = 1 // 创建
	UPDATE OptMethod = 2 // 更新
	DELETE OptMethod = 3 // 删除
)

// LogOpt 操作日志
type LogOpt struct {
	//OptModule string     `json:"optModule" comment:"操作模块"`
	Id          int        `json:"id,string"  comment:"ID" pg:"id,pk"`
	CompanyId   int        `json:"companyId" comment:"公司ID"`
	Operator    StaffDesc  `json:"operator" comment:"操作人"`
	OptMethod   OptMethod  `json:"optMethod" comment:"操作方法"`
	OptTargetId string     `json:"optTargetId" comment:"操作目标ID"`
	OptField    string     `json:"optField" comment:"操作字段"`
	OptValue    string     `json:"optValue" comment:"操作字段值"`
	CreatedAt   time.Time  `json:"createdAt" comment:"创建时间"`
	UpdatedAt   time.Time  `json:"updatedAt" comment:"更新时间"`
	DeletedAt   *time.Time `json:"deletedAt" comment:"删除时间"`
}

type LogOptRepository interface {
	Insert(opt *LogOpt) (*LogOpt, error)
	Remove(opt *LogOpt) (*LogOpt, error)
	FindOne(queryOptions map[string]interface{}) (*LogOpt, error)
	Find(queryOptions map[string]interface{}) (int64, []*LogOpt, error)
	Count(queryOptions map[string]interface{}) (int64, error)
}