package com.ruoyi.kaohe.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.kaohe.mapper.KhVoteMapper;
import com.ruoyi.kaohe.domain.KhVote;
import com.ruoyi.kaohe.service.IKhVoteService;

/**
 * 投票评测Service业务层处理
 * 
 * @author hs
 * @date 2025-06-17
 */
@Service
public class KhVoteServiceImpl implements IKhVoteService 
{
    @Autowired
    private KhVoteMapper khVoteMapper;

    /**
     * 查询投票评测
     * 
     * @param id 投票评测主键
     * @return 投票评测
     */
    @Override
    public KhVote selectKhVoteById(Long id)
    {
        return khVoteMapper.selectKhVoteById(id);
    }

    /**
     * 查询投票评测列表
     * 
     * @param khVote 投票评测
     * @return 投票评测
     */
    @Override
    public List<KhVote> selectKhVoteList(KhVote khVote)
    {
        return khVoteMapper.selectKhVoteList(khVote);
    }

    /**
     * 新增投票评测
     * 
     * @param khVote 投票评测
     * @return 结果
     */
    @Override
    public int insertKhVote(KhVote khVote)
    {
        khVote.setCreateTime(DateUtils.getNowDate());
        return khVoteMapper.insertKhVote(khVote);
    }

    /**
     * 修改投票评测
     * 
     * @param khVote 投票评测
     * @return 结果
     */
    @Override
    public int updateKhVote(KhVote khVote)
    {
        khVote.setUpdateTime(DateUtils.getNowDate());
        return khVoteMapper.updateKhVote(khVote);
    }

    /**
     * 批量删除投票评测
     * 
     * @param ids 需要删除的投票评测主键
     * @return 结果
     */
    @Override
    public int deleteKhVoteByIds(Long[] ids)
    {
        return khVoteMapper.deleteKhVoteByIds(ids);
    }

    /**
     * 删除投票评测信息
     * 
     * @param id 投票评测主键
     * @return 结果
     */
    @Override
    public int deleteKhVoteById(Long id)
    {
        return khVoteMapper.deleteKhVoteById(id);
    }

    @Override
    public List<KhVote> getListByPcIdAndItemIds(KhVote khVote) {
        return khVoteMapper.getListByPcIdAndItemIds(khVote);
    }

    @Override
    public List<KhVote> selectUnfinishedVote() {
        return khVoteMapper.selectUnfinishedVote();
    }
}
