package cn.pluss.platform.device;

import cn.pluss.platform.entity.DeviceSpec;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;

/**
 * <p>
 * 设备规格表 服务类
 * </p>
 *
 * @author Djh
 * @since 2022-03-04
 */
public interface DeviceSpecService extends IService<DeviceSpec> {

    default DeviceSpec getByCodeAndSpec(String code, String spec) {
        LambdaQueryWrapper<DeviceSpec> qWrapper = Wrappers.lambdaQuery();
        qWrapper.eq(DeviceSpec::getCode, code);
        qWrapper.eq(DeviceSpec::getSpec, spec);

        return getOne(qWrapper);
    }

    default List<DeviceSpec> listByCode(String code) {
        LambdaQueryWrapper<DeviceSpec> qWrapper = Wrappers.lambdaQuery();
        qWrapper.eq(DeviceSpec::getCode, code);

        return list(qWrapper);
    }
}
