package cn.com.ty.lift.business.emergency.service;

import cn.com.ty.lift.business.emergency.entity.LiftFault;
import cn.com.ty.lift.business.emergency.mapper.LiftFaultMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * <p>
 *  电梯故障项 服务实现类
 * </p>
 *
 * @author wcz
 * @since 2020-01-02
 */
@Service
public class LiftFaultService extends ServiceImpl<LiftFaultMapper, LiftFault> {

    /**
     * 根据电梯类别查询故障信息 1 直梯 2扶梯
     * @param liftCategory 电梯类别
     * @return List<LiftFault>
     */
    public List<LiftFault> listByLiftCategory(Integer liftCategory) {
        LambdaQueryWrapper<LiftFault> lambdaQueryWrapper = Wrappers.lambdaQuery();
        // 0 公共故障项
        lambdaQueryWrapper.in(LiftFault::getLiftCategory,Arrays.asList(0,liftCategory));
        return list(lambdaQueryWrapper);
    }
}
