package com.ruoyi.oa.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.oa.mapper.CmcUserHistoryMapper;
import com.ruoyi.oa.domain.CmcUserHistory;
import com.ruoyi.oa.service.ICmcUserHistoryService;

/**
 * 用户历史Service业务层处理
 * 
 * @author cmc
 * @date 2024-02-28
 */
@Service
public class CmcUserHistoryServiceImpl implements ICmcUserHistoryService 
{
    @Autowired
    private CmcUserHistoryMapper cmcUserHistoryMapper;

    /**
     * 查询用户历史
     * 
     * @param userId 用户历史主键
     * @return 用户历史
     */
    @Override
    public CmcUserHistory selectCmcUserHistoryByUserId(Long userId)
    {
        return cmcUserHistoryMapper.selectCmcUserHistoryByUserId(userId);
    }

    /**
     * 查询用户历史列表
     * 
     * @param cmcUserHistory 用户历史
     * @return 用户历史
     */
    @Override
    public List<CmcUserHistory> selectCmcUserHistoryList(CmcUserHistory cmcUserHistory)
    {
        return cmcUserHistoryMapper.selectCmcUserHistoryList(cmcUserHistory);
    }

    /**
     * 新增用户历史
     * 
     * @param cmcUserHistory 用户历史
     * @return 结果
     */
    @Override
    public int insertCmcUserHistory(CmcUserHistory cmcUserHistory)
    {
        return cmcUserHistoryMapper.insertCmcUserHistory(cmcUserHistory);
    }

    /**
     * 修改用户历史
     * 
     * @param cmcUserHistory 用户历史
     * @return 结果
     */
    @Override
    public int updateCmcUserHistory(CmcUserHistory cmcUserHistory)
    {
        cmcUserHistory.setUpdateTime(DateUtils.getNowDate());
        return cmcUserHistoryMapper.updateCmcUserHistory(cmcUserHistory);
    }

    /**
     * 批量删除用户历史
     * 
     * @param userIds 需要删除的用户历史主键
     * @return 结果
     */
    @Override
    public int deleteCmcUserHistoryByUserIds(Long[] userIds)
    {
        return cmcUserHistoryMapper.deleteCmcUserHistoryByUserIds(userIds);
    }

    /**
     * 删除用户历史信息
     * 
     * @param userId 用户历史主键
     * @return 结果
     */
    @Override
    public int deleteCmcUserHistoryByUserId(Long userId)
    {
        return cmcUserHistoryMapper.deleteCmcUserHistoryByUserId(userId);
    }
}
