package com.kiisoo.ic.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kiisoo.ic.system.bean.AccountBean;
import com.kiisoo.ic.system.entity.PrivilageAccountDO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Set;

/**
 * 账号  Mapper 接口
 * @author jinchaofan
 * @since 2020-02-19
 */
@Repository
public interface PrivilageAccountDOMapper extends BaseMapper<PrivilageAccountDO> {

    /**
     * 查询用户角色信息
     * @param userId 用户id
     * @return 账号信息bean
     */
    AccountBean selectUserAndRoleInfo(@Param("userId") Long userId);

    /**
     * 根据搜索内容和角色查询账号id
     * @param searchContent 搜索内容
     * @param roleId 角色id
     * @return 账号id集合
     */
    Set<Long> selectAccountIdByRoleAndSearchContent(@Param("searchContent") String searchContent, @Param("roleId") Long roleId);

    /**
     * 根据店铺id查询账号id
     * @param shopId 店铺id
     * @return 账号id集合
     */
    Set<Long> selectAccountIdByShopId(@Param("shopId") Long shopId);

    int deleteByUserId(@Param("userId") long userId);

}
