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
2649e6db
Commit
2649e6db
authored
Sep 07, 2023
by
wyc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改菜单时,若操作的是最后一个子集或者第一个子集,则同时更新其父级的状态
parent
650120dd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
performance/Performance.ConsoleApp/Properties/launchSettings.json
+12
-0
performance/Performance.Services/MenuService.cs
+15
-2
No files found.
performance/Performance.ConsoleApp/Properties/launchSettings.json
0 → 100644
View file @
2649e6db
{
"profiles"
:
{
"Performance.ConsoleApp"
:
{
"commandName"
:
"Project"
},
"WSL"
:
{
"commandName"
:
"WSL2"
,
"distributionName"
:
""
}
}
}
\ No newline at end of file
performance/Performance.Services/MenuService.cs
View file @
2649e6db
...
...
@@ -78,7 +78,17 @@ public ApiResponse UpdateSystemMenu(MenuRequest menuRequest)
{
try
{
var
data
=
_menuRepository
.
GetEntity
(
w
=>
w
.
ID
==
menuRequest
.
ID
);
List
<
sys_menu
>
sys_Menus
=
new
List
<
sys_menu
>();
var
datas
=
_menuRepository
.
GetEntities
(
w
=>
w
.
ID
==
menuRequest
.
ParentID
||
w
.
ParentID
==
menuRequest
.
ParentID
);
if
(
datas
==
null
)
throw
new
PerformanceException
(
"未找到需要修改的数据,请检查后重试"
);
if
(
datas
.
Where
(
w
=>
w
.
ParentID
==
menuRequest
.
ParentID
&&
w
.
States
==
1
).
Count
()
<=
1
)
{
var
temp
=
datas
.
FirstOrDefault
(
w
=>
w
.
ID
==
menuRequest
.
ParentID
);
temp
.
States
=
menuRequest
.
States
;
sys_Menus
.
Add
(
temp
);
}
var
data
=
datas
.
FirstOrDefault
(
w
=>
w
.
ID
==
menuRequest
.
ID
);
if
(
data
==
null
)
throw
new
PerformanceException
(
"未找到需要修改的数据"
);
data
.
ParentID
=
menuRequest
.
ParentID
;
...
...
@@ -86,7 +96,10 @@ public ApiResponse UpdateSystemMenu(MenuRequest menuRequest)
data
.
MenuUrl
=
menuRequest
.
MenuUrl
;
data
.
States
=
menuRequest
.
States
;
data
.
Sort
=
menuRequest
.
Sort
;
_menuRepository
.
Update
(
data
);
sys_Menus
.
Add
(
data
);
if
(
sys_Menus
==
null
)
throw
new
PerformanceException
(
"未找到需要修改的数据,请检查后重试"
);
_menuRepository
.
UpdateRange
(
sys_Menus
.
ToArray
());
return
new
ApiResponse
(
ResponseType
.
OK
);
}
catch
(
Exception
ex
)
...
...
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