 package com.huimv.management.controller;

import java.util.*;

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.management.entity.EartagDateEntity;
import com.huimv.management.service.EartagDateService;
import com.huimv.common.utils.PageUtils;
import com.huimv.common.utils.R;

import static java.lang.Thread.sleep;


 /**
 * 
 *
 * @author yinhao
 * @email yinhao@163.com
 * @date 2021-06-21 10:00:18
 */
@RestController
@RequestMapping("management/eartagdate")
public class EartagDateController {
    @Autowired
    private EartagDateService eartagDateService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params) throws InterruptedException {
        PageUtils page = eartagDateService.queryPage(params);
        return R.ok().put("page", page);
    }


     @RequestMapping("/searchDateByCondition")
     public R listby(@RequestParam Map<String, Object> params) throws InterruptedException {
         Map ResultMap = eartagDateService.queryPageBytimeAndEartag(params);
         return R.ok().put("page", ResultMap);
     }




     /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		EartagDateEntity eartagDate = eartagDateService.getById(id);

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

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody EartagDateEntity eartagDate){
		eartagDateService.save(eartagDate);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody EartagDateEntity eartagDate){
		eartagDateService.updateById(eartagDate);

        return R.ok();
    }

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

        return R.ok();
    }


     @RequestMapping("/getTemperatureCurve")
     public R getTemperatureCurve(@RequestParam Map<String, Object> params){

         return R.ok().put("data", eartagDateService.getTemperatureCurve(params));
     }

}
