package com.yuchen.saas.park.service.fault.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuchen.saas.park.api.vo.fault.EquipmentStatusVo;
import com.yuchen.saas.park.service.fault.service.EquipmentStatusService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.nest.springwrap.core.mp.support.Condition;
import org.nest.springwrap.core.mp.support.Query;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author: 肖润飞
 * @CreateTime: 2022/10/19 11:49
 * @Description: 设备状态
 * @Version: 1.0
 */
@RestController
@RequestMapping("/equipment_status")
@Api(tags = "设备状态", value = "设备状态")
public class EquipmentStatusController {


    @Resource
    private EquipmentStatusService equipmentStatusService;


    @GetMapping("/page")
    @ApiOperation(value = "设备故状态页", notes = "设备故状态页")
    public R page(Query query, EquipmentStatusVo vo) {
        Page page = (Page) Condition.getPage(query);
        R r = equipmentStatusService.pageStatus(page, vo);
        return r;
    }

    /**
     * 状态详情
     *
     * @param id 状态id
     * @return
     */
    @GetMapping("/detail")
    @ApiOperation(value = "设备故状态详情", notes = "设备故状态详情")
    public R detail(@RequestParam Long id) {
        R r = equipmentStatusService.detail(id);
        return r;
    }

}