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.FaultInfo;
import com.muyu.enterprise.mapper.FaultInfoMapper;
import com.muyu.enterprise.service.FaultInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * @Author：ChenYan
 * @Project：2112-car-cloud-server
 * @Package：com.muyu.fault.service.impl
 * @Filename：IFaultInfoServiceImpl
 * @Description TODO
 * @Date：2024/9/19 22:16
 */
@Service
public class FaultInfoServiceImpl extends ServiceImpl<FaultInfoMapper, FaultInfo> implements FaultInfoService {

    @Autowired
    private FaultInfoMapper faultInfoMapper;

    /**
     *
     * @param faultInfo 车辆故障管理主键
     * @return  fault
     */
    @Override
    public List<FaultInfo> pageQuery(FaultInfo faultInfo) {
        LambdaQueryWrapper<FaultInfo> queryWrapper = new LambdaQueryWrapper<>();
        if (StringUtils.isNotEmpty(faultInfo.getFaultCode())) {
            queryWrapper.like(FaultInfo::getFaultCode, faultInfo.getFaultCode());
        }
        if (StringUtils.isNotEmpty(faultInfo.getFaultType())) {
            queryWrapper.like(FaultInfo::getFaultType, faultInfo.getFaultType());
        }
        if (StringUtils.isNotEmpty(faultInfo.getGroupName())) {
            queryWrapper.like(FaultInfo::getGroupName, faultInfo.getGroupName());
        }

        return this.list(queryWrapper);
    }
}
