【feature】添加组织数据读取权限

This commit is contained in:
XM-GO
2023-09-14 17:28:52 +08:00
parent bde42bfc9a
commit b5ee2a54b9
84 changed files with 1664 additions and 774 deletions

View File

@@ -1,26 +0,0 @@
package entity
import "github.com/PandaXGO/PandaKit/model"
// 部门组织
type SysDept struct {
DeptId int64 `json:"deptId" gorm:"primary_key;AUTO_INCREMENT"` //部门编码
ParentId int64 `json:"parentId" gorm:"type:int;comment:上级部门"`
DeptPath string `json:"deptPath" gorm:"type:varchar(255);comment:部门路径"`
DeptName string `json:"deptName" gorm:"type:varchar(128);comment:部门名称"`
Sort int64 `json:"sort" gorm:"type:int;comment:排序"`
Leader string `json:"leader" gorm:"type:varchar(64);comment:负责人"` // userId
Phone string `json:"phone" gorm:"type:varchar(11);comment:手机"`
Email string `json:"email" gorm:"type:varchar(64);comment:邮箱"`
Status string `json:"status" gorm:"type:varchar(1);comment:状态"`
CreateBy string `json:"createBy" gorm:"type:varchar(64);comment:创建人"`
UpdateBy string `json:"updateBy" gorm:"type:varchar(64);comment:修改人"`
Children []SysDept `json:"children" gorm:"-"`
model.BaseModel
}
type DeptLable struct {
DeptId int64 `gorm:"-" json:"deptId"`
DeptName string `gorm:"-" json:"deptName"`
Children []DeptLable `gorm:"-" json:"children"`
}

View File

@@ -3,13 +3,13 @@ package entity
import "github.com/PandaXGO/PandaKit/model"
type SysNotice struct {
NoticeId int64 `json:"noticeId" gorm:"primary_key;AUTO_INCREMENT"`
Title string `json:"title" gorm:"type:varchar(128);comment:标题"`
Content string `json:"content" gorm:"type:text;comment:标题"`
NoticeType string `json:"noticeType" gorm:"type:varchar(1);comment:通知类型"`
DeptId int64 `json:"deptId" gorm:"type:int;comment:部门Id,部门及子部门"`
UserName string `json:"userName" gorm:"type:varchar(64);comment:发布人"`
NoticeId int64 `json:"noticeId" gorm:"primary_key;AUTO_INCREMENT"`
Title string `json:"title" gorm:"type:varchar(128);comment:标题"`
Content string `json:"content" gorm:"type:text;comment:标题"`
NoticeType string `json:"noticeType" gorm:"type:varchar(1);comment:通知类型"`
OrganizationId int64 `json:"organizationId" gorm:"type:int;comment:组织Id,组织及子组织"`
UserName string `json:"userName" gorm:"type:varchar(64);comment:发布人"`
DeptIds []int64 `json:"deptIds" gorm:"-"`
OrganizationIds []int64 `json:"organizationIds" gorm:"-"`
model.BaseModel
}

View File

@@ -0,0 +1,26 @@
package entity
import "github.com/PandaXGO/PandaKit/model"
// 组织组织
type SysOrganization struct {
OrganizationId int64 `json:"organizationId" gorm:"primary_key;AUTO_INCREMENT"` //组织编码
ParentId int64 `json:"parentId" gorm:"type:int;comment:上级组织"`
OrganizationPath string `json:"organizationPath" gorm:"type:varchar(255);comment:组织路径"`
OrganizationName string `json:"organizationName" gorm:"type:varchar(128);comment:组织名称"`
Sort int64 `json:"sort" gorm:"type:int;comment:排序"`
Leader string `json:"leader" gorm:"type:varchar(64);comment:负责人"` // userId
Phone string `json:"phone" gorm:"type:varchar(11);comment:手机"`
Email string `json:"email" gorm:"type:varchar(64);comment:邮箱"`
Status string `json:"status" gorm:"type:varchar(1);comment:状态"`
CreateBy string `json:"createBy" gorm:"type:varchar(64);comment:创建人"`
UpdateBy string `json:"updateBy" gorm:"type:varchar(64);comment:修改人"`
Children []SysOrganization `json:"children" gorm:"-"`
model.BaseModel
}
type OrganizationLable struct {
OrganizationId int64 `gorm:"-" json:"organizationId"`
OrganizationName string `gorm:"-" json:"organizationName"`
Children []OrganizationLable `gorm:"-" json:"children"`
}

View File

@@ -5,26 +5,34 @@ import (
"github.com/PandaXGO/PandaKit/model"
)
const (
SELFDATASCOPE = "0"
ALLDATASCOPE = "1"
DIYDATASCOPE = "2"
ORGDATASCOPE = "3"
ORGALLDATASCOPE = "4"
)
type SysRole struct {
model.BaseModel
RoleId int64 `json:"roleId" gorm:"primary_key;AUTO_INCREMENT"`
RoleName string `json:"roleName" gorm:"type:varchar(128);comment:角色名称"`
Status string `json:"status" gorm:"type:varchar(1);comment:状态"`
RoleKey string `json:"roleKey" gorm:"type:varchar(128);comment:角色代码"`
RoleSort int64 `json:"roleSort" gorm:"type:int;comment:角色排序"`
DataScope string `json:"dataScope" gorm:"type:varchar(1);comment:数据范围1全部数据权限 2自定数据权限 3部门数据权限 4部门及以下数据权限)"`
CreateBy string `json:"createBy" gorm:"type:varchar(128);comment:创建人"`
UpdateBy string `json:"updateBy" gorm:"type:varchar(128);comment:修改人"`
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"`
ApiIds []casbin.CasbinRule `json:"apiIds" gorm:"-"`
MenuIds []int64 `json:"menuIds" gorm:"-"`
DeptIds []int64 `json:"deptIds" gorm:"-"`
RoleId int64 `json:"roleId" gorm:"primary_key;AUTO_INCREMENT"`
RoleName string `json:"roleName" gorm:"type:varchar(128);comment:角色名称"`
Status string `json:"status" gorm:"type:varchar(1);comment:状态"`
RoleKey string `json:"roleKey" gorm:"type:varchar(128);comment:角色代码"`
RoleSort int64 `json:"roleSort" gorm:"type:int;comment:角色排序"`
DataScope string `json:"dataScope" gorm:"type:varchar(1);comment:数据范围(0: 本人数据 1全部数据权限 2自定数据权限 3组织数据权限 4组织及以下数据权限)"`
CreateBy string `json:"createBy" gorm:"type:varchar(128);comment:创建人"`
UpdateBy string `json:"updateBy" gorm:"type:varchar(128);comment:修改人"`
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"`
ApiIds []casbin.CasbinRule `json:"apiIds" gorm:"-"`
MenuIds []int64 `json:"menuIds" gorm:"-"`
OrganizationIds []int64 `json:"organizationIds" gorm:"-"`
}
type MenuIdList struct {
MenuId int64 `json:"menuId"`
}
type DeptIdList struct {
DeptId int64 `json:"deptId"`
type OrganizationIdList struct {
OrganizationId int64 `json:"organizationId"`
}

View File

@@ -1,7 +0,0 @@
package entity
type SysRoleDept struct {
RoleId int64 `gorm:"type:int"`
DeptId int64 `gorm:"type:int"`
Id int64 `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"id" form:"id"`
}

View File

@@ -0,0 +1,7 @@
package entity
type SysRoleOrganization struct {
RoleId int64 `gorm:"type:int"`
OrganizationId int64 `gorm:"type:int"`
Id int64 `gorm:"primary_key;AUTO_INCREMENT;column:id" json:"id" form:"id"`
}

View File

@@ -12,21 +12,21 @@ type SysUserId struct {
}
type SysUserB struct {
NickName string `gorm:"type:varchar(128)" json:"nickName"` // 昵称
Phone string `gorm:"type:varchar(11)" json:"phone"` // 手机号
RoleId int64 `gorm:"type:int" json:"roleId"` // 角色编码
Salt string `gorm:"type:varchar(255)" json:"salt"` //盐
Avatar string `gorm:"type:varchar(255)" json:"avatar"` //头像
Sex string `gorm:"type:varchar(255)" json:"sex"` //性别
Email string `gorm:"type:varchar(128)" json:"email"` //邮箱
DeptId int64 `gorm:"type:int" json:"deptId"` //部门编码
PostId int64 `gorm:"type:int" json:"postId"` //职位编码
RoleIds string `gorm:"type:varchar(255)" json:"roleIds"` //多角色
PostIds string `gorm:"type:varchar(255)" json:"postIds"` // 多岗位
CreateBy string `gorm:"type:varchar(128)" json:"createBy"` //
UpdateBy string `gorm:"type:varchar(128)" json:"updateBy"` //
Remark string `gorm:"type:varchar(255)" json:"remark"` //备注
Status string `gorm:"type:varchar(1);" json:"status"`
NickName string `gorm:"type:varchar(128)" json:"nickName"` // 昵称
Phone string `gorm:"type:varchar(11)" json:"phone"` // 手机号
RoleId int64 `gorm:"type:int" json:"roleId"` // 角色编码
Salt string `gorm:"type:varchar(255)" json:"salt"` //盐
Avatar string `gorm:"type:varchar(255)" json:"avatar"` //头像
Sex string `gorm:"type:varchar(255)" json:"sex"` //性别
Email string `gorm:"type:varchar(128)" json:"email"` //邮箱
OrganizationId int64 `gorm:"type:int" json:"organizationId"` //组织编码
PostId int64 `gorm:"type:int" json:"postId"` //职位编码
RoleIds string `gorm:"type:varchar(255)" json:"roleIds"` //多角色
PostIds string `gorm:"type:varchar(255)" json:"postIds"` // 多岗位
CreateBy string `gorm:"type:varchar(128)" json:"createBy"` //
UpdateBy string `gorm:"type:varchar(128)" json:"updateBy"` //
Remark string `gorm:"type:varchar(255)" json:"remark"` //备注
Status string `gorm:"type:varchar(1);" json:"status"`
model.BaseModel
}
@@ -45,7 +45,7 @@ type SysUserPage struct {
SysUserId
SysUserB
LoginM
DeptName string `gorm:"-" json:"deptName"`
OrganizationName string `gorm:"-" json:"organizationName"`
}
type Login struct {