package com.qmth.teachcloud.common.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qmth.teachcloud.common.bean.dto.BlurryUserDto;
import com.qmth.teachcloud.common.bean.dto.UserDto;
import com.qmth.teachcloud.common.bean.params.ApproveUserResult;
import com.qmth.teachcloud.common.entity.SysUser;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author xf
 * @since 2021-03-23
 */
public interface SysUserMapper extends BaseMapper<SysUser> {

    IPage<UserDto> listPage(Page<UserDto> page, @Param("schoolId") Long schoolId, @Param("loginName") String loginName, @Param("roleId") String roleId, @Param("enable") Boolean enable, @Param("realName") String realName);

    List<BlurryUserDto> listUser(@Param("schoolId") Long schoolId, @Param("type") String type, @Param("courseCode") String courseCode, @Param("param") String param, @Param("orgIds") Set<Long> orgIds);

    IPage<UserDto> listCustomerPage(Page<UserDto> page, @Param("realName") String realName, @Param("enable") Boolean enable);

    /**
     * 过滤拥有审核权限的人
     *
     * @param schoolId
     * @param orgIds
     * @param filter
     * @param approveName
     * @param realName
     * @return
     */
    List<ApproveUserResult> filterFlowPrivilege(@Param("schoolId") Long schoolId, @Param("orgIds") Set<Long> orgIds, @Param("filter") Boolean filter, @Param("approveName") String approveName, @Param("realName") String realName);

    /**
     * 根据id获取
     *
     * @param id
     * @return
     */
    public List<ApproveUserResult> findById(@Param("id") Long id);
}
