package com.dgtly.system.service.impl;

import java.util.List;
import com.dgtly.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dgtly.system.mapper.AlertLogMapper;
import com.dgtly.system.domain.AlertLog;
import com.dgtly.system.service.IAlertLogService;
import com.dgtly.common.core.text.Convert;

/**
 * 弹框日志Service业务层处理
 * 
 * @author chenyn
 * @date 2023-06-13
 */
@Service
public class AlertLogServiceImpl implements IAlertLogService 
{
    @Autowired
    private AlertLogMapper alertLogMapper;

    /**
     * 查询弹框日志
     * 
     * @param alertLogId 弹框日志ID
     * @return 弹框日志
     */
    @Override
    public AlertLog selectAlertLogById(Long alertLogId)
    {
        return alertLogMapper.selectAlertLogById(alertLogId);
    }

    @Override
    public AlertLog selectAlertLogByUserId(Long userId) {
        return alertLogMapper.selectAlertLogByUserId(userId);
    }

    @Override
    public AlertLog selectAlertLogByUserIdAndAlertId(Long userId,Long alertId,String isCacheType,String userType) {
        return alertLogMapper.selectAlertLogByUserIdAndAlertId(userId,alertId,isCacheType,userType);
    }

    /**
     * 查询弹框日志列表
     * 
     * @param alertLog 弹框日志
     * @return 弹框日志
     */
    @Override
    public List<AlertLog> selectAlertLogList(AlertLog alertLog)
    {
        return alertLogMapper.selectAlertLogList(alertLog);
    }

    /**
     * 新增弹框日志
     * 
     * @param alertLog 弹框日志
     * @return 结果
     */
    @Override
    public int insertAlertLog(AlertLog alertLog)
    {
        alertLog.setCreateTime(DateUtils.getNowDate());
        return alertLogMapper.insertAlertLog(alertLog);
    }

    /**
     * 修改弹框日志
     * 
     * @param alertLog 弹框日志
     * @return 结果
     */
    @Override
    public int updateAlertLog(AlertLog alertLog)
    {
        alertLog.setUpdateTime(DateUtils.getNowDate());
        return alertLogMapper.updateAlertLog(alertLog);
    }

    /**
     * 删除弹框日志对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAlertLogByIds(String ids)
    {
        return alertLogMapper.deleteAlertLogByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除弹框日志信息
     * 
     * @param alertLogId 弹框日志ID
     * @return 结果
     */
    @Override
    public int deleteAlertLogById(Long alertLogId)
    {
        return alertLogMapper.deleteAlertLogById(alertLogId);
    }
}
