mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
【feature】添加组织数据读取权限
This commit is contained in:
@@ -37,7 +37,7 @@ func (s *SystemApiApi) GetApiList(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = model.ResultPage{
|
||||
Total: total,
|
||||
PageNum: int64(pageNum),
|
||||
PageSize: int64(pageNum),
|
||||
PageSize: int64(pageSize),
|
||||
Data: list,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ func (p *ConfigApi) GetConfigList(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = model.ResultPage{
|
||||
Total: total,
|
||||
PageNum: int64(pageNum),
|
||||
PageSize: int64(pageNum),
|
||||
PageSize: int64(pageSize),
|
||||
Data: list,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/PandaXGO/PandaKit/biz"
|
||||
"github.com/PandaXGO/PandaKit/restfulx"
|
||||
"github.com/PandaXGO/PandaKit/utils"
|
||||
"pandax/apps/system/api/vo"
|
||||
"pandax/apps/system/entity"
|
||||
"pandax/apps/system/services"
|
||||
"pandax/pkg/global"
|
||||
)
|
||||
|
||||
type DeptApi struct {
|
||||
DeptApp services.SysDeptModel
|
||||
UserApp services.SysUserModel
|
||||
RoleApp services.SysRoleModel
|
||||
}
|
||||
|
||||
func (m *DeptApi) GetDeptTreeRoleSelect(rc *restfulx.ReqCtx) {
|
||||
roleId := restfulx.PathParamInt(rc, "roleId")
|
||||
var dept entity.SysDept
|
||||
result := m.DeptApp.SelectDeptLable(dept)
|
||||
|
||||
deptIds := make([]int64, 0)
|
||||
if roleId != 0 {
|
||||
deptIds = m.RoleApp.GetRoleDeptId(entity.SysRole{RoleId: int64(roleId)})
|
||||
}
|
||||
rc.ResData = vo.DeptTreeVo{
|
||||
Depts: result,
|
||||
CheckedKeys: deptIds,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *DeptApi) GetDeptList(rc *restfulx.ReqCtx) {
|
||||
//pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
//pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
deptName := restfulx.QueryParam(rc, "deptName")
|
||||
status := restfulx.QueryParam(rc, "status")
|
||||
deptId := restfulx.QueryInt(rc, "deptId", 0)
|
||||
dept := entity.SysDept{DeptName: deptName, Status: status, DeptId: int64(deptId)}
|
||||
|
||||
if dept.DeptName == "" {
|
||||
rc.ResData = a.DeptApp.SelectDept(dept)
|
||||
} else {
|
||||
rc.ResData = a.DeptApp.FindList(dept)
|
||||
}
|
||||
}
|
||||
|
||||
func (a *DeptApi) GetOrdinaryDeptList(rc *restfulx.ReqCtx) {
|
||||
var dept entity.SysDept
|
||||
|
||||
rc.ResData = a.DeptApp.FindList(dept)
|
||||
}
|
||||
|
||||
func (a *DeptApi) GetDeptTree(rc *restfulx.ReqCtx) {
|
||||
deptName := restfulx.QueryParam(rc, "deptName")
|
||||
status := restfulx.QueryParam(rc, "status")
|
||||
deptId := restfulx.QueryInt(rc, "deptId", 0)
|
||||
dept := entity.SysDept{DeptName: deptName, Status: status, DeptId: int64(deptId)}
|
||||
|
||||
rc.ResData = a.DeptApp.SelectDept(dept)
|
||||
}
|
||||
|
||||
func (a *DeptApi) GetDept(rc *restfulx.ReqCtx) {
|
||||
deptId := restfulx.PathParamInt(rc, "deptId")
|
||||
rc.ResData = a.DeptApp.FindOne(int64(deptId))
|
||||
}
|
||||
|
||||
func (a *DeptApi) InsertDept(rc *restfulx.ReqCtx) {
|
||||
var dept entity.SysDept
|
||||
restfulx.BindJsonAndValid(rc, &dept)
|
||||
dept.CreateBy = rc.LoginAccount.UserName
|
||||
a.DeptApp.Insert(dept)
|
||||
}
|
||||
|
||||
func (a *DeptApi) UpdateDept(rc *restfulx.ReqCtx) {
|
||||
var dept entity.SysDept
|
||||
restfulx.BindJsonAndValid(rc, &dept)
|
||||
|
||||
dept.UpdateBy = rc.LoginAccount.UserName
|
||||
a.DeptApp.Update(dept)
|
||||
}
|
||||
|
||||
func (a *DeptApi) DeleteDept(rc *restfulx.ReqCtx) {
|
||||
deptId := restfulx.PathParam(rc, "deptId")
|
||||
deptIds := utils.IdsStrToIdsIntGroup(deptId)
|
||||
|
||||
deList := make([]int64, 0)
|
||||
for _, id := range deptIds {
|
||||
user := entity.SysUser{}
|
||||
user.DeptId = id
|
||||
list := a.UserApp.FindList(user)
|
||||
if len(*list) == 0 {
|
||||
deList = append(deList, id)
|
||||
} else {
|
||||
global.Log.Info(fmt.Sprintf("dictId: %d 存在用户绑定无法删除", id))
|
||||
}
|
||||
}
|
||||
if len(deList) == 0 {
|
||||
biz.ErrIsNil(errors.New("所有部门都已绑定用户无法删除"), "所有部门都已绑定用户,无法删除")
|
||||
}
|
||||
a.DeptApp.Delete(deList)
|
||||
}
|
||||
@@ -27,7 +27,7 @@ func (p *DictApi) GetDictTypeList(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = model.ResultPage{
|
||||
Total: total,
|
||||
PageNum: int64(pageNum),
|
||||
PageSize: int64(pageNum),
|
||||
PageSize: int64(pageSize),
|
||||
Data: list,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ type ChangePasswordStruct struct {
|
||||
}
|
||||
|
||||
type UserSearch struct {
|
||||
Username string `json:"username"` // 用户UUID
|
||||
NickName string `json:"nickName"` // 角色ID
|
||||
Status int64 `json:"status"` // 角色ID
|
||||
Phone string `json:"phone"` // 角色ID
|
||||
PostId int64 `json:"postId"` // 角色ID
|
||||
DeptId int64 `json:"deptId"` // 角色ID
|
||||
Username string `json:"username"` // 用户UUID
|
||||
NickName string `json:"nickName"` // 角色ID
|
||||
Status int64 `json:"status"` // 角色ID
|
||||
Phone string `json:"phone"` // 角色ID
|
||||
PostId int64 `json:"postId"` // 角色ID
|
||||
OrganizationId int64 `json:"organizationId"` // 角色ID
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
)
|
||||
|
||||
type MenuApi struct {
|
||||
MenuApp services.SysMenuModel
|
||||
DeptApp services.SysDeptModel
|
||||
MenuApp services.SysMenuModel
|
||||
OrganizationApp services.SysOrganizationModel
|
||||
|
||||
RoleMenuApp services.SysRoleMenuModel
|
||||
RoleApp services.SysRoleModel
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
)
|
||||
|
||||
type NoticeApi struct {
|
||||
DeptApp services.SysDeptModel
|
||||
NoticeApp services.SysNoticeModel
|
||||
OrganizationApp services.SysOrganizationModel
|
||||
NoticeApp services.SysNoticeModel
|
||||
}
|
||||
|
||||
// GetNoticeList 通知列表数据
|
||||
@@ -21,18 +21,18 @@ func (p *NoticeApi) GetNoticeList(rc *restfulx.ReqCtx) {
|
||||
noticeType := restfulx.QueryParam(rc, "noticeType")
|
||||
title := restfulx.QueryParam(rc, "title")
|
||||
|
||||
// 获取部门的子部门id
|
||||
one := p.DeptApp.FindOne(rc.LoginAccount.DeptId)
|
||||
split := strings.Split(strings.Trim(one.DeptPath, "/"), "/")
|
||||
// 获取所有父部门id
|
||||
ids := utils.DeptPCIds(split, rc.LoginAccount.DeptId, true)
|
||||
notice := entity.SysNotice{NoticeType: noticeType, Title: title, DeptIds: ids}
|
||||
// 获取组织的子组织id
|
||||
one := p.OrganizationApp.FindOne(rc.LoginAccount.OrganizationId)
|
||||
split := strings.Split(strings.Trim(one.OrganizationPath, "/"), "/")
|
||||
// 获取所有父组织id
|
||||
ids := utils.OrganizationPCIds(split, rc.LoginAccount.OrganizationId, true)
|
||||
notice := entity.SysNotice{NoticeType: noticeType, Title: title, OrganizationIds: ids}
|
||||
list, total := p.NoticeApp.FindListPage(pageNum, pageSize, notice)
|
||||
|
||||
rc.ResData = model.ResultPage{
|
||||
Total: total,
|
||||
PageNum: int64(pageNum),
|
||||
PageSize: int64(pageNum),
|
||||
PageSize: int64(pageSize),
|
||||
Data: list,
|
||||
}
|
||||
}
|
||||
|
||||
105
apps/system/api/organization.go
Normal file
105
apps/system/api/organization.go
Normal file
@@ -0,0 +1,105 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/PandaXGO/PandaKit/biz"
|
||||
"github.com/PandaXGO/PandaKit/restfulx"
|
||||
"github.com/PandaXGO/PandaKit/utils"
|
||||
"pandax/apps/system/api/vo"
|
||||
"pandax/apps/system/entity"
|
||||
"pandax/apps/system/services"
|
||||
"pandax/pkg/global"
|
||||
)
|
||||
|
||||
type OrganizationApi struct {
|
||||
OrganizationApp services.SysOrganizationModel
|
||||
UserApp services.SysUserModel
|
||||
RoleApp services.SysRoleModel
|
||||
}
|
||||
|
||||
func (m *OrganizationApi) GetOrganizationTreeRoleSelect(rc *restfulx.ReqCtx) {
|
||||
roleId := restfulx.PathParamInt(rc, "roleId")
|
||||
var organization entity.SysOrganization
|
||||
result := m.OrganizationApp.SelectOrganizationLable(organization)
|
||||
|
||||
organizationIds := make([]int64, 0)
|
||||
if roleId != 0 {
|
||||
organizationIds = m.RoleApp.GetRoleOrganizationId(entity.SysRole{RoleId: int64(roleId)})
|
||||
}
|
||||
rc.ResData = vo.OrganizationTreeVo{
|
||||
Organizations: result,
|
||||
CheckedKeys: organizationIds,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *OrganizationApi) GetOrganizationList(rc *restfulx.ReqCtx) {
|
||||
//pageNum := restfulx.QueryInt(rc.GinCtx, "pageNum", 1)
|
||||
//pageSize := restfulx.QueryInt(rc.GinCtx, "pageSize", 10)
|
||||
organizationName := restfulx.QueryParam(rc, "organizationName")
|
||||
status := restfulx.QueryParam(rc, "status")
|
||||
organizationId := restfulx.QueryInt(rc, "organizationId", 0)
|
||||
organization := entity.SysOrganization{OrganizationName: organizationName, Status: status, OrganizationId: int64(organizationId)}
|
||||
|
||||
if organization.OrganizationName == "" {
|
||||
rc.ResData = a.OrganizationApp.SelectOrganization(organization)
|
||||
} else {
|
||||
rc.ResData = a.OrganizationApp.FindList(organization)
|
||||
}
|
||||
}
|
||||
|
||||
func (a *OrganizationApi) GetOrdinaryOrganizationList(rc *restfulx.ReqCtx) {
|
||||
var organization entity.SysOrganization
|
||||
|
||||
rc.ResData = a.OrganizationApp.FindList(organization)
|
||||
}
|
||||
|
||||
func (a *OrganizationApi) GetOrganizationTree(rc *restfulx.ReqCtx) {
|
||||
organizationName := restfulx.QueryParam(rc, "organizationName")
|
||||
status := restfulx.QueryParam(rc, "status")
|
||||
organizationId := restfulx.QueryInt(rc, "organizationId", 0)
|
||||
organization := entity.SysOrganization{OrganizationName: organizationName, Status: status, OrganizationId: int64(organizationId)}
|
||||
|
||||
rc.ResData = a.OrganizationApp.SelectOrganization(organization)
|
||||
}
|
||||
|
||||
func (a *OrganizationApi) GetOrganization(rc *restfulx.ReqCtx) {
|
||||
organizationId := restfulx.PathParamInt(rc, "organizationId")
|
||||
rc.ResData = a.OrganizationApp.FindOne(int64(organizationId))
|
||||
}
|
||||
|
||||
func (a *OrganizationApi) InsertOrganization(rc *restfulx.ReqCtx) {
|
||||
var organization entity.SysOrganization
|
||||
restfulx.BindJsonAndValid(rc, &organization)
|
||||
organization.CreateBy = rc.LoginAccount.UserName
|
||||
a.OrganizationApp.Insert(organization)
|
||||
}
|
||||
|
||||
func (a *OrganizationApi) UpdateOrganization(rc *restfulx.ReqCtx) {
|
||||
var organization entity.SysOrganization
|
||||
restfulx.BindJsonAndValid(rc, &organization)
|
||||
|
||||
organization.UpdateBy = rc.LoginAccount.UserName
|
||||
a.OrganizationApp.Update(organization)
|
||||
}
|
||||
|
||||
func (a *OrganizationApi) DeleteOrganization(rc *restfulx.ReqCtx) {
|
||||
organizationId := restfulx.PathParam(rc, "organizationId")
|
||||
organizationIds := utils.IdsStrToIdsIntGroup(organizationId)
|
||||
|
||||
deList := make([]int64, 0)
|
||||
for _, id := range organizationIds {
|
||||
user := entity.SysUser{}
|
||||
user.OrganizationId = id
|
||||
list := a.UserApp.FindList(user)
|
||||
if len(*list) == 0 {
|
||||
deList = append(deList, id)
|
||||
} else {
|
||||
global.Log.Info(fmt.Sprintf("dictId: %d 存在用户绑定无法删除", id))
|
||||
}
|
||||
}
|
||||
if len(deList) == 0 {
|
||||
biz.ErrIsNil(errors.New("所有组织都已绑定用户无法删除"), "所有组织都已绑定用户,无法删除")
|
||||
}
|
||||
a.OrganizationApp.Delete(deList)
|
||||
}
|
||||
@@ -33,7 +33,7 @@ func (p *PostApi) GetPostList(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = model.ResultPage{
|
||||
Total: total,
|
||||
PageNum: int64(pageNum),
|
||||
PageSize: int64(pageNum),
|
||||
PageSize: int64(pageSize),
|
||||
Data: list,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,10 +14,11 @@ import (
|
||||
)
|
||||
|
||||
type RoleApi struct {
|
||||
RoleApp services.SysRoleModel
|
||||
UserApp services.SysUserModel
|
||||
RoleMenuApp services.SysRoleMenuModel
|
||||
RoleDeptApp services.SysRoleDeptModel
|
||||
RoleApp services.SysRoleModel
|
||||
UserApp services.SysUserModel
|
||||
RoleMenuApp services.SysRoleMenuModel
|
||||
OrganizationApp services.SysOrganizationModel
|
||||
RoleOrganizationApp services.SysRoleOrganizationModel
|
||||
}
|
||||
|
||||
// GetRoleList角色列表数据
|
||||
@@ -33,7 +34,7 @@ func (r *RoleApi) GetRoleList(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = model.ResultPage{
|
||||
Total: total,
|
||||
PageNum: int64(pageNum),
|
||||
PageSize: int64(pageNum),
|
||||
PageSize: int64(pageSize),
|
||||
Data: list,
|
||||
}
|
||||
}
|
||||
@@ -52,6 +53,10 @@ func (r *RoleApi) InsertRole(rc *restfulx.ReqCtx) {
|
||||
var role entity.SysRole
|
||||
restfulx.BindJsonAndValid(rc, &role)
|
||||
role.CreateBy = rc.LoginAccount.UserName
|
||||
if role.DataScope == "" {
|
||||
role.DataScope = "0"
|
||||
}
|
||||
// 添加角色对应的菜单
|
||||
insert := r.RoleApp.Insert(role)
|
||||
role.RoleId = insert.RoleId
|
||||
r.RoleMenuApp.Insert(insert.RoleId, role.MenuIds)
|
||||
@@ -85,19 +90,38 @@ func (r *RoleApi) UpdateRoleStatus(rc *restfulx.ReqCtx) {
|
||||
r.RoleApp.Update(role)
|
||||
}
|
||||
|
||||
// UpdateRoleDataScope 修改用户角色部门
|
||||
// UpdateRoleDataScope 修改用户角色组织
|
||||
func (r *RoleApi) UpdateRoleDataScope(rc *restfulx.ReqCtx) {
|
||||
var role entity.SysRole
|
||||
restfulx.BindJsonAndValid(rc, &role)
|
||||
role.UpdateBy = rc.LoginAccount.UserName
|
||||
// 修改角色
|
||||
update := r.RoleApp.Update(role)
|
||||
if role.DataScope == "2" {
|
||||
// 删除角色的部门绑定
|
||||
r.RoleDeptApp.Delete(entity.SysRoleDept{RoleId: update.RoleId})
|
||||
// 添加角色部门绑定
|
||||
r.RoleDeptApp.Insert(role.RoleId, role.DeptIds)
|
||||
}
|
||||
go func() {
|
||||
if role.DataScope != entity.SELFDATASCOPE {
|
||||
organizationIds := make([]int64, 0)
|
||||
if role.DataScope == entity.ALLDATASCOPE {
|
||||
for _, organization := range *r.OrganizationApp.FindList(entity.SysOrganization{}) {
|
||||
organizationIds = append(organizationIds, organization.OrganizationId)
|
||||
}
|
||||
}
|
||||
if role.DataScope == entity.DIYDATASCOPE {
|
||||
organizationIds = role.OrganizationIds
|
||||
}
|
||||
if role.DataScope == entity.ORGDATASCOPE {
|
||||
organizationIds = append(organizationIds, rc.LoginAccount.OrganizationId)
|
||||
}
|
||||
if role.DataScope == entity.ORGALLDATASCOPE {
|
||||
//organizationIds = append(organizationIds, rc.LoginAccount.OrganizationId)
|
||||
organizationIds = r.OrganizationApp.SelectOrganizationIds(entity.SysOrganization{OrganizationId: rc.LoginAccount.OrganizationId})
|
||||
}
|
||||
// 删除角色的组织绑定
|
||||
r.RoleOrganizationApp.Delete(entity.SysRoleOrganization{RoleId: update.RoleId})
|
||||
// 添加角色组织绑定
|
||||
r.RoleOrganizationApp.Insert(role.RoleId, organizationIds)
|
||||
}
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
// DeleteRole 删除用户角色
|
||||
|
||||
@@ -27,7 +27,7 @@ func (p *SysTenantsApi) GetSysTenantsList(rc *restfulx.ReqCtx) {
|
||||
rc.ResData = model.ResultPage{
|
||||
Total: total,
|
||||
PageNum: int64(pageNum),
|
||||
PageSize: int64(pageNum),
|
||||
PageSize: int64(pageSize),
|
||||
Data: list,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,13 +28,13 @@ import (
|
||||
)
|
||||
|
||||
type UserApi struct {
|
||||
UserApp services.SysUserModel
|
||||
MenuApp services.SysMenuModel
|
||||
PostApp services.SysPostModel
|
||||
RoleApp services.SysRoleModel
|
||||
RoleMenuApp services.SysRoleMenuModel
|
||||
DeptApp services.SysDeptModel
|
||||
LogLogin logServices.LogLoginModel
|
||||
UserApp services.SysUserModel
|
||||
MenuApp services.SysMenuModel
|
||||
PostApp services.SysPostModel
|
||||
RoleApp services.SysRoleModel
|
||||
RoleMenuApp services.SysRoleMenuModel
|
||||
OrganizationApp services.SysOrganizationModel
|
||||
LogLogin logServices.LogLoginModel
|
||||
}
|
||||
|
||||
// GenerateCaptcha 获取验证码
|
||||
@@ -66,12 +66,12 @@ func (u *UserApi) Login(rc *restfulx.ReqCtx) {
|
||||
role := u.RoleApp.FindOne(login.RoleId)
|
||||
j := token.NewJWT("", []byte(global.Conf.Jwt.Key), jwt.SigningMethodHS256)
|
||||
token, err := j.CreateToken(token.Claims{
|
||||
UserId: login.UserId,
|
||||
UserName: login.Username,
|
||||
RoleId: login.RoleId,
|
||||
RoleKey: role.RoleKey,
|
||||
DeptId: login.DeptId,
|
||||
PostId: login.PostId,
|
||||
UserId: login.UserId,
|
||||
UserName: login.Username,
|
||||
RoleId: login.RoleId,
|
||||
RoleKey: role.RoleKey,
|
||||
OrganizationId: login.OrganizationId,
|
||||
PostId: login.PostId,
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
NotBefore: time.Now().Unix() - 1000, // 签名生效时间
|
||||
ExpiresAt: time.Now().Unix() + global.Conf.Jwt.ExpireTime, // 过期时间 7天 配置文件
|
||||
@@ -90,6 +90,7 @@ func (u *UserApi) Login(rc *restfulx.ReqCtx) {
|
||||
loginLog.Ipaddr = rc.Request.Request.RemoteAddr
|
||||
loginLog.LoginLocation = utils.GetRealAddressByIP(rc.Request.Request.RemoteAddr)
|
||||
loginLog.LoginTime = time.Now()
|
||||
loginLog.OrgId = login.OrganizationId
|
||||
loginLog.Status = "0"
|
||||
loginLog.Remark = rc.Request.Request.UserAgent()
|
||||
browserName, browserVersion := ua.Browser()
|
||||
@@ -130,6 +131,7 @@ func (u *UserApi) LogOut(rc *restfulx.ReqCtx) {
|
||||
loginLog.Ipaddr = rc.Request.Request.RemoteAddr
|
||||
loginLog.LoginTime = time.Now()
|
||||
loginLog.Status = "0"
|
||||
loginLog.OrgId = rc.LoginAccount.OrganizationId
|
||||
loginLog.Remark = rc.Request.Request.UserAgent()
|
||||
browserName, browserVersion := ua.Browser()
|
||||
loginLog.Browser = browserName + " " + browserVersion
|
||||
@@ -148,19 +150,19 @@ func (u *UserApi) GetSysUserList(rc *restfulx.ReqCtx) {
|
||||
username := restfulx.QueryParam(rc, "username")
|
||||
phone := restfulx.QueryParam(rc, "phone")
|
||||
|
||||
deptId := restfulx.QueryInt(rc, "deptId", 0)
|
||||
organizationId := restfulx.QueryInt(rc, "organizationId", 0)
|
||||
var user entity.SysUser
|
||||
user.Status = status
|
||||
user.Username = username
|
||||
user.Phone = phone
|
||||
user.DeptId = int64(deptId)
|
||||
user.OrganizationId = int64(organizationId)
|
||||
|
||||
list, total := u.UserApp.FindListPage(pageNum, pageSize, user)
|
||||
|
||||
rc.ResData = model.ResultPage{
|
||||
Total: total,
|
||||
PageNum: int64(pageNum),
|
||||
PageSize: int64(pageNum),
|
||||
PageSize: int64(pageSize),
|
||||
Data: list,
|
||||
}
|
||||
}
|
||||
@@ -176,8 +178,8 @@ func (u *UserApi) GetSysUserProfile(rc *restfulx.ReqCtx) {
|
||||
roleList := u.RoleApp.FindList(entity.SysRole{RoleId: rc.LoginAccount.RoleId})
|
||||
//岗位列表
|
||||
postList := u.PostApp.FindList(entity.SysPost{PostId: rc.LoginAccount.PostId})
|
||||
//获取部门列表
|
||||
deptList := u.DeptApp.FindList(entity.SysDept{DeptId: rc.LoginAccount.DeptId})
|
||||
//获取组织列表
|
||||
organizationList := u.OrganizationApp.FindList(entity.SysOrganization{OrganizationId: rc.LoginAccount.OrganizationId})
|
||||
|
||||
postIds := make([]int64, 0)
|
||||
postIds = append(postIds, rc.LoginAccount.PostId)
|
||||
@@ -186,12 +188,12 @@ func (u *UserApi) GetSysUserProfile(rc *restfulx.ReqCtx) {
|
||||
roleIds = append(roleIds, rc.LoginAccount.RoleId)
|
||||
|
||||
rc.ResData = vo.UserProfileVo{
|
||||
Data: user,
|
||||
PostIds: postIds,
|
||||
RoleIds: roleIds,
|
||||
Roles: *roleList,
|
||||
Posts: *postList,
|
||||
Dept: *deptList,
|
||||
Data: user,
|
||||
PostIds: postIds,
|
||||
RoleIds: roleIds,
|
||||
Roles: *roleList,
|
||||
Posts: *postList,
|
||||
Organization: *organizationList,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,15 +237,15 @@ func (u *UserApi) GetSysUser(rc *restfulx.ReqCtx) {
|
||||
|
||||
var role entity.SysRole
|
||||
var post entity.SysPost
|
||||
var dept entity.SysDept
|
||||
var organization entity.SysOrganization
|
||||
|
||||
rc.ResData = vo.UserVo{
|
||||
Data: result,
|
||||
PostIds: result.PostIds,
|
||||
RoleIds: result.RoleIds,
|
||||
Roles: *u.RoleApp.FindList(role),
|
||||
Posts: *u.PostApp.FindList(post),
|
||||
Depts: u.DeptApp.SelectDept(dept),
|
||||
Data: result,
|
||||
PostIds: result.PostIds,
|
||||
RoleIds: result.RoleIds,
|
||||
Roles: *u.RoleApp.FindList(role),
|
||||
Posts: *u.PostApp.FindList(post),
|
||||
Organizations: u.OrganizationApp.SelectOrganization(organization),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ import "pandax/apps/system/entity"
|
||||
* @Date 2022/8/4 15:25
|
||||
**/
|
||||
|
||||
type DeptTreeVo struct {
|
||||
Depts []entity.DeptLable `json:"depts"`
|
||||
CheckedKeys []int64 `json:"checkedKeys"`
|
||||
type OrganizationTreeVo struct {
|
||||
Organizations []entity.OrganizationLable `json:"organizations"`
|
||||
CheckedKeys []int64 `json:"checkedKeys"`
|
||||
}
|
||||
|
||||
type MenuTreeVo struct {
|
||||
@@ -41,21 +41,21 @@ type AuthVo struct {
|
||||
}
|
||||
|
||||
type UserProfileVo struct {
|
||||
Data any `json:"data"`
|
||||
PostIds []int64 `json:"postIds"`
|
||||
RoleIds []int64 `json:"roleIds"`
|
||||
Roles []entity.SysRole `json:"roles"`
|
||||
Posts []entity.SysPost `json:"posts"`
|
||||
Dept []entity.SysDept `json:"dept"`
|
||||
Data any `json:"data"`
|
||||
PostIds []int64 `json:"postIds"`
|
||||
RoleIds []int64 `json:"roleIds"`
|
||||
Roles []entity.SysRole `json:"roles"`
|
||||
Posts []entity.SysPost `json:"posts"`
|
||||
Organization []entity.SysOrganization `json:"organization"`
|
||||
}
|
||||
|
||||
type UserVo struct {
|
||||
Data any `json:"data"`
|
||||
PostIds string `json:"postIds"`
|
||||
RoleIds string `json:"roleIds"`
|
||||
Roles []entity.SysRole `json:"roles"`
|
||||
Posts []entity.SysPost `json:"posts"`
|
||||
Depts []entity.SysDept `json:"depts"`
|
||||
Data any `json:"data"`
|
||||
PostIds string `json:"postIds"`
|
||||
RoleIds string `json:"roleIds"`
|
||||
Roles []entity.SysRole `json:"roles"`
|
||||
Posts []entity.SysPost `json:"posts"`
|
||||
Organizations []entity.SysOrganization `json:"organizations"`
|
||||
}
|
||||
|
||||
type UserRolePost struct {
|
||||
|
||||
Reference in New Issue
Block a user