finclip-app-manager/infrastructure/db/repo/mysql/link_audit.go

49 lines
2.4 KiB
Go
Raw Permalink Normal View History

2023-10-31 14:07:26 +08:00
package mysql
import (
"context"
"finclip-app-manager/domain/repository"
"gorm.io/gorm"
)
var _ repository.ILinkAuditRepo = new(LinkAuditByMysqlRepo)
type LinkAuditByMysqlRepo struct {
}
type LinkAuditMysql struct {
Id uint `json:"id" gorm:"primary_key;column:id;type:BIGINT(16) AUTO_INCREMENT;comment:'自增id'" sql:"auto_increment;primary_key"`
AuditId string `json:"auditId" gorm:"column:audit_id;type:varchar(64);comment:id"`
Version int `json:"version" gorm:"column:version;type:INT(4);comment:审核序号"`
AppId string `json:"appId" gorm:"column:app_id;type:varchar(64);comment:小程序Id"`
AppName string `json:"appName" gorm:"column:app_name;type:varchar(64);comment:小程序名称"`
BindingId string `json:"bindingId" gorm:"column:binding_id;type:varchar(64);comment:应用Id"`
BindingName string `json:"bindingName" gorm:"column:binding_name;type:varchar(64);comment:应用名称"`
GroupID string `json:"groupId" gorm:"column:group_id;type:varchar(64);comment:企业ID"`
Owner string `json:"owner" gorm:"column:owner;type:varchar(64);comment:所属企业"`
ApplyBy string `json:"applyBy" gorm:"column:apply_by;type:varchar(64);comment:申请人"`
ApplyStatus string `json:"applyStatus" gorm:"column:apply_status;type:varchar(64);comment:审核状态"`
ApplyAt int64 `json:"applyAt" gorm:"column:apply_at;type:BIGINT(16);comment:timestamp"`
AuditBy string `json:"auditBy" gorm:"column:audit_by;type:varchar(64);comment:审核人"`
AuditAt int64 `json:"auditAt" gorm:"column:audit_at;type:BIGINT(16);comment:审核人"`
AssociateStatus string `json:"associateStatus" gorm:"column:associate_status;type:varchar(64);comment:绑定状态"`
Reason string `json:"reason" gorm:"column:reason;type:varchar(64);comment:原因"`
}
func (LinkAuditMysql) TableName() string {
return "link_audit"
}
func (l LinkAuditByMysqlRepo) Count(ctx context.Context, appID string, groupId string, bindingID string, stLinkAudit string) (int, error) {
query := "app_id = ? and group_id = ? and binding_id = ? and apply_status = ?"
args := []interface{}{appID, groupId, bindingID, stLinkAudit}
var count int64
err := DB.Model(&LinkAuditMysql{}).Where(query, args...).Count(&count).Error
return int(count), err
}
func (l LinkAuditByMysqlRepo) NotFound(err error) bool {
return err == gorm.ErrRecordNotFound
}