package com.vetti.hotake.service.impl;

import java.util.List;

import com.vetti.common.core.service.BaseServiceImpl;
import com.vetti.common.enums.FillTypeEnum;
import com.vetti.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.vetti.hotake.mapper.HotakeProblemBaseInfoMapper;
import com.vetti.hotake.domain.HotakeProblemBaseInfo;
import com.vetti.hotake.service.IHotakeProblemBaseInfoService;

/**
 * 面试者问题库信息Service业务层处理
 * 
 * @author wangxiangshun
 * @date 2025-11-04
 */
@SuppressWarnings("all")
@Service
public class HotakeProblemBaseInfoServiceImpl extends BaseServiceImpl implements IHotakeProblemBaseInfoService
{
    @Autowired
    private HotakeProblemBaseInfoMapper hotakeProblemBaseInfoMapper;

    /**
     * 查询面试者问题库信息
     * 
     * @param id 面试者问题库信息主键
     * @return 面试者问题库信息
     */
    @Transactional(readOnly = true)
    @Override
    public HotakeProblemBaseInfo selectHotakeProblemBaseInfoById(Long id)
    {
        return hotakeProblemBaseInfoMapper.selectHotakeProblemBaseInfoById(id);
    }

    /**
     * 查询面试者问题库信息列表
     * 
     * @param hotakeProblemBaseInfo 面试者问题库信息
     * @return 面试者问题库信息
     */
    @Transactional(readOnly = true)
    @Override
    public List<HotakeProblemBaseInfo> selectHotakeProblemBaseInfoList(HotakeProblemBaseInfo hotakeProblemBaseInfo)
    {
        return hotakeProblemBaseInfoMapper.selectHotakeProblemBaseInfoList(hotakeProblemBaseInfo);
    }

    /**
     * 新增面试者问题库信息
     * 
     * @param hotakeProblemBaseInfo 面试者问题库信息
     * @return 结果
     */
    @Transactional(rollbackFor=Exception.class)
    @Override
    public int insertHotakeProblemBaseInfo(HotakeProblemBaseInfo hotakeProblemBaseInfo)
    {
        fill(FillTypeEnum.INSERT.getCode(), hotakeProblemBaseInfo);
        return hotakeProblemBaseInfoMapper.insertHotakeProblemBaseInfo(hotakeProblemBaseInfo);
    }

    /**
     * 修改面试者问题库信息
     * 
     * @param hotakeProblemBaseInfo 面试者问题库信息
     * @return 结果
     */
    @Transactional(rollbackFor=Exception.class)
    @Override
    public int updateHotakeProblemBaseInfo(HotakeProblemBaseInfo hotakeProblemBaseInfo)
    {
        hotakeProblemBaseInfo.setUpdateTime(DateUtils.getNowDate());
        return hotakeProblemBaseInfoMapper.updateHotakeProblemBaseInfo(hotakeProblemBaseInfo);
    }

    /**
     * 批量删除面试者问题库信息
     * 
     * @param ids 需要删除的面试者问题库信息主键
     * @return 结果
     */
    @Transactional(rollbackFor=Exception.class)
    @Override
    public int deleteHotakeProblemBaseInfoByIds(Long[] ids)
    {
        return hotakeProblemBaseInfoMapper.deleteHotakeProblemBaseInfoByIds(ids);
    }

    /**
     * 删除面试者问题库信息信息
     * 
     * @param id 面试者问题库信息主键
     * @return 结果
     */
    @Transactional(rollbackFor=Exception.class)
    @Override
    public int deleteHotakeProblemBaseInfoById(Long id)
    {
        return hotakeProblemBaseInfoMapper.deleteHotakeProblemBaseInfoById(id);
    }
    /**
     * 批量新增面试者问题库信息
     *
     * @param hotakeProblemBaseInfoList 面试者问题库信息列表
     * @return 结果
     */
    @Transactional(rollbackFor=Exception.class)
    @Override
    public int batchInsertHotakeProblemBaseInfo(List<HotakeProblemBaseInfo> hotakeProblemBaseInfoList){
        return hotakeProblemBaseInfoMapper.batchInsertHotakeProblemBaseInfo(hotakeProblemBaseInfoList);
    }

    /**
     * 删除面试者问题库信息信息
     * @param userId 面试者用户ID
     * @return
     */
    @Override
    public int deleteHotakeProblemBaseInfoByUserId(Long userId,Long cvId) {

        return hotakeProblemBaseInfoMapper.deleteHotakeProblemBaseInfoByUserId(userId,cvId);
    }
}
