package com.huimv.produce.produce.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huimv.common.utils.Result;
import com.huimv.common.utils.ResultCode;
import com.huimv.produce.produce.entity.ProdGoodsWarning;
import com.huimv.produce.produce.service.IProdGoodsWarningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author astupidcoder
 * @since 2021-11-25
 */
@RestController
@RequestMapping("/prodGoodsWarning")
public class ProdGoodsWarningController {
    @Autowired
    private IProdGoodsWarningService goodsWarningService;

    @PostMapping("listGoodsWarning")
    public Result listGoodsWarning(@RequestBody Map<String, Integer> map){
        Integer current = map.get("current");
        Integer farmId = map.get("farmId");
        Integer size = map.get("size");
        QueryWrapper<ProdGoodsWarning> wrapper = new QueryWrapper<>();
        wrapper.eq("farm_id", farmId);
        Page<ProdGoodsWarning> page = goodsWarningService.page(new Page<>(current, size), wrapper);

        return new Result(ResultCode.SUCCESS,page);
    }
}
