 package com.huimv.management.controller;

import java.util.Arrays;
import java.util.Map;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.huimv.management.entity.BaseFeedFormulaEntity;
import com.huimv.management.service.BaseFeedFormulaService;
import com.huimv.common.utils.PageUtils;
import com.huimv.common.utils.R;



/**
 * 
 *
 * @author yinhao
 * @email yinhao@163.com
 * @date 2021-06-15 17:09:40
 */
@Api(tags = "饲料种类配方表")
@RestController
@RequestMapping("management/basefeedformula")
public class BaseFeedFormulaController {
    @Autowired
    private BaseFeedFormulaService baseFeedFormulaService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = baseFeedFormulaService.queryPage(params);
        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		BaseFeedFormulaEntity baseFeedFormula = baseFeedFormulaService.getById(id);

        return R.ok().put("baseFeedFormula", baseFeedFormula);
    }



    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody BaseFeedFormulaEntity baseFeedFormula){
		baseFeedFormulaService.save(baseFeedFormula);

        return R.ok();
    }






    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody BaseFeedFormulaEntity baseFeedFormula){
		baseFeedFormulaService.updateById(baseFeedFormula);

        return R.ok();
    }



    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		baseFeedFormulaService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
