package com.huimv.produce.warning.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.huimv.common.utils.DataUill;
import com.huimv.common.utils.Result;
import com.huimv.common.utils.ResultCode;
import com.huimv.produce.warning.entity.ProdWarningMsg;
import com.huimv.produce.warning.service.IProdWarningMsgService;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  预警信息表
 * </p>
 *
 * @author astupidcoder
 * @since 2021-11-25
 */
@RestController
@RequestMapping("/prodWarningMsg")
public class ProdWarningMsgController {
    @Autowired
    private IProdWarningMsgService warningMsgService;

    @GetMapping("/listWarningMsg")
    public Result listWarningMsg(@RequestParam(name = "farmId") Integer farmId){
        List<ProdWarningMsg> list = warningMsgService.list(new QueryWrapper<ProdWarningMsg>().eq("farm_id", farmId).eq("add_time", DataUill.getTimesmorning()).orderByDesc("tip_time"));
        return new Result(ResultCode.SUCCESS,list);
    }
}
