package com.usky.ids.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.usky.common.security.utils.SecurityUtils;
import com.usky.ids.domain.AccessAlarm;
import com.usky.ids.mapper.AccessAlarmMapper;
import com.usky.ids.service.AccessAlarmService;
import com.usky.common.mybatis.core.AbstractCrudService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 报警信息表 服务实现类
 * </p>
 *
 * @author han
 * @since 2025-03-01
 */
@Service
public class AccessAlarmServiceImpl extends AbstractCrudService<AccessAlarmMapper, AccessAlarm> implements AccessAlarmService {
    public List<AccessAlarm> getAlarmList(String deviceId){
        LambdaQueryWrapper<AccessAlarm> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.select(AccessAlarm::getAlarmId)
                .eq(AccessAlarm::getCameraIndexCode, deviceId)
                .eq(AccessAlarm::getAlarmType,'2')
                .eq(AccessAlarm::getAlarmStatus,'0')
                .last("limit 1");
        List<AccessAlarm> list = this.list(queryWrapper);
        return list;
    }
}
