huanghongfa
2021-01-07 ae33fef700e5d2558dffb03c8f66358da2545791
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package com.panzhihua.service_user.dao;
 
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.panzhihua.common.model.vos.MenuVO;
import com.panzhihua.service_user.model.dos.SysRoleDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
 
import java.util.List;
 
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
 * @description: 角色
 * @author: huang.hongfa weixin hhf9596 qq 959656820
 * @create: 2020-11-24 16:34
 **/
@Mapper
public interface RoleDAO extends BaseMapper<SysRoleDO> {
    @Select("select r.* from sys_user_role u join sys_role r on u.role_id=r.role_id where u.user_id=#{userId}")
    List<SysRoleDO> selectByUserId(Long userId);
    @Select("select r.role_key role,m.component url from sys_role r join sys_role_menu rm on r.role_id=rm.role_id join sys_menu m on rm.menu_id=m.menu_id WHERE m.component is not null ")
    List<MenuVO> selectAllMenuUrl();
    @Select("select r.role_key from sys_user_role ur join sys_role r on ur.role_id = r.role_id where ur.user_id=#{username}")
    List<String> selectRoles(String username);
    @Select("")
    Long selectMaxRole(Long communityId);
}