权限,列表,详情

This commit is contained in:
2026-08-11 14:37:57 +08:00
parent 44c4aed22e
commit 8d14a63621
15 changed files with 1177 additions and 129 deletions
+50 -57
View File
@@ -1,7 +1,5 @@
package dao
import "pkg.local/utils"
const (
TypeDir = 1
TypeWeb = 2
@@ -19,58 +17,55 @@ const (
// Authority 权限表
type Authority struct {
Id int `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT;comment:ID" json:"id"`
Name string `gorm:"column:name;type:varchar(255);comment:菜单;NOT NULL" json:"name"`
ParentId int `gorm:"column:parent_id;type:int(11);default:0;comment:父级菜单;NOT NULL" json:"parent_id"`
ParentIds string `gorm:"column:parent_ids;type:varchar(255);comment:多级父级菜单;NOT NULL" json:"parent_ids"`
Level uint8 `gorm:"column:level;type:tinyint(2);default:0;comment:级别;NOT NULL" json:"level"`
Type uint8 `gorm:"column:type;type:tinyint(2);comment:类型,1目录,2页面,3按钮;NOT NULL" json:"type"`
ServiceId int `gorm:"column:service_id;type:int(11);comment:项目ID;NOT NULL" json:"service_id"`
Path string `gorm:"column:path;type:varchar(255);comment:页面请求地址;NOT NULL" json:"path"`
Api string `gorm:"column:api;type:varchar(255);comment:接口地址" json:"api"`
ViewPath string `gorm:"column:view_path;type:varchar(255);comment:页面文件路径" json:"view_path"`
Identification string `gorm:"column:identification;type:varchar(255);comment:权限标识" json:"identification"`
Icon string `gorm:"column:icon;type:varchar(255);comment:图标" json:"icon"`
Status uint8 `gorm:"column:status;type:tinyint(1);default:1;comment:状态,1为正常,2为禁用;NOT NULL" json:"status"`
Sort uint8 `gorm:"column:sort;type:smallint(3);default:1;comment:排序" json:"sort"`
JsonDataBase string `gorm:"column:json_data_base;type:text;comment:原始数据" json:"json_data_base"`
JsonTreeData string `gorm:"column:json_tree_data;type:text;comment:数据的树型结构" json:"json_tree_data"`
JsonData string `gorm:"column:json_data;type:text;comment:所有的数据" json:"json_data"`
DataIds string `gorm:"column:data_ids;type:varchar(32);comment:三个数据的IDs" json:"data_ids"`
IsShow uint8 `gorm:"column:is_show;type:tinyint(1);default:1;comment:菜单中是否显示,1为显示,2为不显示;NOT NULL" json:"is_show"`
Remarks string `gorm:"column:remarks;type:varchar(255);comment:备注;NOT NULL" json:"remarks"`
Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"`
AdminId int `gorm:"column:admin_id;type:int(11);comment:操作人ID" json:"admin_id"`
AdminName string `gorm:"column:admin_name;type:varchar(255);comment:操作人员姓名" json:"admin_name"`
CreateTime utils.CustomTime `gorm:"column:create_time;default:NULL;type:datetime" json:"create_time"`
UpdateTime utils.CustomTime `gorm:"column:update_time;default:NULL;type:datetime" json:"update_time"`
Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT;comment:ID" json:"id"`
Name string `gorm:"column:name;type:varchar(255);comment:菜单;NOT NULL" json:"name"`
ParentId int64 `gorm:"column:parent_id;type:int(11);default:0;comment:父级菜单;NOT NULL" json:"parent_id"`
ParentIds string `gorm:"column:parent_ids;type:varchar(255);comment:多级父级菜单;NOT NULL" json:"parent_ids"`
Level uint8 `gorm:"column:level;type:tinyint(2);default:0;comment:级别;NOT NULL" json:"level"`
Type uint8 `gorm:"column:type;type:tinyint(2);comment:类型,1目录,2页面,3按钮;NOT NULL" json:"type"`
ServiceId int64 `gorm:"column:service_id;type:int(11);comment:项目ID;NOT NULL" json:"service_id"`
Path string `gorm:"column:path;type:varchar(255);comment:页面请求地址;NOT NULL" json:"path"`
Api string `gorm:"column:api;type:varchar(255);comment:接口地址" json:"api"`
ViewPath string `gorm:"column:view_path;type:varchar(255);comment:页面文件路径" json:"view_path"`
Identification string `gorm:"column:identification;type:varchar(255);comment:权限标识" json:"identification"`
Icon string `gorm:"column:icon;type:varchar(255);comment:图标" json:"icon"`
Status uint8 `gorm:"column:status;type:tinyint(1);default:1;comment:状态,1为正常,2为禁用;NOT NULL" json:"status"`
Sort uint8 `gorm:"column:sort;type:smallint(3);default:1;comment:排序" json:"sort"`
JsonDataBase string `gorm:"column:json_data_base;type:text;comment:原始数据" json:"json_data_base"`
JsonTreeData string `gorm:"column:json_tree_data;type:text;comment:数据的树型结构" json:"json_tree_data"`
JsonData string `gorm:"column:json_data;type:text;comment:所有的数据" json:"json_data"`
DataIds string `gorm:"column:data_ids;type:varchar(32);comment:三个数据的IDs" json:"data_ids"`
IsShow uint8 `gorm:"column:is_show;type:tinyint(1);default:1;comment:菜单中是否显示,1为显示,2为不显示;NOT NULL" json:"is_show"`
Description string `json:"description" gorm:"description"` // 备注
Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"`
AdminId int64 `gorm:"column:admin_id;type:int(11);comment:操作人ID" json:"admin_id"`
AdminName string `gorm:"column:admin_name;type:varchar(255);comment:操作人员姓名" json:"admin_name"`
}
// AuthorityStatus 修改状态
type AuthorityStatus struct {
Id int `json:"id"`
Status uint8 `json:"status"`
Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"`
ServiceId int `gorm:"column:service_id;type:int(11);comment:项目ID;NOT NULL" json:"service_id"`
AdminId int `json:"admin_id"`
AdminName string `gorm:"column:admin_name;type:varchar(100);comment:操作人姓名" json:"admin_name"`
UpdateTime utils.CustomTime `gorm:"column:update_time;type:datetime;default:NULL;comment:更新时间" json:"update_time"`
Id int64 `json:"id"`
Status uint8 `json:"status"`
Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"`
ServiceId int64 `gorm:"column:service_id;type:int(11);comment:项目ID;NOT NULL" json:"service_id"`
AdminId int64 `json:"admin_id"`
AdminName string `gorm:"column:admin_name;type:varchar(100);comment:操作人姓名" json:"admin_name"`
}
type AuthorityCheck struct {
Id int `json:"id"`
Id int64 `json:"id"`
Api string `json:"api"`
Type uint8 `json:"type"`
}
type AuthorityItems struct {
Id int `json:"id"`
Id int64 `json:"id"`
Name string `json:"name"`
ParentId int `json:"parent_id"`
ParentId int64 `json:"parent_id"`
ParentIds string `json:"parent_ids"`
Level uint8 `json:"level"`
Type uint8 `json:"type"`
ServiceId int `json:"service_id"`
ServiceId int64 `json:"service_id"`
Path string `json:"path"`
Api string `json:"api"`
ViewPath string `json:"view_path"`
@@ -83,38 +78,37 @@ type AuthorityItems struct {
JsonTreeData string `gorm:"column:json_tree_data;type:text;comment:数据的树型结构" json:"json_tree_data"`
DataIds string `json:"data_ids"`
IsShow uint8 `json:"is_show"`
Remarks string `json:"remarks"`
Description string `json:"description"` // 备注
Reason string `json:"reason"`
AdminId int `json:"admin_id"`
AdminId int64 `json:"admin_id"`
AdminName string `json:"admin_name"`
CreateTime utils.CustomTime `json:"create_time"`
UpdateTime utils.CustomTime `json:"update_time"`
IsFirst bool `json:"is_first"` // 是否是同级第一个节点
IsLast bool `json:"is_last"` // 是否是同级最后一个节点
Children []*AuthorityItems `json:"children"`
}
type AuthorityNames struct {
Id int `json:"id"`
Id int64 `json:"id"`
Name string `json:"name"`
Level uint8 `json:"level"`
Type uint8 `json:"type"`
ParentId int `json:"parent_id"db:"parent_id"`
ParentId int64 `json:"parent_id"db:"parent_id"`
}
type AuthorityNamesItems struct {
Id int `json:"value"`
Id int64 `json:"value"`
Name string `json:"label"`
Level uint8 `json:"level"`
Type uint8 `json:"type"`
ParentId int `json:"pid"`
ParentId int64 `json:"pid"`
Children []AuthorityNamesItems `json:"children"`
}
type AuthorityInfo struct {
Id int `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT;comment:ID" json:"id"`
Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT;comment:ID" json:"id"`
Name string `gorm:"column:name;type:varchar(255);comment:菜单;NOT NULL" json:"name"`
ParentId int `gorm:"column:parent_id;type:int(11);default:0;comment:父级菜单;NOT NULL" json:"parent_id"`
ParentId int64 `gorm:"column:parent_id;type:int(11);default:0;comment:父级菜单;NOT NULL" json:"parent_id"`
ServiceId int64 `gorm:"column:service_id;type:int(11);comment:项目ID;NOT NULL" json:"service_id"`
Type uint8 `gorm:"column:type;type:tinyint(2);comment:类型,1目录,2页面,3按钮;NOT NULL" json:"type"`
Path string `gorm:"column:path;type:varchar(100);comment:页面请求地址;NOT NULL" json:"path"`
Api string `gorm:"column:api;type:varchar(100);comment:接口地址" json:"api"`
@@ -126,7 +120,7 @@ type AuthorityInfo struct {
JsonTreeData string `gorm:"column:json_tree_data;type:text;comment:数据的树型结构" json:"json_tree_data"`
JsonData string `gorm:"column:json_data;type:text;comment:所有的数据" json:"json_data"`
DataIds string `gorm:"column:data_ids;type:varchar(32);comment:三个数据的IDs" json:"data_ids"`
Remarks string `gorm:"column:remarks;type:varchar(255);comment:备注;NOT NULL" json:"remarks"`
Description string `json:"description" gorm:"description"` // 备注
Reason string `gorm:"column:reason;type:varchar(255);comment:原因" json:"reason"`
}
@@ -138,13 +132,12 @@ type AuthorityInfoNew struct {
}
type AuthoritySort struct {
Id int `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT;comment:ID" json:"id"`
ParentId int `gorm:"column:parent_id;type:int(11);default:0;comment:父级菜单;NOT NULL" json:"parent_id"`
ServiceId int `gorm:"column:service_id;type:int(11);comment:项目ID;NOT NULL" json:"service_id"`
Sort uint8 `gorm:"column:sort;type:smallint(3);default:1;comment:排序" json:"sort"`
AdminId int `gorm:"column:admin_id;type:int(11);comment:操作人ID" json:"admin_id"`
AdminName string `gorm:"column:admin_name;type:varchar(255);comment:操作人员姓名" json:"admin_name"`
UpdateTime utils.CustomTime `gorm:"column:update_time;default:NULL;type:datetime" json:"update_time"`
Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT;comment:ID" json:"id"`
ParentId int64 `gorm:"column:parent_id;type:int(11);default:0;comment:父级菜单;NOT NULL" json:"parent_id"`
ServiceId int64 `gorm:"column:service_id;type:int(11);comment:项目ID;NOT NULL" json:"service_id"`
Sort uint8 `gorm:"column:sort;type:smallint(3);default:1;comment:排序" json:"sort"`
AdminId int64 `gorm:"column:admin_id;type:int(11);comment:操作人ID" json:"admin_id"`
AdminName string `gorm:"column:admin_name;type:varchar(255);comment:操作人员姓名" json:"admin_name"`
}
type AuthorityUpJsonIds struct {
@@ -152,7 +145,7 @@ type AuthorityUpJsonIds struct {
}
type AuthorityGetJsonIds struct {
Id int `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT;comment:ID" json:"id"`
Id int64 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT;comment:ID" json:"id"`
JsonDataBase string `gorm:"column:json_data_base;type:text;comment:原始数据" json:"json_data_base"`
JsonData string `gorm:"column:json_data;type:text;comment:所有的数据" json:"json_data"`
JsonTreeData string `gorm:"column:json_tree_data;type:text;comment:数据的树型结构" json:"json_tree_data"`