package com.gyee.wisdom.alarm.sharding.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gyee.wisdom.alarm.sharding.entity.TestingPointDI;
import com.gyee.wisdom.alarm.sharding.service.TestingPointDIService;
import com.gyee.wisdom.alarm.sharding.util.ResponseWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

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

/**
 * @description:
 * @auther: Wanghs
 * @date: 2022-04-08
 */
@Slf4j
@RestController
@RequestMapping("/testingpointDI")
@CrossOrigin
@Api(tags = {"TestingPointDI数据接口"})
public class TestingPointDIController {

    @Autowired
    private TestingPointDIService testingPointDIService;

    @ApiOperation("获取所有子型号")
    @GetMapping("/model")
    public ResponseWrapper getModel() {
        List<String> model = testingPointDIService.getModel();
        ResponseWrapper wrapper = ResponseWrapper.success("查询成功", model);
        return wrapper;
    }

    @RequestMapping(value = "/point")
    @ResponseBody
    @ApiOperation("根据子型号获取测点")
    public ResponseWrapper getTestingPointDIByModel(
            @ApiParam(value = "风机子型号如UP82_NSS")   @RequestParam(value = "minModel", required = true) String minModel
    ) {
        List<TestingPointDI> lst = testingPointDIService.getTestingPointDIByMinModelId(minModel);
        ResponseWrapper result = ResponseWrapper.success("查询成功", lst);
        return result;
    }
}
