package com.srs.dormitory.mapper;

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

import com.srs.dormitory.domain.DmsStuDaily;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


/**
 * 学生宿舍打卡Mapper接口
 *
 * @author srs
 * @date 2024-12-21
 */
@Mapper
public interface DmsStuDailyMapper extends BaseMapper<DmsStuDaily> {


    public List<Map<String, Object>> countDeptCard();

    public List<String> listLeaveLog();

    public List<Map<String, Object>> countDeptShixi();

    public List<Map<String, Object>> countDeptLeave();

    //列出所有学务
    public List<Map<String, Object>> listAllXw();

    public List<Map<String, Object>> listStudent(@Param("list") Set<String> stuNos);


    @Select("select * from (\n" +
            "select a.*,(select count(1) from dms_stu_daily as t1 where t1.stu_no = a.stu_no and t1.submit_time like concat( date_format(#{submitTime}, '%Y-%m-%d'),'%')) as card_count\n" +
            "from srs_dormitory_student as a\n" +
            ") as r1 where r1.card_count = 0")
    public List<Map<String, Object>> listUnCard(DmsStuDaily param);

    public List<DmsStuDaily> listToday(DmsStuDaily param);


    public Map<String, Object> getStuDorm(String stuNo);


    /**
     * 查询学生宿舍打卡
     *
     * @param id 学生宿舍打卡主键
     * @return 学生宿舍打卡
     */
    public DmsStuDaily selectDmsStuDailyById(Long id);

    /**
     * 查询学生宿舍打卡列表
     *
     * @param dmsStuDaily 学生宿舍打卡
     * @return 学生宿舍打卡集合
     */
    List<DmsStuDaily> selectDmsStuDailyList(DmsStuDaily dmsStuDaily);

    /**
     * 新增学生宿舍打卡
     *
     * @param dmsStuDaily 学生宿舍打卡
     * @return 结果
     */
    int insertDmsStuDaily(DmsStuDaily dmsStuDaily);

    /**
     * 修改学生宿舍打卡
     *
     * @param dmsStuDaily 学生宿舍打卡
     * @return 结果
     */
    int updateDmsStuDaily(DmsStuDaily dmsStuDaily);

    /**
     * 删除学生宿舍打卡
     *
     * @param id 学生宿舍打卡主键
     * @return 结果
     */
    int deleteDmsStuDailyById(Long id);

    /**
     * 批量删除学生宿舍打卡
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    int deleteDmsStuDailyByIds(Long[] ids);
    // 统计已打卡的数据
    int checkedIn();
    //统计未打卡的数据
    int notCheckedIn();
    //统计请假离校人数
    int leavScholl();
    //统计去实习人数
    int goLesson();
    List<Map<String,Object>> getDeptNames();
}
