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.KhVoteItemsMapper;
import com.ruoyi.kaohe.domain.KhVoteItems;
import com.ruoyi.kaohe.service.IKhVoteItemsService;

/**
 * 投票项Service业务层处理
 * 
 * @author hs
 * @date 2025-06-24
 */
@Service
public class KhVoteItemsServiceImpl implements IKhVoteItemsService 
{
    @Autowired
    private KhVoteItemsMapper khVoteItemsMapper;

    /**
     * 查询投票项
     * 
     * @param id 投票项主键
     * @return 投票项
     */
    @Override
    public KhVoteItems selectKhVoteItemsById(Long id)
    {
        return khVoteItemsMapper.selectKhVoteItemsById(id);
    }

    /**
     * 查询投票项列表
     * 
     * @param khVoteItems 投票项
     * @return 投票项
     */
    @Override
    public List<KhVoteItems> selectKhVoteItemsList(KhVoteItems khVoteItems)
    {
        return khVoteItemsMapper.selectKhVoteItemsList(khVoteItems);
    }

    /**
     * 新增投票项
     * 
     * @param khVoteItems 投票项
     * @return 结果
     */
    @Override
    public int insertKhVoteItems(KhVoteItems khVoteItems)
    {
        khVoteItems.setCreateTime(DateUtils.getNowDate());
        return khVoteItemsMapper.insertKhVoteItems(khVoteItems);
    }

    /**
     * 修改投票项
     * 
     * @param khVoteItems 投票项
     * @return 结果
     */
    @Override
    public int updateKhVoteItems(KhVoteItems khVoteItems)
    {
        khVoteItems.setUpdateTime(DateUtils.getNowDate());
        return khVoteItemsMapper.updateKhVoteItems(khVoteItems);
    }

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

    /**
     * 删除投票项信息
     * 
     * @param id 投票项主键
     * @return 结果
     */
    @Override
    public int deleteKhVoteItemsById(Long id)
    {
        return khVoteItemsMapper.deleteKhVoteItemsById(id);
    }
}
