package tech.glinfo.enbao.modules.sh.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import tech.glinfo.enbao.modules.sh.entity.ShDeviceDataEntity;
import tech.glinfo.enbao.modules.sh.entity.ShDeviceEntity;

import java.util.List;

/**
 * @author linyetong
 * @date 2020/1/13 9:32
 */
@Mapper
public interface OtherShDeviceDao extends BaseMapper<ShDeviceEntity> {

    @Select("<script>" +
            "SELECT * FROM sh_device_data a, sh_device b WHERE a.device_id = b.id AND b.numbering = #{numbering}" +
            " </script>")
    ShDeviceDataEntity getDeviceDataByNumbering(String numbering);

    @Select("<script>" +
            "SELECT * FROM sh_device a WHERE a.user_id = ${userId} AND a.relat_house = 0" +
            " </script>")
    List<ShDeviceEntity> getDeviceByFlag(Integer userId);

}
