 package com.huimv.acquisition.controller;

 import com.huimv.acquisition.entity.PigBasicInformationEntity;
 import com.huimv.acquisition.result.R;
 import com.huimv.acquisition.service.PigBasicInformationService;
 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-08-11 17:05:02
  */
 @RestController
 @RequestMapping("management/pigbasicinformation")
 public class PigBasicInformationController {
     @Autowired
     private PigBasicInformationService pigBasicInformationService;

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

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


     /**
      * 信息
      */
     @RequestMapping("/info/{id}")
     public R info(@PathVariable("id") Integer id){
         PigBasicInformationEntity pigBasicInformation = pigBasicInformationService.getById(id);

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

     /**
      * 保存
      */
     @RequestMapping("/save")
     public R save(@RequestBody PigBasicInformationEntity pigBasicInformation){
         pigBasicInformationService.save(pigBasicInformation);

         return R.ok();
     }

     /**
      * 修改
      */
     @RequestMapping("/update")
     public R update(@RequestBody PigBasicInformationEntity pigBasicInformation){
         pigBasicInformationService.updateById(pigBasicInformation);

         return R.ok();
     }

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

         return R.ok();
     }

 }
