package com.xjrsoft.module.base.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.base.MPJBaseMapper;
import com.xjrsoft.module.base.dto.WhitelistManagementPageDto;
import com.xjrsoft.module.base.entity.BaseClass;
import com.xjrsoft.module.base.entity.WhiteBaseClass;
import com.xjrsoft.module.base.entity.WhiteBaseGrade;
import com.xjrsoft.module.base.entity.WhitelistManagement;
import com.xjrsoft.module.base.service.impl.WhitelistManagementServiceImpl;
import com.xjrsoft.module.base.vo.WhitelistManagementPageVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @title: 白名单管理
* @Author brealinxx
* @Date: 2024-06-24
* @Version 1.0
*/
@Mapper
public interface WhitelistManagementMapper extends MPJBaseMapper<WhitelistManagement> {

    Page<WhitelistManagementPageVo> getPage(Page<Object> objectPage, WhitelistManagementPageDto dto);

    String getName(String name);

    String getCredentialNumber(String credentialNumber);

    String getPhone(String phone);

    Long getUserId(String credentialNumber);

    boolean checkExits(String credentialNumber);

    @Select("SELECT id, name FROM base_grade")
    List<WhiteBaseGrade> getAllGrades();

    @Select("SELECT id, name FROM base_class WHERE grade_id = #{gradeId}")
    List<WhiteBaseClass> getClassesByGradeId(@Param("gradeId") String gradeId);
}

