 package com.huimv.acquisition.controller;

 import com.huimv.acquisition.entity.BasePigpenEntity;
 import com.huimv.acquisition.result.R;
 import com.huimv.acquisition.service.BasePigpenService;
 import com.huimv.acquisition.utils.PageUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;

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


 /**
 * 栋舍表
 *
 * @author yinhao
 * @version ${version}
 * @date 2021-07-30 16:02:09
 */
@RestController
@RequestMapping("management/basepigpen")
@CrossOrigin
public class BasePigpenController {
    @Autowired
    private BasePigpenService basePigpenService;

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

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


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
		BasePigpenEntity basePigpen = basePigpenService.getById(id);

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

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody BasePigpenEntity basePigpen){
		basePigpenService.save(basePigpen);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody BasePigpenEntity basePigpen){
		basePigpenService.updateById(basePigpen);

        return R.ok();
    }

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

        return R.ok();
    }

}
