package com.usky.fire.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.usky.fire.domain.DemFireSafetyInspection;
import com.usky.fire.mapper.DemFireSafetyInspectionMapper;
import com.usky.fire.service.DemFireSafetyInspectionService;
import com.usky.common.mybatis.core.AbstractCrudService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 消防安全检查记录表 服务实现类
 * </p>
 *
 * @author han
 * @since 2023-10-25
 */
@Service
public class DemFireSafetyInspectionServiceImpl extends AbstractCrudService<DemFireSafetyInspectionMapper, DemFireSafetyInspection> implements DemFireSafetyInspectionService {

    @Override
    public List<DemFireSafetyInspection> fireSafetyInspectionScatter(){
        LambdaQueryWrapper<DemFireSafetyInspection> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.orderByDesc(DemFireSafetyInspection::getCheckTime)
                .last("limit 500");
        List<DemFireSafetyInspection> list = this.list(queryWrapper);

        return list;
    }
}
