Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
3fa94b6a
Commit
3fa94b6a
authored
Mar 05, 2021
by
钟博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
角色排序,修改切换角色出现重复角色bug
parent
08ff15c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
performance/Performance.Services/RoleService.cs
+11
-9
No files found.
performance/Performance.Services/RoleService.cs
View file @
3fa94b6a
...
...
@@ -30,7 +30,7 @@ public class RoleService : IAutoInjection
/// <param name="userid"></param>
/// <returns></returns>
public
List
<
RoleResponse
>
GetUserRole
(
int
userid
)
{
{
var
roles
=
GetRole
(
userid
);
return
Mapper
.
Map
<
List
<
RoleResponse
>>(
roles
);
}
...
...
@@ -58,14 +58,14 @@ public List<sys_role> GetRole(int userid)
public
List
<
RoleResponse
>
GetUsersRole
(
int
userid
)
{
List
<
RoleResponse
>
roleResponses
=
new
List
<
RoleResponse
>();
var
user
=
_userRepository
.
GetEntity
(
c
=>
c
.
ID
==
userid
);
var
user
=
_userRepository
.
GetEntity
(
c
=>
c
.
ID
==
userid
);
var
ParentUser
=
_userRepository
.
GetEntities
(
c
=>
c
.
ParentID
==
userid
);
if
(
user
.
ParentID
!=
null
||
user
.
ParentID
==
0
)
if
(
user
.
ParentID
!=
null
||
user
.
ParentID
==
0
)
{
ParentUser
=
_userRepository
.
GetEntities
(
c
=>
c
.
ParentID
==
user
.
ParentID
);
ParentUser
=
_userRepository
.
GetEntities
(
c
=>
c
.
ParentID
==
user
.
ParentID
);
}
if
(
ParentUser
!=
null
)
if
(
ParentUser
!=
null
)
{
foreach
(
var
sysUser
in
ParentUser
)
{
...
...
@@ -75,14 +75,16 @@ public List<RoleResponse> GetUsersRole(int userid)
roleResponses
.
Add
(
role
);
}
}
var
roles
=
GetARole
(
userid
);
if
(
roles
!=
null
)
var
isParent
=
user
.
ParentID
==
null
||
user
.
ParentID
==
0
;
var
roles
=
GetARole
(
isParent
?
userid
:
(
int
)
user
.
ParentID
);
if
(
roles
!=
null
)
{
var
role
=
Mapper
.
Map
<
RoleResponse
>(
roles
);
role
.
Value
=
userid
;
roleResponses
.
Add
(
role
);
}
return
roleResponses
;
return
roleResponses
?.
OrderBy
(
t
=>
t
.
Type
).
ToList
()
;
}
/// <summary>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment