package cn.cecep.talroad.service.impl;

import cn.cecep.talroad.domain.BEnterpriseIrBusinessAlerts;
import cn.cecep.talroad.mapper.BEnterpriseIrBusinessAlertsMapper;
import cn.cecep.talroad.service.IBEnterpriseIrBusinessAlertsService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.util.List;
import java.util.Map;




/**
 * 通知提醒-业务提醒Service业务层处理
 *
 * @author szhpt
 * @date 2023-03-14*/
@Service
public class BEnterpriseIrBusinessAlertsServiceImpl extends ServiceImpl<BEnterpriseIrBusinessAlertsMapper,BEnterpriseIrBusinessAlerts> implements IBEnterpriseIrBusinessAlertsService
{
    @Autowired
    private BEnterpriseIrBusinessAlertsMapper bEnterpriseIrBusinessAlertsMapper;

    /**
     * 查询通知提醒-业务提醒列表
     *
     * @param bEnterpriseIrBusinessAlerts 通知提醒-业务提醒
     * @return 通知提醒-业务提醒
     */
    @Override
    public List<BEnterpriseIrBusinessAlerts> selectBEnterpriseIrBusinessAlertsList(BEnterpriseIrBusinessAlerts bEnterpriseIrBusinessAlerts)
    {
        bEnterpriseIrBusinessAlerts.setDelFlag("0");
        return bEnterpriseIrBusinessAlertsMapper.selectBEnterpriseIrBusinessAlertsList(bEnterpriseIrBusinessAlerts);
    }

    @Override
    public List<Map<String, String>> selectOptions(String factoryId) {
        return bEnterpriseIrBusinessAlertsMapper.selectOptions(factoryId);
    }

    @Override
    public Integer countByFactoryId(String factoryId){
        Assert.notNull(factoryId, "企业ID不存在");
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("factory_id", factoryId);
        return bEnterpriseIrBusinessAlertsMapper.selectCount(wrapper);
    }
}
