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
84d311ad
Commit
84d311ad
authored
Nov 16, 2020
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查看用户功能调整
parent
9cc84c91
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
performance/Performance.EntityModels/Entity/sys_role.cs
+5
-0
performance/Performance.Services/UserService.cs
+21
-2
No files found.
performance/Performance.EntityModels/Entity/sys_role.cs
View file @
84d311ad
...
@@ -55,5 +55,10 @@ public class sys_role
...
@@ -55,5 +55,10 @@ public class sys_role
///
///
/// </summary>
/// </summary>
public
Nullable
<
int
>
Sort
{
get
;
set
;
}
public
Nullable
<
int
>
Sort
{
get
;
set
;
}
/// <summary>
/// 是否查看所有用户 1 启用 2禁用
/// </summary>
public
Nullable
<
int
>
IsViewAllUsers
{
get
;
set
;
}
}
}
}
}
performance/Performance.Services/UserService.cs
View file @
84d311ad
...
@@ -114,8 +114,27 @@ public UserIdentity GetUser(int userId)
...
@@ -114,8 +114,27 @@ public UserIdentity GetUser(int userId)
/// <returns></returns>
/// <returns></returns>
public
List
<
UserResponse
>
GetUserList
(
int
userID
)
public
List
<
UserResponse
>
GetUserList
(
int
userID
)
{
{
var
userlist
=
_userRepository
.
GetEntities
(
t
=>
t
.
CreateUser
==
userID
&&
t
.
IsDelete
==
1
);
var
userrole
=
_userroleRepository
.
GetEntity
(
t
=>
t
.
UserID
==
userID
);
var
result
=
Mapper
.
Map
<
List
<
UserResponse
>>(
userlist
);
if
(
userrole
==
null
)
throw
new
PerformanceException
(
"用户未配置角色"
);
var
role
=
_roleRepository
.
GetEntity
(
t
=>
t
.
ID
==
userrole
.
RoleID
);
if
(
role
==
null
)
throw
new
PerformanceException
(
"用户角色不存在"
);
var
result
=
new
List
<
UserResponse
>();
if
(
role
.
IsViewAllUsers
==
2
)
{
var
userlist
=
_userRepository
.
GetEntities
(
t
=>
t
.
CreateUser
==
userID
&&
t
.
IsDelete
==
1
);
result
=
Mapper
.
Map
<
List
<
UserResponse
>>(
userlist
);
}
else
{
var
hospitalIds
=
_userhospitalRepository
.
GetEntities
(
t
=>
t
.
UserID
==
userID
)?.
Select
(
t
=>
t
.
HospitalID
);
if
(
hospitalIds
==
null
||
!
hospitalIds
.
Any
())
return
result
;
var
userIds
=
_userhospitalRepository
.
GetEntities
(
t
=>
hospitalIds
.
Contains
(
t
.
HospitalID
)).
Select
(
t
=>
t
.
UserID
).
Distinct
();
var
userlist
=
_userRepository
.
GetEntities
(
t
=>
t
.
ID
!=
userID
&&
userIds
.
Contains
(
t
.
ID
)
&&
t
.
IsDelete
==
1
);
result
=
Mapper
.
Map
<
List
<
UserResponse
>>(
userlist
);
}
if
(
result
!=
null
&&
result
.
Count
>
0
)
if
(
result
!=
null
&&
result
.
Count
>
0
)
{
{
foreach
(
var
item
in
result
)
foreach
(
var
item
in
result
)
...
...
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