package com.zksy.environmentHJ212.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zksy.common.core.domain.Result;
import com.zksy.common.utils.SearchUtil;
import com.zksy.environmentHJ212.domain.po.MinuteDataInfo;
import com.zksy.environmentHJ212.service.MinuteDataInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Administrator
 * @version 1.0
 * @project zksy-iot-service
 * @description HJ212分钟数据
 * @date 2025/5/6 16:51:27
 */
@RestController
@RequestMapping("/minuteDataInfo")
@Api(tags = "环境分钟数据", description = "环境分钟数据")
public class MinuteDataInfoController {
    @Autowired
    private MinuteDataInfoService service;

    @GetMapping("/findByPage")
    @ApiOperation(value = "分页查询")
    public Result getMinuteDataPage(long pageNum, long pageSize, String conditionJson) throws Exception {
        Page<MinuteDataInfo> page = service.page(new Page<>(pageNum, pageSize), SearchUtil.parseWhereSql(conditionJson));
        return Result.ok(page);
    }
    @GetMapping("/getAll")
    @ApiOperation(value = "查询所有")
    public Result getAllByConditionJson(String conditionJson) throws Exception {
        List<MinuteDataInfo> list = service.list(SearchUtil.parseWhereSql(conditionJson));
        return Result.ok(list);
    }
}
