package com.muyu.enterprise.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.domain.WarnLogs;
import com.muyu.enterprise.mapper.WarnLogsMapper;
import com.muyu.enterprise.service.WarnLogsService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WarnLogsServiceImpl extends ServiceImpl<WarnLogsMapper,WarnLogs> implements WarnLogsService {
    @Override
    public List<WarnLogs> logsList(WarnLogs warnLogs) {
        LambdaQueryWrapper<WarnLogs> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(
                StringUtils.isNotEmpty(warnLogs.getVin()),
                WarnLogs::getVin,warnLogs.getVin()
        );
        queryWrapper.eq(
                StringUtils.isNotEmpty(String.valueOf(warnLogs.getWarnRuleId())),
                WarnLogs::getWarnRuleId,warnLogs.getWarnRuleId()
        );
        return baseMapper.selectList(queryWrapper);
    }
}
