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.KhVoteRecardMapper;
import com.ruoyi.kaohe.domain.KhVoteRecard;
import com.ruoyi.kaohe.service.IKhVoteRecardService;

/**
 * 投票记录Service业务层处理
 * 
 * @author hs
 * @date 2025-06-17
 */
@Service
public class KhVoteRecardServiceImpl implements IKhVoteRecardService 
{
    @Autowired
    private KhVoteRecardMapper khVoteRecardMapper;

    /**
     * 查询投票记录
     * 
     * @param id 投票记录主键
     * @return 投票记录
     */
    @Override
    public KhVoteRecard selectKhVoteRecardById(Long id)
    {
        return khVoteRecardMapper.selectKhVoteRecardById(id);
    }

    /**
     * 查询投票记录列表
     * 
     * @param khVoteRecard 投票记录
     * @return 投票记录
     */
    @Override
    public List<KhVoteRecard> selectKhVoteRecardList(KhVoteRecard khVoteRecard)
    {
        return khVoteRecardMapper.selectKhVoteRecardList(khVoteRecard);
    }

    /**
     * 新增投票记录
     * 
     * @param khVoteRecard 投票记录
     * @return 结果
     */
    @Override
    public int insertKhVoteRecard(KhVoteRecard khVoteRecard)
    {
        khVoteRecard.setCreateTime(DateUtils.getNowDate());
        return khVoteRecardMapper.insertKhVoteRecard(khVoteRecard);
    }

    /**
     * 修改投票记录
     * 
     * @param khVoteRecard 投票记录
     * @return 结果
     */
    @Override
    public int updateKhVoteRecard(KhVoteRecard khVoteRecard)
    {
        khVoteRecard.setUpdateTime(DateUtils.getNowDate());
        return khVoteRecardMapper.updateKhVoteRecard(khVoteRecard);
    }

    /**
     * 批量删除投票记录
     * 
     * @param ids 需要删除的投票记录主键
     * @return 结果
     */
    @Override
    public int deleteKhVoteRecardByIds(Long[] ids)
    {
        return khVoteRecardMapper.deleteKhVoteRecardByIds(ids);
    }

    /**
     * 删除投票记录信息
     * 
     * @param id 投票记录主键
     * @return 结果
     */
    @Override
    public int deleteKhVoteRecardById(Long id)
    {
        return khVoteRecardMapper.deleteKhVoteRecardById(id);
    }
}
