Commit 6550d827d8494627f9d4ec5010d18746418cdb0b
1 parent
f995cb2413
Exists in
master
and in
1 other branch
根据角色获取权限
Showing 4 changed files with 32 additions and 0 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/RoleController.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsRoleMapper.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsRoleService.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsRoleServiceImpl.java
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/RoleController.java
View file @
6550d82
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| 4 | 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| 5 | +import com.lyms.talkonlineweb.domain.LymsPermission; | |
| 5 | 6 | import com.lyms.talkonlineweb.domain.LymsRole; |
| 6 | 7 | import com.lyms.talkonlineweb.domain.LymsUser; |
| 7 | 8 | import com.lyms.talkonlineweb.result.BaseResponse; |
| ... | ... | @@ -117,6 +118,19 @@ |
| 117 | 118 | cnt=lymsRoleService.addRoleByPerms(rid,Integer.parseInt(pArr[i])); |
| 118 | 119 | } |
| 119 | 120 | // baseResponse.setObject(rLst); |
| 121 | + return baseResponse; | |
| 122 | + } | |
| 123 | + | |
| 124 | + /** | |
| 125 | + * 根据角色获取权限 | |
| 126 | + * @param rid | |
| 127 | + * @return | |
| 128 | + */ | |
| 129 | + @GetMapping("getPersByRid") | |
| 130 | + public BaseResponse getPersByRid(int rid){ | |
| 131 | + BaseResponse baseResponse=new BaseResponse(); | |
| 132 | + List<LymsPermission> pLst=lymsRoleService.getPersByRid(rid); | |
| 133 | + baseResponse.setObject(pLst); | |
| 120 | 134 | return baseResponse; |
| 121 | 135 | } |
| 122 | 136 |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsRoleMapper.java
View file @
6550d82
| 1 | 1 | package com.lyms.talkonlineweb.mapper; |
| 2 | 2 | |
| 3 | +import com.lyms.talkonlineweb.domain.LymsPermission; | |
| 3 | 4 | import com.lyms.talkonlineweb.domain.LymsRole; |
| 4 | 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| 5 | 6 | import org.apache.ibatis.annotations.Delete; |
| ... | ... | @@ -22,5 +23,8 @@ |
| 22 | 23 | |
| 23 | 24 | @Insert("insert lyms_rolepermiss(rid,pid) values(#{rid},#{pid})") |
| 24 | 25 | int addRoleByPerms(@Param("rid") int rid, @Param("pid") int pid); |
| 26 | + | |
| 27 | + @Select("SELECT * FROM lyms_rolepermiss rp,lyms_permission p WHERE p.`id`=rp.`pid` AND rp.`rid`= #{rid} ") | |
| 28 | + List<LymsPermission> getPersByRid(@Param("rid") int rid); | |
| 25 | 29 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsRoleService.java
View file @
6550d82
| 1 | 1 | package com.lyms.talkonlineweb.service; |
| 2 | 2 | |
| 3 | +import com.lyms.talkonlineweb.domain.LymsPermission; | |
| 3 | 4 | import com.lyms.talkonlineweb.domain.LymsRole; |
| 4 | 5 | import com.baomidou.mybatisplus.extension.service.IService; |
| 5 | 6 | |
| ... | ... | @@ -31,5 +32,12 @@ |
| 31 | 32 | * @return |
| 32 | 33 | */ |
| 33 | 34 | int delPersByRole(int rid); |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 根据角色获取权限 | |
| 38 | + * @param rid | |
| 39 | + * @return | |
| 40 | + */ | |
| 41 | + List<LymsPermission> getPersByRid(int rid); | |
| 34 | 42 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsRoleServiceImpl.java
View file @
6550d82
| 1 | 1 | package com.lyms.talkonlineweb.service.impl; |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| 4 | +import com.lyms.talkonlineweb.domain.LymsPermission; | |
| 4 | 5 | import com.lyms.talkonlineweb.domain.LymsRole; |
| 5 | 6 | import com.lyms.talkonlineweb.service.LymsRoleService; |
| 6 | 7 | import com.lyms.talkonlineweb.mapper.LymsRoleMapper; |
| ... | ... | @@ -32,6 +33,11 @@ |
| 32 | 33 | @Override |
| 33 | 34 | public int delPersByRole(int rid) { |
| 34 | 35 | return lymsRoleMapper.delPersByRole(rid); |
| 36 | + } | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public List<LymsPermission> getPersByRid(int rid) { | |
| 40 | + return lymsRoleMapper.getPersByRid(rid); | |
| 35 | 41 | } |
| 36 | 42 | } |