代码质量改进:修复架构违规、完善文档注释和清理冗余代码
- 修复 health.go handler 直接操作响应的架构违规问题 - 为 model 字段添加 GORM comment 标签(account_role、base、role_permission) - 为 handler、service、store 包添加包级文档注释 - 清理 customer service 和 personal_customer handler 中注释掉的代码 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,15 +8,15 @@ import (
|
||||
|
||||
// AccountRole 账号-角色关联模型
|
||||
type AccountRole struct {
|
||||
ID uint `gorm:"column:id;primarykey" json:"id"`
|
||||
AccountID uint `gorm:"column:account_id;not null;index;uniqueIndex:idx_account_role_unique,where:deleted_at IS NULL" json:"account_id"`
|
||||
RoleID uint `gorm:"column:role_id;not null;index;uniqueIndex:idx_account_role_unique,where:deleted_at IS NULL" json:"role_id"`
|
||||
Status int `gorm:"column:status;not null;default:1" json:"status"`
|
||||
Creator uint `gorm:"column:creator;not null" json:"creator"`
|
||||
Updater uint `gorm:"column:updater;not null" json:"updater"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;not null" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;not null" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;index" json:"deleted_at,omitempty"`
|
||||
ID uint `gorm:"column:id;primarykey;comment:主键ID" json:"id"`
|
||||
AccountID uint `gorm:"column:account_id;not null;index;uniqueIndex:idx_account_role_unique,where:deleted_at IS NULL;comment:账号ID" json:"account_id"`
|
||||
RoleID uint `gorm:"column:role_id;not null;index;uniqueIndex:idx_account_role_unique,where:deleted_at IS NULL;comment:角色ID" json:"role_id"`
|
||||
Status int `gorm:"column:status;not null;default:1;comment:状态 0=禁用 1=启用" json:"status"`
|
||||
Creator uint `gorm:"column:creator;not null;comment:创建人ID" json:"creator"`
|
||||
Updater uint `gorm:"column:updater;not null;comment:更新人ID" json:"updater"`
|
||||
CreatedAt time.Time `gorm:"column:created_at;not null;comment:创建时间" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;not null;comment:更新时间" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;index;comment:删除时间" json:"deleted_at,omitempty"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
|
||||
@@ -4,6 +4,6 @@ package model
|
||||
//
|
||||
// BaseModel 基础模型,包含通用字段
|
||||
type BaseModel struct {
|
||||
Creator uint `gorm:"column:creator;not null" json:"creator"`
|
||||
Updater uint `gorm:"column:updater;not null" json:"updater"`
|
||||
Creator uint `gorm:"column:creator;not null;comment:创建人ID" json:"creator"`
|
||||
Updater uint `gorm:"column:updater;not null;comment:更新人ID" json:"updater"`
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ type RolePermission struct {
|
||||
gorm.Model
|
||||
BaseModel `gorm:"embedded"`
|
||||
|
||||
RoleID uint `gorm:"column:role_id;not null;index;uniqueIndex:idx_role_permission_unique,where:deleted_at IS NULL" json:"role_id"`
|
||||
PermID uint `gorm:"column:perm_id;not null;index;uniqueIndex:idx_role_permission_unique,where:deleted_at IS NULL" json:"perm_id"`
|
||||
Status int `gorm:"column:status;not null;default:1" json:"status"`
|
||||
RoleID uint `gorm:"column:role_id;not null;index;uniqueIndex:idx_role_permission_unique,where:deleted_at IS NULL;comment:角色ID" json:"role_id"`
|
||||
PermID uint `gorm:"column:perm_id;not null;index;uniqueIndex:idx_role_permission_unique,where:deleted_at IS NULL;comment:权限ID" json:"perm_id"`
|
||||
Status int `gorm:"column:status;not null;default:1;comment:状态 0=禁用 1=启用" json:"status"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
|
||||
Reference in New Issue
Block a user