package shop.alien.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import shop.alien.entity.store.LifeSysRole;

import java.util.List;

/**
 * 平台角色信息表 Mapper 接口
 *
 * @author system
 * @since 2025-01-XX
 */
@Mapper
public interface LifeSysRoleMapper extends BaseMapper<LifeSysRole> {
    /**
     * 根据用户ID查询角色
     *
     * @param queryWrapper 查询条件
     * @return 角色列表
     */
    @Select("select lsr.*\n" +
            "from life_sys_role lsr\n" +
            "left join life_sys_user_role lsur on lsur.role_id = lsr.role_id\n" +
            "${ew.customSqlSegment}")
    List<LifeSysRole> getRoleByUserId(@Param(Constants.WRAPPER) QueryWrapper<LifeSysRole> queryWrapper);
}

