package com.sw.mes.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sw.mes.domain.ProductionExceptionLog;
import com.sw.mes.service.ProductionExceptionLogService;
import com.sw.mes.mapper.ProductionExceptionLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author JS111816
* @description 针对表【production_exception_log(检验报警信息)】的数据库操作Service实现
* @createDate 2022-06-14 16:56:23
*/
@Service
public class ProductionExceptionLogServiceImpl extends ServiceImpl<ProductionExceptionLogMapper, ProductionExceptionLog>
    implements ProductionExceptionLogService{

    @Autowired
    private ProductionExceptionLogMapper productionExceptionLogMapper;
    @Override
    public List<ProductionExceptionLog> findBySectionNoAndStatus(String sectionNo, boolean b) {
        LambdaQueryWrapper<ProductionExceptionLog> queryWrapper=new LambdaQueryWrapper<>();
        queryWrapper.eq(ProductionExceptionLog::getSectionNo,sectionNo);
        queryWrapper.eq(ProductionExceptionLog::getStatus,b==true?1:0);
        return this.list(queryWrapper);
    }

    @Override
    public int getCount(Integer type) {

        return productionExceptionLogMapper.countAllByTypeAndStatus(type, false);
    }
}




