Skip to content

Commit

Permalink
refactor(model): 优化模型结构和字段定义
Browse files Browse the repository at this point in the history
- 移除了不必要的导入语句
- 更新了字段标签,明确主键和索引
- 统一了字段定义的格式
- 删除了未使用的 EasyModel 和 BaseModel 基类
  • Loading branch information
aide-cloud committed Dec 26, 2024
1 parent 0dbe01d commit 3bc1285
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 24 deletions.
9 changes: 2 additions & 7 deletions pkg/palace/model/alarmmodel/realtime_arlarm_page.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
package alarmmodel

import (
"github.com/aide-family/moon/pkg/palace/model"
)

const tableNameRealtimeAlarmPage = "realtime_alarm_page"

// RealtimeAlarmPage represents the realtime alarm pages model
type RealtimeAlarmPage struct {
model.EasyModel
RealtimeAlarmID uint32 `gorm:"column:realtime_alarm_id;type:int;not null;comment:告警ID" json:"realtime_alarm_id"`
PageID uint32 `gorm:"column:page_id;type:int;not null;comment:页面ID" json:"page_id"`
RealtimeAlarmID uint32 `gorm:"primaryKey;column:realtime_alarm_id;type:int;not null;comment:告警ID;" json:"realtime_alarm_id"`
PageID uint32 `gorm:"primaryKey;column:page_id;type:int;not null;comment:页面ID" json:"page_id"`
}

// TableName overrides the default table name generated by gorm
Expand Down
9 changes: 2 additions & 7 deletions pkg/palace/model/alarmmodel/realtime_arlarm_receiver.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
package alarmmodel

import (
"github.com/aide-family/moon/pkg/palace/model"
)

const tableNameRealtimeAlarmReceiver = "realtime_alarm_receiver"

// RealtimeAlarmReceiver represents the realtime alarm receiver model
type RealtimeAlarmReceiver struct {
model.EasyModel
RealtimeAlarmID uint32 `gorm:"column:realtime_alarm_id;type:int;not null;comment:告警ID" json:"realtime_alarm_id"`
AlarmNoticeGroupID uint32 `gorm:"column:alarm_notice_group_id;type:int;not null;comment:告警通知组ID" json:"alarm_notice_group_id"`
RealtimeAlarmID uint32 `gorm:"primaryKey;column:realtime_alarm_id;type:int;not null;comment:告警ID" json:"realtime_alarm_id"`
AlarmNoticeGroupID uint32 `gorm:"primaryKey;column:alarm_notice_group_id;type:int;not null;comment:告警通知组ID" json:"alarm_notice_group_id"`
}

// TableName overrides the default table name generated by gorm
Expand Down
4 changes: 2 additions & 2 deletions pkg/palace/model/bizmodel/strategy_group_categories.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const tableNameStrategyGroupCategories = "strategy_group_categories"

// StrategyGroupCategories 策略分组类型中间表
type StrategyGroupCategories struct {
StrategyGroupID uint32 `gorm:"column:strategy_group_id;type:int unsigned;primaryKey" json:"strategy_group_id"`
SysDictID uint32 `gorm:"column:sys_dict_id;type:int unsigned;primaryKey" json:"sys_dict_id"`
StrategyGroupID uint32 `gorm:"primaryKey;column:strategy_group_id;type:int unsigned;primaryKey" json:"strategy_group_id"`
SysDictID uint32 `gorm:"primaryKey;column:sys_dict_id;type:int unsigned;primaryKey" json:"sys_dict_id"`
}

// UnmarshalBinary redis存储实现
Expand Down
6 changes: 2 additions & 4 deletions pkg/palace/model/bizmodel/sys_team_member_roles.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package bizmodel

import (
"github.com/aide-family/moon/pkg/palace/model"
"github.com/aide-family/moon/pkg/util/types"
)

const tableNameSysTeamMemberRole = "sys_team_member_roles"

// SysTeamMemberRole mapped from table <sys_team_member_roles>
type SysTeamMemberRole struct {
model.BaseModel
SysTeamMemberID uint32 `gorm:"column:sys_team_member_id;type:int unsigned;primaryKey;uniqueIndex:idx__user_id__team_id__role_id,priority:1;comment:团队用户ID" json:"sys_team_member_id"` // 团队用户ID
SysTeamRoleID uint32 `gorm:"column:sys_team_role_id;type:int unsigned;primaryKey;uniqueIndex:idx__user_id__team_id__role_id,priority:2;comment:团队角色ID" json:"sys_team_role_id"` // 团队角色ID
SysTeamMemberID uint32 `gorm:"primaryKey;column:sys_team_member_id;type:int unsigned;primaryKey;uniqueIndex:idx__user_id__team_id__role_id,priority:1;comment:团队用户ID" json:"sys_team_member_id"` // 团队用户ID
SysTeamRoleID uint32 `gorm:"primaryKey;column:sys_team_role_id;type:int unsigned;primaryKey;uniqueIndex:idx__user_id__team_id__role_id,priority:2;comment:团队角色ID" json:"sys_team_role_id"` // 团队角色ID
}

// String json string
Expand Down
6 changes: 2 additions & 4 deletions pkg/palace/model/bizmodel/sys_team_role_apis.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package bizmodel

import (
"github.com/aide-family/moon/pkg/palace/model"
"github.com/aide-family/moon/pkg/util/types"
)

const tableNameSysTeamRoleAPI = "sys_team_role_apis"

// SysTeamRoleAPI mapped from table <sys_team_role_apis>
type SysTeamRoleAPI struct {
model.BaseModel
SysTeamRoleID uint32 `gorm:"column:sys_team_role_id;type:int unsigned;primaryKey" json:"sys_team_role_id"`
SysTeamAPIID uint32 `gorm:"column:sys_api_id;type:int unsigned;primaryKey" json:"sys_team_api_id"`
SysTeamRoleID uint32 `gorm:"primaryKey;column:sys_team_role_id;type:int unsigned;primaryKey" json:"sys_team_role_id"`
SysTeamAPIID uint32 `gorm:"primaryKey;column:sys_api_id;type:int unsigned;primaryKey" json:"sys_team_api_id"`
}

// String json string
Expand Down

0 comments on commit 3bc1285

Please sign in to comment.