Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
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
蒋勇
zhichan
Commits
5f811832
Commit
5f811832
authored
Jan 16, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
231ca77d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
6 deletions
+30
-6
xggsve-uc/app/base/db/impl/auth/authDao.js
+16
-0
xggsve-uc/app/base/service/impl/auth/authSve.js
+14
-6
No files found.
xggsve-uc/app/base/db/impl/auth/authDao.js
View file @
5f811832
...
...
@@ -36,7 +36,22 @@ class AuthDao extends Dao {
if
(
params
.
saas_id
)
{
sql
.
push
(
"AND t1.saas_id = :saas_id"
);
}
if
(
params
.
authIds
)
{
sql
.
push
(
"AND t1.id IN (:authIds)"
);
}
return
this
.
customQuery
(
sql
.
join
(
" "
),
params
);
}
async
byIds
(
ids
)
{
if
(
!
ids
||
ids
.
length
==
0
)
{
return
[];
}
let
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"t1.id, t1.`pid`, t1.`name`, t1.`icon`, t1.`path`"
);
sql
.
push
(
"FROM uc_auth t1"
);
sql
.
push
(
"WHERE t1.id IN (:ids)"
);
return
this
.
customQuery
(
sql
.
join
(
" "
),
{
ids
:
ids
});
}
}
module
.
exports
=
AuthDao
;
\ No newline at end of file
xggsve-uc/app/base/service/impl/auth/authSve.js
View file @
5f811832
...
...
@@ -99,6 +99,10 @@ class AuthService extends ServiceBase {
async
byRoleIds
(
params
)
{
return
await
this
.
dao
.
byRoleIds
(
params
);
}
async
byIds
(
params
)
{
return
await
this
.
dao
.
byIds
(
params
);
}
async
menuByRoleIds
(
params
)
{
params
.
menuType
=
1
;
let
all
=
await
this
.
byRoleIds
(
params
);
...
...
@@ -106,23 +110,27 @@ class AuthService extends ServiceBase {
return
[];
}
let
pmenus
=
[];
let
pmenuMap
=
{};
let
pids
=
[];
for
(
let
item
of
all
)
{
if
(
item
.
pid
===
0
)
{
pmenus
.
push
(
item
);
pmenuMap
[
item
.
id
]
=
item
;
pids
.
push
(
item
.
id
);
}
else
{
pids
.
push
(
item
.
pid
);
}
}
let
pmenuMap
=
{};
let
pmenus
=
await
this
.
byIds
(
pids
);
for
(
let
p
of
pmenus
)
{
pmenuMap
[
p
.
id
]
=
p
;
}
for
(
let
item
of
all
)
{
let
pid
=
item
.
pid
;
if
(
pid
===
0
)
{
continue
;
}
let
pmenu
=
pmenuMap
[
pid
];
if
(
!
pmenu
)
{
continue
;
}
...
...
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