package com.sundot.airport.web.controller.equipment;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sundot.airport.common.core.controller.BaseController;
import com.sundot.airport.common.core.domain.AjaxResult;
import com.sundot.airport.equipment.domain.EquipmentLedger;
import com.sundot.airport.equipment.service.IEquipmentLedgerService;

/**
 * 设备定/自检
 *
 * @author wangxx
 * @date 2026-05-12
 */
@RestController
@RequestMapping("/equipment/self")
public class EquipmentSelfInspectionRecordController extends BaseController {
    @Autowired
    private IEquipmentLedgerService equipmentLedgerService;

    /**
     * 查询定/自检到期日期已过期的设备列表
     */
    @PreAuthorize("@ss.hasPermi('equipment:self:list')")
    @GetMapping("/expired/list")
    public AjaxResult getExpiredInspectionList() {
        List<EquipmentLedger> list = equipmentLedgerService.selectExpiredInspectionList();
        return success(list);
    }

    /**
     * 查询一月内定/自检到期的设备列表
     */
    @PreAuthorize("@ss.hasPermi('equipment:self:list')")
    @GetMapping("/upcoming/list")
    public AjaxResult getUpcomingInspectionList() {
        List<EquipmentLedger> list = equipmentLedgerService.selectUpcomingInspectionList();
        return success(list);
    }

    /**
     * 查询两周内定/自检到期的设备列表
     */
    @PreAuthorize("@ss.hasPermi('equipment:self:list')")
    @GetMapping("/two-weeks-upcoming/list")
    public AjaxResult getTwoWeeksUpcomingInspectionList() {
        List<EquipmentLedger> list = equipmentLedgerService.selectTwoWeeksUpcomingInspectionList();
        return success(list);
    }
}
