package com.huimv.produce.produce.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.huimv.common.utils.Result;
import com.huimv.common.utils.ResultCode;
import com.huimv.produce.produce.entity.ProdSowPigletStatus;
import com.huimv.produce.produce.service.IProdSowPigletStatusService;
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.Date;
import java.util.List;

/**
 * <p>
 *  母猪和猪仔状态
 * </p>
 *
 * @author astupidcoder
 * @since 2021-11-25
 */
@RestController
@RequestMapping("/prodSowPigletStatus")
public class ProdSowPigletStatusController {
    @Autowired
    private IProdSowPigletStatusService sowPigletStatusService;

    @GetMapping("/listSowPiglet")
    public Result getClistSowPigletost(@RequestParam(name = "farmId") Integer farmId){
        List<ProdSowPigletStatus> list = sowPigletStatusService.list(new QueryWrapper<ProdSowPigletStatus>().eq("farm_id", farmId).eq("add_date", new Date()));
        return new Result(ResultCode.SUCCESS,list);
    }
}
