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.enterprise.domain.FaultType;
import com.muyu.enterprise.mapper.FaultTypeMapper;
import com.muyu.enterprise.service.FaultTypeService;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * 故障类型业务实现层
 * @Author: chenruijia
 * @Date 2024/9/28 12.19
 * @Description FaultTypeServiceImpl:故障类型业务实现层
 */
@Service
public class FaultTypeServiceImpl extends ServiceImpl<FaultTypeMapper, FaultType> implements FaultTypeService {
    @Override
    public List<FaultType> faultTypeList(FaultType faultType) {
        LambdaQueryWrapper<FaultType> queryWrapper = new LambdaQueryWrapper<>();
        if (StringUtils.isNotEmpty(faultType.getFaultTypeName())) {
            queryWrapper.like(FaultType::getFaultTypeName,faultType.getFaultTypeName());
        }
        if (StringUtils.isNotEmpty(faultType.getFaultTypeDescription())) {
            queryWrapper.like(FaultType::getFaultTypeDescription,faultType.getFaultTypeDescription());
        }
        return this.list(queryWrapper);
    }

    @Override
    public List<FaultType> typeDatailOne(Long faultTypeId) {
        LambdaQueryWrapper<FaultType> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(FaultType::getFaultTypeId,faultTypeId);
        return this.list(queryWrapper);
    }
}
