package com.iformall.mapper;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.MallPermission;
import com.iformall.domain.po.MallUserInfo;
import com.iformall.domain.vo.MallUserInfoVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface MallUserInfoMapper extends CommonMapper<MallUserInfo, String> {

    MallUserInfo getById(@Param("id") Long id);

	List<MallUserInfo> findList(MallUserInfo mallUserInfo);

	MallUserInfo selectByUserName(@Param("username") String username);

    MallUserInfo selectByUserNameWebOpen(@Param("username") String username, @Param("webOpenId") String webOpenId);

	MallUserInfo selectByBOpenId(@Param("bopenId") String bopenId, @Param("tenantId") String tenantId);

    List<MallUserInfo> selectByWebOpenId(@Param("webOpenId") String webOpenId);

    void removeWebOpenId(MallUserInfo mallUserInfo);

    void removeAllOpenId(MallUserInfo mallUserInfo);

	MallUserInfo selectByPhone(@Param("phone") String phone, @Param("tenantId") String tenantId);
	
	Integer hasButtonPermission(@Param("userId") Long userId, @Param("permission") String permission);

    int cntByUserName(Map<String,Object> params);


    List<MallUserInfoVo> selectUsersByPhone(@Param("phone") String phone);

    List<MallUserInfoVo> selectUsersByWebOpenId(@Param("webOpenId") String webOpenId);


    /**
     * 查询用户的所有菜单
     * @param userId  用户ID
     */
    List<MallPermission> queryAllMenu(Long userId);
    /**
     * 查询用户的所有权限
     * @param userId  用户ID
     */
    List<String> queryAllPerms(Long userId);

    /**
     * 查询用户的所有菜单ID
     */
    List<Long> queryAllMenuId(Long userId);

}
