package com.fdkankan.goods.mapper;

import com.fdkankan.goods.entity.CameraSpace;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fdkankan.user.vo.ResponseCameraSpace;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 相机容量表 Mapper 接口
 * </p>
 *
 * @author 
 * @since 2021-12-24
 */
@Mapper
public interface ICameraSpaceMapper extends BaseMapper<CameraSpace> {

    @Select(" select s.id, s.space_end_time, c.child_name, s.space from t_camera_space s " +
            "LEFT JOIN t_camera c on s.camera_id = c.id where s.rec_status = 'A' and " +
            "s.space_type = 2 and s.camera_id = #{cameraId} and TIMESTAMPDIFF(MINUTE, NOW(), s.space_end_time) > -1 ORDER BY s.space_end_time ")
    List<ResponseCameraSpace> getVoListByCameraId(@Param("cameraId")Long cameraId);
}
