 package com.huimv.acquisition.controller;

import java.util.Arrays;
import java.util.Map;

import com.huimv.acquisition.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huimv.acquisition.entity.HeartBeatRecordEntity;
import com.huimv.acquisition.service.HeartBeatRecordService;

import com.huimv.acquisition.result.R;


/**
 * 
 *
 * @author yinhao
 * @version ${version}
 * @date 2021-11-10 16:19:11
 */
@RestController
@RequestMapping("acquisition/heartbeatrecord")
public class HeartBeatRecordController {
    @Autowired
    private HeartBeatRecordService heartBeatRecordService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = heartBeatRecordService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		HeartBeatRecordEntity heartBeatRecord = heartBeatRecordService.getById(id);

        return R.ok().put("heartBeatRecord", heartBeatRecord);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody HeartBeatRecordEntity heartBeatRecord){
		heartBeatRecordService.save(heartBeatRecord);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody HeartBeatRecordEntity heartBeatRecord){
		heartBeatRecordService.updateById(heartBeatRecord);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		heartBeatRecordService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
