package com.srs.dormitory.mapper;

import com.github.yulichang.base.MPJBaseMapper;
import com.srs.dormitory.domain.DmsDormitory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.srs.dormitory.domain.Dto.DmsSearch;
import com.srs.dormitory.domain.SrsDormitoryStudent;
import com.srs.dormitory.domain.Vo.DmsFdyStu;
import com.srs.dormitory.domain.Vo.DomInfo;
import com.srs.dormitory.domain.Vo.DormitoryVo;
import com.srs.dormitory.domain.Vo.ExportDormInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

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

/**
 * <p>
 * 宿舍信息表 Mapper 接口
 * </p>
 *
 * @author 猪油骨
 * @since 2023-07-14
 */
@Mapper
public interface DmsDormitoryMapper extends MPJBaseMapper<DmsDormitory> {

    @Select("select * from view_dorm_info")
    public List<Map<String, Object>> listDormInfo();

    public List<DmsDormitory> listViewDormInfoByIds(@Param("ids") List<Long> ids);

    public DmsDormitory getDormitoryById(@Param("id") Long id);

    public DomInfo getDormHas(Long id);

    public List<DomInfo> countRecordConfirmStatus();
    public List<DomInfo> countParkStuIn();
    public List<DomInfo> listDormInfo(DmsSearch param);
    List<DomInfo> countGenderBed();
    List<DomInfo> countDeptBed();
    List<DomInfo> countStuIn();
    public List<SrsDormitoryStudent> findNotStu();
    public List<DomInfo> countParkBed(DmsSearch param);
    public List<DmsFdyStu> exportDept(DmsSearch param);
    public List<DmsFdyStu> exportFdy(DmsSearch param);
    public List<DomInfo> listRoomStu(DmsSearch param);
    public List<DomInfo> listRoomDeptLive(DmsSearch param);

    List<ExportDormInfo> exportListRoomDeptLive(DmsSearch param);

    List<DomInfo> listBuildingInfo();





    /**
     * 查询宿舍列表
     * @param params
     * @return
     */
    List<DormitoryVo> getDormitoryList(Map<String, Object> params);

    List<DmsDormitory> listDormCount();

    public List<DormitoryVo> getCanDormList(Map<String, Object> params);

    public List<DormitoryVo> getAllDormList(DmsSearch params);
    List<Map<String,Object>> getDormitoryInfoList(Map<String,Object> params);
    List<Map<String,Object>> getDormitoryInfoListByIds(@Param("ids") List<Long> ids,@Param("gender") String gender);

    /**
     * 查询该班级还有剩余床位的宿舍
     * @param BJDM 班级代码
     * @param isMixed 是否为混合宿舍
     * @return
     */
    List<DmsDormitory> getHasBedDormitory(@Param("BJDM") String BJDM,@Param("isMixed") Integer isMixed);

    /**
     * 导出宿舍信息
     * @param params
     * @return
     */
    List<DormitoryVo> exportDormitoryList(Map<String, Object> params);

    DmsDormitory selectByStuNo(@Param("stuNo") String stuNo);

    /**
     * 根据宿舍楼id查询宿舍列表
     * @param buildingId
     * @return
     */
    List<DmsDormitory> selectAllByBuildingId(@Param("buildingId") Long buildingId);

    /**
     * 根据宿舍id查看宿舍学生
     * @param id 宿舍id
     * @return
     */
    List<Map<String, Object>> getStudentById(@Param("id") Long id);

    int openNotFull();

    int closeFull();


    List<DomInfo> viewDormInfo();

}
