Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
R
restful
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李永强
restful
Commits
9f8b4dbc
Commit
9f8b4dbc
authored
Oct 24, 2019
by
李永强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整功能
parent
10957a02
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
9 deletions
+18
-9
JurisdictionDao.java
src/main/java/com/restful/dao/JurisdictionDao.java
+3
-3
UserService.java
src/main/java/com/restful/service/UserService.java
+1
-1
jurisdiction.xml
src/main/resources/mapper/jurisdiction.xml
+14
-5
No files found.
src/main/java/com/restful/dao/JurisdictionDao.java
View file @
9f8b4dbc
...
@@ -16,10 +16,10 @@ public interface JurisdictionDao {
...
@@ -16,10 +16,10 @@ public interface JurisdictionDao {
Role
getRole
(
Long
id
);
Role
getRole
(
Long
id
);
void
addAuthority
(
@Param
(
"roleId"
)
Long
roleId
,
@Param
(
"menuId
"
)
Long
[]
menuId
);
void
addAuthority
(
@Param
(
"roleId"
)
Long
roleId
,
@Param
(
"menuId
s"
)
Long
[]
menuIds
);
void
delAuthority
(
@Param
(
"roleId"
)
Long
roleId
,
@Param
(
"menuId
"
)
Long
[]
menuId
);
void
delAuthority
(
@Param
(
"roleId"
)
Long
roleId
,
@Param
(
"menuId
s"
)
Long
[]
menuIds
);
void
roleToUser
(
@Param
(
"roleId
"
)
Long
[]
roleId
,
@Param
(
"userId"
)
Long
userId
);
void
roleToUser
(
@Param
(
"roleId
s"
)
Long
[]
roleIds
,
@Param
(
"userId"
)
Long
userId
);
}
}
src/main/java/com/restful/service/UserService.java
View file @
9f8b4dbc
...
@@ -48,7 +48,7 @@ public class UserService {
...
@@ -48,7 +48,7 @@ public class UserService {
user
.
setPassword
(
PasswordUtils
.
encryption
(
user
.
getUserName
()));
user
.
setPassword
(
PasswordUtils
.
encryption
(
user
.
getUserName
()));
try
{
try
{
userDao
.
addUser
(
user
);
userDao
.
addUser
(
user
);
jurisdictionService
.
roleToUser
(
RoleTable
.
detection_admin
.
getId
(),
user
.
getId
());
jurisdictionService
.
roleToUser
(
RoleTable
.
detection_admin
.
getId
()
.
toString
()
,
user
.
getId
());
}
catch
(
DuplicateKeyException
e
)
{
}
catch
(
DuplicateKeyException
e
)
{
throw
new
ServiceException
(
"已经存在该用户"
);
throw
new
ServiceException
(
"已经存在该用户"
);
}
}
...
...
src/main/resources/mapper/jurisdiction.xml
View file @
9f8b4dbc
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
from menu
from menu
where 1 = 1
where 1 = 1
<if
test=
"remark!=null"
>
<if
test=
"remark!=null"
>
and menu_
remark
like '%'||#{remark}||'%'
and menu_
describe
like '%'||#{remark}||'%'
</if>
</if>
<if
test=
"url!=null"
>
<if
test=
"url!=null"
>
and menu_url like '%'||#{url}||'%'
and menu_url like '%'||#{url}||'%'
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
</select>
</select>
<select
id=
"getRole"
resultMap=
"complexRoleMap"
>
<select
id=
"getRole"
resultMap=
"complexRoleMap"
>
select role.*,menu.*
select role.*,
menu.*
from role
from role
left join role_menu on rm_role_id = role_id
left join role_menu on rm_role_id = role_id
left join menu on menu.menu_id = role_menu.rm_menu_id
left join menu on menu.menu_id = role_menu.rm_menu_id
...
@@ -56,19 +56,28 @@
...
@@ -56,19 +56,28 @@
<insert
id=
"addAuthority"
>
<insert
id=
"addAuthority"
>
insert into role_menu (rm_role_id, rm_menu_id)
insert into role_menu (rm_role_id, rm_menu_id)
values (#{roleId}, #{menuId});
values
<foreach
collection=
"menuIds"
item=
"menuId"
separator=
","
>
(#{roleId}, #{menuId})
</foreach>
</insert>
</insert>
<delete
id=
"delAuthority"
>
<delete
id=
"delAuthority"
>
delete
delete
from role_menu
from role_menu
where rm_role_id = #{roleId}
where rm_role_id = #{roleId}
and rm_menu_id = #{menuId};
and rm_menu_id in
<foreach
collection=
"menuIds"
item=
"menuId"
separator=
","
>
(#{roleId}, #{menuId})
</foreach>
</delete>
</delete>
<insert
id=
"roleToUser"
>
<insert
id=
"roleToUser"
>
insert into user_role (ur_role_id, ur_user_id)
insert into user_role (ur_role_id, ur_user_id)
values (#{roleId}, #{userId});
values
<foreach
collection=
"roleIds"
item=
"roleIds"
separator=
","
>
(#{roleId}, #{userId})
</foreach>
</insert>
</insert>
</mapper>
</mapper>
\ No newline at end of file
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