package com.rongwei.bscommon.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rongwei.bscommon.sys.dao.EquMaintenanceStandardDao;
import com.rongwei.bscommon.sys.service.EquMaintenanceStandardService;
import com.rongwei.bsentity.domain.EquMaintenanceStandardDo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * @author shangmi
 * @title EquMaintenanceStandardServiceImpl
 * @date 2023/11/28 15:29
 * @description 保养标准库业务实现类
 */
@Service
public class EquMaintenanceStandardServiceImpl extends ServiceImpl<EquMaintenanceStandardDao,EquMaintenanceStandardDo> implements EquMaintenanceStandardService {

    @Autowired
    private EquMaintenanceStandardDao maintenanceStandardDao;

    @Override
    public List<EquMaintenanceStandardDo> getPlanTypeByList(String equipmentId) {
        LambdaQueryWrapper<EquMaintenanceStandardDo> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(EquMaintenanceStandardDo::getEquipmentId, Arrays.asList(equipmentId.split(",")))
                .eq(EquMaintenanceStandardDo::getDeleted,0);

        return maintenanceStandardDao.selectList(queryWrapper);
    }
    @Override
    public List<EquMaintenanceStandardDo> getUniqueDateByAll() {
        LambdaQueryWrapper<EquMaintenanceStandardDo> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.select(EquMaintenanceStandardDo::getEquipmenttype,
                EquMaintenanceStandardDo::getTenantid,
                EquMaintenanceStandardDo::getMaintenancecontext,
                EquMaintenanceStandardDo::getMaintenancesite,
                EquMaintenanceStandardDo::getMaintenancetype);
        return maintenanceStandardDao.selectList(queryWrapper);
    }
}
