package com.yihu.jw.base.dao.device;

import com.yihu.jw.entity.care.device.YsConfigDo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

/**
 * Created by Bing on 2021/10/20.
 */
public interface YsConfigDao extends PagingAndSortingRepository<YsConfigDo,Long>, JpaSpecificationExecutor<YsConfigDo> {

    @Query("select c from YsConfigDo c,YsDeviceDo de where c.configId = de.configId and de.deviceSn = ?1")
    YsConfigDo getYsConfigByDeviceSn(String deviceSn);

    @Query("select c from YsConfigDo c where c.configId=?1")
    YsConfigDo getDefaultConfig(Integer configId);
}
