package com.gyee.alarm.mapper.auto;

import com.gyee.alarm.model.auto.ProBasicDeviceModel;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 设备模型 Mapper 接口
 * </p>
 *
 * @author shilin
 * @since 2023-08-01
 */
public interface ProBasicDeviceModelMapper extends BaseMapper<ProBasicDeviceModel> {

    @Select({"<script>",
            "select * from pro_basic_device_model a ",
            "<where>",
            "<if test='orderno !=null '>",
            "and a.orderno=#{orderno}",
            "</if>",
            "</where>",

            "</script>"})
    List<ProBasicDeviceModel> getDeviceModelsById(@Param("orderno")String orderno);
    @Select({"<script>",
            "select * from pro_basic_device_model a ",
            "<where>",
            "<if test='deviceId !=null' >",
            "and a.device_id=#{deviceId}",
            "</if>",
            "<if test='code !=null '>",
            "and a.code=#{code}",
            "</if>",
            "</where>",

            "</script>"})
    ProBasicDeviceModel getDeviceModelByCode(@Param("deviceid")String deviceid,
                                     @Param("code")String code);
}
