package com.gyee.wisdom.alarm.sharding.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gyee.wisdom.alarm.sharding.entity.Alertrule2;
import com.gyee.wisdom.alarm.sharding.entity.Scadabj;
import com.gyee.wisdom.alarm.sharding.entity.Scadafault;
import com.gyee.wisdom.alarm.sharding.mapper.ScadabjMapper;
import com.gyee.wisdom.alarm.sharding.mapper.ScadafaultMapper;
import com.gyee.wisdom.alarm.sharding.util.SnowflakeGenerator;
import com.gyee.wisdom.alarm.sharding.util.UUIDUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ScadafaultService  extends ServiceImpl<ScadafaultMapper, Scadafault> {
    @Autowired
    private ScadafaultMapper scadafaultMapper;

    public int saveAndUpdateScadafault(Scadafault scadafault) {
        if (scadafault.getId() == null || scadafault.getId() <=0)
        {
            return scadafaultMapper.insert(scadafault);
        } else
            return scadafaultMapper.updateById(scadafault);
    }

    public int deleteScadafault(Scadafault scadafault){
        return scadafaultMapper.deleteById(scadafault.getId());
    }

    public IPage<Scadafault> pageQueryAll(Page page){
        return scadafaultMapper.pageQueryAll(page);
    }
}
