package cn.com.ty.lift.system.user.dao.mapper;

import cn.com.ty.lift.system.user.dao.entity.Role;
import cn.com.xwy.boot.mybatis.MyBatisMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * MyBatis Mapper 接口 - 表：role
 * @since 2019-12-01 15:46:21
 */
@MyBatisMapper
public interface RoleMapper extends BaseMapper<Role> {

    @Select("select r.id, r.code, r.name, r.company_id as companyId " +
            "from role r left join user_role ur " +
            "on r.id = ur.role_id " +
            "where ur.user_id = #{userId} " +
            "and r.code = #{roleCode}")
    List<Role> getRoleListByUserIdAndRoleCode(Long userId, String roleCode);

}