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

import cn.com.ty.lift.business.maintenance.dao.entity.MaintenanceOption;
import cn.com.ty.lift.business.maintenance.dao.mapper.MaintenanceOptionMapper;
import cn.com.ty.lift.common.utils.ValuePool;
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-17
 */
@Service
public class MaintenanceOptionService extends ServiceImpl<MaintenanceOptionMapper, MaintenanceOption> {

    /**
     * 根据维保项类型，电梯类型，维保公司id查询维保项
     * @param type 维保类型
     * @param liftCategory 电梯类别
     * @param mtCompanyId 维保公司id
     * @return List<MaintenanceOption>
     */
    public List<MaintenanceOption> listByTypeAndLiftCategory(Integer type, Integer liftCategory, Long mtCompanyId) {
        LambdaQueryWrapper<MaintenanceOption> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.in(MaintenanceOption::getMtCompanyId, Arrays.asList(ValuePool.PLATFORM_IDENTIFICATION, mtCompanyId));
        lambdaQueryWrapper.eq(MaintenanceOption::getType, type);
        lambdaQueryWrapper.eq(MaintenanceOption::getLiftCategory, liftCategory);
        return list(lambdaQueryWrapper);
    }
}
