package com.huimv.admin.controller;


import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.huimv.admin.common.utils.Result;
import com.huimv.admin.service.IBasePigpenService;
import com.huimv.admin.service.IEnvWarningThresholdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2023-02-13
 */
@RestController
@RequestMapping("/envWarningThreshold")
@CrossOrigin
public class EnvWarningThresholdController {
    @Autowired
    private IBasePigpenService basePigpenService;
    @Autowired
    private IEnvWarningThresholdService thresholdService;


 /*   @RequestMapping(value = "/list",method = RequestMethod.POST)
    public Result list(@RequestBody Map<String, Object> paramsMap) {
        System.out.println("paramsMap>>"+paramsMap.toString());
        String farmCode = "";
        if (paramsMap.get("farmId") != null) {
            farmCode = paramsMap.get("farmId")+"";
        }
        String stageCode = "";
        if (paramsMap.get("stageCode") != null) {
            stageCode = paramsMap.get("stageCode")+"";
        }
        String pigpenName = "";
        if (paramsMap.get("pigpenName") != null) {
            pigpenName = paramsMap.get("pigpenName")+"";
        }
        return basePigpenService.list(farmCode,pigpenName,stageCode);
    }
*/

    @PostMapping("/list")
    public Result ThresholdList(HttpServletRequest httpServletRequest, @RequestBody()Map<String,String> paramsMap) {
        return thresholdService.list(httpServletRequest,paramsMap);
    }

    @PostMapping("/add")
    public Result ThresholdAdd(HttpServletRequest httpServletRequest, @RequestBody()Map<String,String> paramsMap) {
        return thresholdService.add(httpServletRequest,paramsMap);
    }
}
