feat: 新增预警定时扫描器,移除附件归档字段并为角色表补充更新时间

This commit is contained in:
SunYF
2026-10-31 15:41:27 +08:00
parent 11dbdaae75
commit 0c03d32682
107 changed files with 10790 additions and 1844 deletions
+2 -24
View File
@@ -36,10 +36,6 @@ type Attachment struct {
MimeType string `json:"mimeType,omitempty"`
// 上传人
UploadedBy string `json:"uploadedBy,omitempty"`
// 是否已归档(备份到外部存储)
Archived bool `json:"archived,omitempty"`
// 归档时间(unix秒)
ArchivedAt int64 `json:"archivedAt,omitempty"`
// 逻辑删除标记
Deleted bool `json:"deleted,omitempty"`
// 删除时间(unix秒)
@@ -62,9 +58,9 @@ func (*Attachment) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case attachment.FieldArchived, attachment.FieldDeleted:
case attachment.FieldDeleted:
values[i] = new(sql.NullBool)
case attachment.FieldID, attachment.FieldFileSize, attachment.FieldArchivedAt, attachment.FieldDeletedAt, attachment.FieldPurgedAt, attachment.FieldCreatedAt:
case attachment.FieldID, attachment.FieldFileSize, attachment.FieldDeletedAt, attachment.FieldPurgedAt, attachment.FieldCreatedAt:
values[i] = new(sql.NullInt64)
case attachment.FieldBizType, attachment.FieldBizID, attachment.FieldFileName, attachment.FieldFilePath, attachment.FieldFileType, attachment.FieldFileExt, attachment.FieldFileMd5, attachment.FieldMimeType, attachment.FieldUploadedBy, attachment.FieldDeletedBy, attachment.FieldDeletedReason, attachment.FieldPurgedBy:
values[i] = new(sql.NullString)
@@ -149,18 +145,6 @@ func (_m *Attachment) assignValues(columns []string, values []any) error {
} else if value.Valid {
_m.UploadedBy = value.String
}
case attachment.FieldArchived:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field archived", values[i])
} else if value.Valid {
_m.Archived = value.Bool
}
case attachment.FieldArchivedAt:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field archived_at", values[i])
} else if value.Valid {
_m.ArchivedAt = value.Int64
}
case attachment.FieldDeleted:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field deleted", values[i])
@@ -269,12 +253,6 @@ func (_m *Attachment) String() string {
builder.WriteString("uploaded_by=")
builder.WriteString(_m.UploadedBy)
builder.WriteString(", ")
builder.WriteString("archived=")
builder.WriteString(fmt.Sprintf("%v", _m.Archived))
builder.WriteString(", ")
builder.WriteString("archived_at=")
builder.WriteString(fmt.Sprintf("%v", _m.ArchivedAt))
builder.WriteString(", ")
builder.WriteString("deleted=")
builder.WriteString(fmt.Sprintf("%v", _m.Deleted))
builder.WriteString(", ")