package com.casic.missiles.modular.alarm.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.casic.missiles.modular.alarm.service.IAlarmRecordsService;
import com.casic.missiles.modular.system.model.AlarmRecords;
import com.casic.missiles.core.datascope.DataScope;
import com.casic.missiles.core.util.EhcacheConstant;
import com.casic.missiles.core.util.ToolUtil;
import com.casic.missiles.modular.system.dao.AlarmRecordsMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author casic123
 * @since 2019-05-17
 */
@Service
public class AlarmRecordsServiceImpl extends ServiceImpl<AlarmRecordsMapper, AlarmRecords> implements IAlarmRecordsService {

    @Resource
    AlarmRecordsMapper alarmRecordsMapper;
    @Override
    public List<AlarmRecords> alarmList(Page<AlarmRecords> page, String keywords, String beginTime, String endTime, String status, String alarmType, String alarmContent, DataScope dataScope) {
        String sContent = null;
        if (ToolUtil.isNotEmpty(alarmContent))
            sContent = EhcacheConstant.retBean().getAlarmContentName(Integer.valueOf(alarmContent));

        return this.baseMapper.alarmList(page,keywords,beginTime,endTime,status,alarmType,sContent,dataScope);
    }
        @Override
    public List<AlarmRecords> alarmListAll(Page<AlarmRecords> page, String keywords, String beginTime, String endTime, String status, String alarmType, String alarmContent, DataScope dataScope) {
        String sContent = null;
        if (ToolUtil.isNotEmpty(alarmContent))
            sContent = EhcacheConstant.retBean().getAlarmContentName(Integer.valueOf(alarmContent));

        return this.baseMapper.alarmListAll(page,keywords,beginTime,endTime,status,alarmType,sContent,dataScope);
    }

    @Override
    public void pushOpen(Long id, String pushOpen) {
        this.baseMapper.pushOpen(id,pushOpen);
    }
}
