Files
junhong_cmp_fiber/internal/model/shop_role.go
huang 5a90caa619
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 6m39s
feat(shop-role): 实现店铺角色继承功能和权限检查优化
- 新增店铺角色管理 API 和数据模型
- 实现角色继承和权限检查逻辑
- 添加流程测试框架和集成测试
- 更新权限服务和账号管理逻辑
- 添加数据库迁移脚本
- 归档 OpenSpec 变更文档

Ultraworked with Sisyphus
2026-02-03 10:06:13 +08:00

25 lines
1.2 KiB
Go

package model
import (
"time"
"gorm.io/gorm"
)
// ShopRole 店铺-角色关联模型
type ShopRole struct {
ID uint `gorm:"column:id;primarykey;comment:主键ID" json:"id"`
ShopID uint `gorm:"column:shop_id;not null;index;uniqueIndex:uq_shop_role_shop_id_role_id,where:deleted_at IS NULL;comment:店铺ID" json:"shop_id"`
RoleID uint `gorm:"column:role_id;not null;index;uniqueIndex:uq_shop_role_shop_id_role_id,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"`
}
func (ShopRole) TableName() string {
return "tb_shop_role"
}