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
+44 -6
View File
@@ -3,6 +3,8 @@
package ent
import (
"bj_power_wms/ent/alert"
"bj_power_wms/ent/alertrule"
"bj_power_wms/ent/attachment"
"bj_power_wms/ent/backuprecord"
"bj_power_wms/ent/eventlog"
@@ -32,22 +34,58 @@ import (
// (default values, validators, hooks and policies) and stitches it
// to their package variables.
func init() {
alertFields := schema.Alert{}.Fields()
_ = alertFields
// alertDescLevel is the schema descriptor for level field.
alertDescLevel := alertFields[1].Descriptor()
// alert.DefaultLevel holds the default value on creation for the level field.
alert.DefaultLevel = alertDescLevel.Default.(string)
// alert.LevelValidator is a validator for the "level" field. It is called by the builders before save.
alert.LevelValidator = alertDescLevel.Validators[0].(func(string) error)
// alertDescStatus is the schema descriptor for status field.
alertDescStatus := alertFields[5].Descriptor()
// alert.DefaultStatus holds the default value on creation for the status field.
alert.DefaultStatus = alertDescStatus.Default.(string)
// alert.StatusValidator is a validator for the "status" field. It is called by the builders before save.
alert.StatusValidator = alertDescStatus.Validators[0].(func(string) error)
// alertDescCreatedAt is the schema descriptor for created_at field.
alertDescCreatedAt := alertFields[6].Descriptor()
// alert.DefaultCreatedAt holds the default value on creation for the created_at field.
alert.DefaultCreatedAt = alertDescCreatedAt.Default.(func() int64)
// alertDescUpdatedAt is the schema descriptor for updated_at field.
alertDescUpdatedAt := alertFields[7].Descriptor()
// alert.DefaultUpdatedAt holds the default value on creation for the updated_at field.
alert.DefaultUpdatedAt = alertDescUpdatedAt.Default.(func() int64)
alertruleFields := schema.AlertRule{}.Fields()
_ = alertruleFields
// alertruleDescEnabled is the schema descriptor for enabled field.
alertruleDescEnabled := alertruleFields[2].Descriptor()
// alertrule.DefaultEnabled holds the default value on creation for the enabled field.
alertrule.DefaultEnabled = alertruleDescEnabled.Default.(bool)
// alertruleDescThreshold is the schema descriptor for threshold field.
alertruleDescThreshold := alertruleFields[3].Descriptor()
// alertrule.DefaultThreshold holds the default value on creation for the threshold field.
alertrule.DefaultThreshold = alertruleDescThreshold.Default.(int)
// alertruleDescCreatedAt is the schema descriptor for created_at field.
alertruleDescCreatedAt := alertruleFields[5].Descriptor()
// alertrule.DefaultCreatedAt holds the default value on creation for the created_at field.
alertrule.DefaultCreatedAt = alertruleDescCreatedAt.Default.(func() int64)
// alertruleDescUpdatedAt is the schema descriptor for updated_at field.
alertruleDescUpdatedAt := alertruleFields[6].Descriptor()
// alertrule.DefaultUpdatedAt holds the default value on creation for the updated_at field.
alertrule.DefaultUpdatedAt = alertruleDescUpdatedAt.Default.(func() int64)
attachmentFields := schema.Attachment{}.Fields()
_ = attachmentFields
// attachmentDescFileSize is the schema descriptor for file_size field.
attachmentDescFileSize := attachmentFields[7].Descriptor()
// attachment.DefaultFileSize holds the default value on creation for the file_size field.
attachment.DefaultFileSize = attachmentDescFileSize.Default.(int64)
// attachmentDescArchived is the schema descriptor for archived field.
attachmentDescArchived := attachmentFields[10].Descriptor()
// attachment.DefaultArchived holds the default value on creation for the archived field.
attachment.DefaultArchived = attachmentDescArchived.Default.(bool)
// attachmentDescDeleted is the schema descriptor for deleted field.
attachmentDescDeleted := attachmentFields[12].Descriptor()
attachmentDescDeleted := attachmentFields[10].Descriptor()
// attachment.DefaultDeleted holds the default value on creation for the deleted field.
attachment.DefaultDeleted = attachmentDescDeleted.Default.(bool)
// attachmentDescCreatedAt is the schema descriptor for created_at field.
attachmentDescCreatedAt := attachmentFields[18].Descriptor()
attachmentDescCreatedAt := attachmentFields[16].Descriptor()
// attachment.DefaultCreatedAt holds the default value on creation for the created_at field.
attachment.DefaultCreatedAt = attachmentDescCreatedAt.Default.(func() int64)
backuprecordFields := schema.BackupRecord{}.Fields()