package com.fs.watch.controller;

import com.fs.common.core.domain.AjaxResult;
import com.fs.watch.domain.WatchThirdBpData;
import com.fs.watch.service.WatchThirdBpDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 三方血压(WatchThirdBpData)表控制层
 *
 * @author makejava
 * @since 2024-08-09 09:47:20
 */
@RestController
@RequestMapping("/watch/third/bp")
public class WatchThirdBpDataController {
    /**
     * 服务对象
     */
    @Autowired
    private WatchThirdBpDataService watchThirdBpDataService;


    @PostMapping("/insert")
    public AjaxResult insertThirdBpData(@RequestBody WatchThirdBpData data){
        return AjaxResult.success(watchThirdBpDataService.insert(data));
    }


    /**
     * 查询某天的数据
     * @param  date 日期
     * @param  deviceId 主键
     * @return 单条数据
     */
    @GetMapping("/queryByDateAndDeviceId")
    public AjaxResult queryByDataAndDeviceId(@RequestParam(value = "date",required = false) String date,
                                             @RequestParam(value = "deviceId") String deviceId) {
        return AjaxResult.success(this.watchThirdBpDataService.queryByDateAndDeviceId(date,deviceId));
    }

}

