File tree Expand file tree Collapse file tree
java/top/cadecode/uniboot/system Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,4 +18,9 @@ public interface SysRoleMapper extends BaseMapper<SysRole> {
1818
1919 List <SysRole > listByUserId (@ Param ("userId" ) Long userId );
2020
21+ List <SysRole > listByMenuId (@ Param ("menuId" ) Long menuId );
22+
23+ List <SysRole > listByApiId (@ Param ("apiId" ) Long apiId );
24+
25+
2126}
Original file line number Diff line number Diff line change 33import com .baomidou .mybatisplus .extension .service .IService ;
44import top .cadecode .uniboot .system .bean .po .SysRole ;
55
6+ import java .util .List ;
7+
68/**
79 * 系统角色服务
810 *
911 * @author Cade Li
1012 * @date 2022/5/27
1113 */
1214public interface SysRoleService extends IService <SysRole > {
15+
16+ List <SysRole > listByUserId ( Long userId );
17+
18+ List <SysRole > listByMenuId (Long menuId );
19+
20+ List <SysRole > listByApiId (Long apiId );
1321}
Original file line number Diff line number Diff line change 11package top .cadecode .uniboot .system .serviceimpl ;
22
33import com .baomidou .mybatisplus .extension .service .impl .ServiceImpl ;
4+ import lombok .RequiredArgsConstructor ;
45import org .springframework .stereotype .Service ;
56import top .cadecode .uniboot .system .bean .po .SysRole ;
67import top .cadecode .uniboot .system .mapper .SysRoleMapper ;
78import top .cadecode .uniboot .system .service .SysRoleService ;
89
10+ import java .util .List ;
11+
912/**
1013 * 系统角色服务实现
1114 *
1215 * @author Cade Li
1316 * @date 2022/5/27
1417 */
18+ @ RequiredArgsConstructor
1519@ Service
1620public class SysRoleServiceImpl extends ServiceImpl <SysRoleMapper , SysRole > implements SysRoleService {
21+
22+ private final SysRoleMapper sysRoleMapper ;
23+
24+ @ Override
25+ public List <SysRole > listByUserId (Long userId ) {
26+ return sysRoleMapper .listByUserId (userId );
27+ }
28+
29+ @ Override
30+ public List <SysRole > listByMenuId (Long menuId ) {
31+ return sysRoleMapper .listByMenuId (menuId );
32+ }
33+
34+ @ Override
35+ public List <SysRole > listByApiId (Long apiId ) {
36+ return sysRoleMapper .listByApiId (apiId );
37+ }
1738}
Original file line number Diff line number Diff line change 77 INNER JOIN sys_role r ON ru.role_id = r.id
88 WHERE ru.user_id = #{userId}
99 </select >
10+ <select id =" listByMenuId" resultType =" top.cadecode.uniboot.system.bean.po.SysRole" >
11+ SELECT *
12+ FROM sys_role_menu rm
13+ INNER JOIN sys_role r ON rm.role_id = r.id
14+ WHERE rm.menu_id = #{menuId}
15+ </select >
16+ <select id =" listByApiId" resultType =" top.cadecode.uniboot.system.bean.po.SysRole" >
17+ SELECT *
18+ FROM sys_role_api ra
19+ INNER JOIN sys_role r ON ra.role_id = r.id
20+ WHERE ra.api_id = #{apiId}
21+ </select >
1022</mapper >
You can’t perform that action at this time.
0 commit comments