feat: 业务组和应用支持多负责人,修复权限查询表名错误
- 业务组 MasterUid 改为 MasterUids(逗号分隔多用户ID) - 应用 OwnerId 改为 OwnerIds(逗号分隔多用户ID) - 前端负责人下拉框改为多选 - 权限查询改用 FIND_IN_SET 匹配多负责人 - 修复 user_permissions 表名错误(应为 user_permission) - 所有数据库实体添加 TableName() 方法显式指定表名 - xorm tag 显式指定 owner_ids/master_uids 列名 - 启动时自动清理 owner_ids 中的空格
This commit is contained in:
@@ -22,6 +22,10 @@ type AppConfig struct {
|
||||
ClientCount int `xorm:"-" json:"clientCount,omitempty"`
|
||||
}
|
||||
|
||||
func (AppConfig) TableName() string {
|
||||
return "app_config"
|
||||
}
|
||||
|
||||
type AppConfigHistory struct {
|
||||
Id int `xorm:"int autoincr pk" json:"id"`
|
||||
OriginId int `xorm:"int" json:"originId"`
|
||||
@@ -37,3 +41,7 @@ type AppConfigHistory struct {
|
||||
CreatedAt *time.Time `xorm:"datetime" json:"createdAt"`
|
||||
CreatedBy string `xorm:"varchar(32)" json:"createdBy"`
|
||||
}
|
||||
|
||||
func (AppConfigHistory) TableName() string {
|
||||
return "app_config_history"
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ type Application struct {
|
||||
Code string `xorm:"varchar(32)" json:"code"`
|
||||
ServiceId string `xorm:"varchar(64)" json:"serviceId"`
|
||||
Token string `xorm:"varchar(64)" json:"token"`
|
||||
OwnerId *int `xorm:"int" json:"ownerId"`
|
||||
OwnerName string `xorm:"varchar(16)" json:"ownerName"`
|
||||
OwnerIds string `xorm:"varchar(255) 'owner_ids'" json:"ownerIds"`
|
||||
OwnerNames string `xorm:"varchar(255) 'owner_names'" json:"ownerNames"`
|
||||
Remarks string `xorm:"text" json:"remarks"`
|
||||
Enabled bool `xorm:"tinyint(1) default 1" json:"enabled"`
|
||||
CreatedAt *time.Time `xorm:"datetime" json:"createdAt"`
|
||||
@@ -19,3 +19,7 @@ type Application struct {
|
||||
UpdatedBy string `xorm:"varchar(32)" json:"updatedBy"`
|
||||
GroupName string `xorm:"-" json:"groupName,omitempty"`
|
||||
}
|
||||
|
||||
func (Application) TableName() string {
|
||||
return "application"
|
||||
}
|
||||
|
||||
@@ -3,14 +3,18 @@ package model
|
||||
import "time"
|
||||
|
||||
type BusinessGroup struct {
|
||||
Id int `xorm:"int autoincr pk" json:"id"`
|
||||
Name string `xorm:"varchar(32) notnull" json:"name"`
|
||||
Master string `xorm:"varchar(16)" json:"master"`
|
||||
MasterUid *int `xorm:"int" json:"masterUid"`
|
||||
Remarks string `xorm:"text" json:"remarks"`
|
||||
Enabled bool `xorm:"tinyint(1) default 1" json:"enabled"`
|
||||
CreatedAt *time.Time `xorm:"datetime" json:"createdAt"`
|
||||
CreatedBy string `xorm:"varchar(32)" json:"createdBy"`
|
||||
UpdatedAt *time.Time `xorm:"datetime" json:"updatedAt"`
|
||||
UpdatedBy string `xorm:"varchar(32)" json:"updatedBy"`
|
||||
Id int `xorm:"int autoincr pk" json:"id"`
|
||||
Name string `xorm:"varchar(32) notnull" json:"name"`
|
||||
Master string `xorm:"varchar(255)" json:"master"`
|
||||
MasterUids string `xorm:"varchar(255) 'master_uids'" json:"masterUids"`
|
||||
Remarks string `xorm:"text" json:"remarks"`
|
||||
Enabled bool `xorm:"tinyint(1) default 1" json:"enabled"`
|
||||
CreatedAt *time.Time `xorm:"datetime" json:"createdAt"`
|
||||
CreatedBy string `xorm:"varchar(32)" json:"createdBy"`
|
||||
UpdatedAt *time.Time `xorm:"datetime" json:"updatedAt"`
|
||||
UpdatedBy string `xorm:"varchar(32)" json:"updatedBy"`
|
||||
}
|
||||
|
||||
func (BusinessGroup) TableName() string {
|
||||
return "business_group"
|
||||
}
|
||||
|
||||
@@ -14,3 +14,7 @@ type ClientInstance struct {
|
||||
CreatedAt *time.Time `xorm:"datetime" json:"createdAt"`
|
||||
UpdatedAt *time.Time `xorm:"datetime" json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (ClientInstance) TableName() string {
|
||||
return "client_instance"
|
||||
}
|
||||
|
||||
@@ -12,9 +12,17 @@ type Profile struct {
|
||||
UpdatedAt *time.Time `xorm:"datetime" json:"updatedAt"`
|
||||
}
|
||||
|
||||
func (Profile) TableName() string {
|
||||
return "profile"
|
||||
}
|
||||
|
||||
type AppExtrAttr struct {
|
||||
AppId int `xorm:"int pk" json:"appId"`
|
||||
Env string `xorm:"varchar(16) pk" json:"env"`
|
||||
AttrName string `xorm:"varchar(32) pk" json:"attrName"`
|
||||
AttrValue string `xorm:"varchar(100)" json:"attrValue"`
|
||||
}
|
||||
|
||||
func (AppExtrAttr) TableName() string {
|
||||
return "app_extr_attr"
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@ type User struct {
|
||||
GroupMaster bool `xorm:"-" json:"groupMaster,omitempty"`
|
||||
}
|
||||
|
||||
func (User) TableName() string {
|
||||
return "user"
|
||||
}
|
||||
|
||||
type UserPermission struct {
|
||||
Id int `xorm:"int autoincr pk" json:"id"`
|
||||
UserId int `xorm:"int" json:"userId"`
|
||||
@@ -26,6 +30,10 @@ type UserPermission struct {
|
||||
Operate string `xorm:"varchar(8) default 'RW'" json:"operate"` // RO, RW
|
||||
}
|
||||
|
||||
func (UserPermission) TableName() string {
|
||||
return "user_permission"
|
||||
}
|
||||
|
||||
type LoginUserInfo struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
|
||||
Reference in New Issue
Block a user