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

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuchen.saas.park.api.vo.fault.EquipmentPictureAnalyseVo;
import com.yuchen.saas.park.service.fault.service.EquipmentPictureAnalyseService;
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.RestController;

import javax.annotation.Resource;

/**
 * @Author: 肖润飞
 * @CreateTime: 2022/10/19 16:23
 * @Description: 设备画像分析
 * @Version: 1.0
 */
@RestController
@RequestMapping("/equipment_breakdown/analyse")
@Api(tags = "设备画像分析", value = "设备画像分析")
public class EquipmentPictureAnalyseController {

    @Resource
    private EquipmentPictureAnalyseService pictureAnalyseService;

    /**
     * 异常分析 -> 获得画像分析分页数据
     *
     * @param query
     * @param vo    设备
     * @return
     */
    @GetMapping("/analyse_page")
    @ApiOperation(value = "设备画像分析分页", notes = "设备画像分析分页(根据自身分页)")
    public R analysePage(Query query, EquipmentPictureAnalyseVo vo) {
        Page page = (Page) Condition.getPage(query);
        R r = pictureAnalyseService.analysePage(page, vo);
        return r;
    }

    /**
     * 异常分析->获得画像分析分页数据
     *
     * @param id 设备画像分析id
     * @return
     */
    @GetMapping("/history_list")
    @ApiOperation(value = "设备画像分析分页", notes = "设备画像分析分页(根据状态id分页)")
    public R page(Query query, Long id) {
        Page page = (Page) Condition.getPage(query);
        R r = pictureAnalyseService.pageHistory(page, id);
        return r;
    }

}