package com.ruoyi.web.controller.chenyanlogin.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.web.controller.chenyanlogin.entity.QiXiang;
import com.ruoyi.web.controller.chenyanlogin.service.HuiCunService;
import com.ruoyi.web.controller.chenyanlogin.service.IQiXiangService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

import static com.ruoyi.common.core.domain.AjaxResult.success;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2025-09-29
 */
@RestController
@RequestMapping("/qi-xiang")
public class QiXiangController {
    @Autowired
    private IQiXiangService qiXiangService;

    @ApiOperation("获取最近气象接口")
    @GetMapping("/getLastQiXiang")
    public AjaxResult getBasicData(){

        return success(qiXiangService.getOne(new QueryWrapper<QiXiang>().orderByDesc("id").last("limit 1")));

    }


    @ApiOperation("获取温湿度曲线")
    @PostMapping("/getListQiXiang")
    public AjaxResult getListQiXiang(@RequestBody Map<String,String> map){

        return success(qiXiangService.getListQiXiang(map));

    }

}
