package com.sundot.airport.exam.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.sundot.airport.exam.domain.ExamMonthlyScore;
import com.sundot.airport.exam.mapper.ExamMonthlyScoreMapper;
import com.sundot.airport.exam.service.IExamMonthlyScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 月考成绩Service业务层处理
 *
 * @author ruoyi
 * @date 2026-05-06
 */
@Service
public class ExamMonthlyScoreServiceImpl implements IExamMonthlyScoreService {
    @Autowired
    private ExamMonthlyScoreMapper examMonthlyScoreMapper;

    /**
     * 查询月考成绩
     *
     * @param id 月考成绩主键
     * @return 月考成绩
     */
    @Override
    public ExamMonthlyScore selectExamMonthlyScoreById(Long id) {
        return examMonthlyScoreMapper.selectExamMonthlyScoreById(id);
    }

    /**
     * 查询月考成绩列表
     *
     * @param examMonthlyScore 月考成绩
     * @return 月考成绩
     */
    @Override
    public List<ExamMonthlyScore> selectExamMonthlyScoreList(ExamMonthlyScore examMonthlyScore) {
        return examMonthlyScoreMapper.selectExamMonthlyScoreList(examMonthlyScore);
    }

    /**
     * 新增月考成绩
     *
     * @param examMonthlyScore 月考成绩
     * @return 结果
     */
    @Override
    public int insertExamMonthlyScore(ExamMonthlyScore examMonthlyScore) {
        return examMonthlyScoreMapper.insertExamMonthlyScore(examMonthlyScore);
    }

    /**
     * 修改月考成绩
     *
     * @param examMonthlyScore 月考成绩
     * @return 结果
     */
    @Override
    public int updateExamMonthlyScore(ExamMonthlyScore examMonthlyScore) {
        return examMonthlyScoreMapper.updateExamMonthlyScore(examMonthlyScore);
    }

    /**
     * 批量删除月考成绩
     *
     * @param ids 需要删除的月考成绩主键
     * @return 结果
     */
    @Override
    public int deleteExamMonthlyScoreByIds(Long[] ids) {
        return examMonthlyScoreMapper.deleteExamMonthlyScoreByIds(ids);
    }

    /**
     * 删除月考成绩信息
     *
     * @param id 月考成绩主键
     * @return 结果
     */
    @Override
    public int deleteExamMonthlyScoreById(Long id) {
        return examMonthlyScoreMapper.deleteExamMonthlyScoreById(id);
    }

    /**
     * 根据用户ID和年月查询月考成绩
     *
     * @param userId    用户ID
     * @param yearMonth 年月
     * @return 月考成绩
     */
    @Override
    public ExamMonthlyScore selectByUserIdAndYearMonth(Long userId, String yearMonth) {
        return examMonthlyScoreMapper.selectByUserIdAndYearMonth(userId, yearMonth);
    }

    /**
     * 批量查询指定用户的月考成绩
     *
     * @param userIds 用户ID列表
     * @return 月考成绩集合
     */
    @Override
    public List<ExamMonthlyScore> selectByUserIds(List<Long> userIds) {
        return examMonthlyScoreMapper.selectByUserIds(userIds);
    }
}
