package com.fs.watch.controller;

import com.fs.common.core.domain.AjaxResult;
import com.fs.common.utils.StringUtils;
import com.fs.watch.domain.WatchDeviceInfo;
import com.fs.watch.service.*;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@Api("腕表接口")
@RestController
@RequestMapping(value="/watch/get")
public class WatchGetDataController{
    @Autowired
    private WatchDeviceInfoService deviceInfoService;

    /**
     * 修改设备硬件信息
     */
    @PostMapping("/watchDeviceInfo/update")
    public AjaxResult watchDeviceInfoUpdate(@RequestBody WatchDeviceInfo data) {
        // 根据具体数据类型选择对应的服务
        if (StringUtils.isBlank(data.getDeviceNumber())){
            return AjaxResult.error();
        }
        return deviceInfoService.updateByDeviceNumber(data)>0?AjaxResult.success():AjaxResult.error();
    }

    /**
     * 删除设备硬件信息
     */
    @DeleteMapping("/watchDeviceInfo/remove")
    public AjaxResult watchDeviceInfoRemove(@RequestParam("deviceNums") String deviceNums) {
        return deviceInfoService.remove(deviceNums)>0?AjaxResult.success():AjaxResult.error();
    }


}
