123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- package com.huimv.management.controller;
- import java.util.Arrays;
- import java.util.List;
- import java.util.Map;
- 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.PastureAreaEntity;
- import com.huimv.management.service.PastureAreaService;
- import com.huimv.common.utils.PageUtils;
- import com.huimv.common.utils.R;
- /**
- *
- *
- * @author yinhao
- * @email yinhao@163.com
- * @date 2021-06-24 09:55:37
- */
- @RestController
- @RequestMapping("management/pasturearea")
- public class PastureAreaController {
- @Autowired
- private PastureAreaService pastureAreaService;
- /**
- * 列表
- */
- @RequestMapping("/list")
- public R list(@RequestParam Map<String, Object> params){
- PageUtils page = pastureAreaService.queryPage(params);
- return R.ok().put("page", page);
- }
- /**
- * 信息
- */
- @RequestMapping("/info/{id}")
- public R info(@PathVariable("id") Integer id){
- PastureAreaEntity pastureArea = pastureAreaService.getById(id);
- return R.ok().put("pastureArea", pastureArea);
- }
- /**
- * 保存
- */
- @RequestMapping("/save")
- public R save(@RequestBody PastureAreaEntity pastureArea){
- pastureAreaService.save(pastureArea);
- return R.ok();
- }
- /**
- * 修改
- */
- @RequestMapping("/update")
- public R update(@RequestBody PastureAreaEntity pastureArea){
- pastureAreaService.updateById(pastureArea);
- return R.ok();
- }
- /**
- * 删除
- */
- @RequestMapping("/delete")
- public R delete(@RequestBody Integer[] ids){
- pastureAreaService.removeByIds(Arrays.asList(ids));
- return R.ok();
- }
- /**
- * 查询所有
- */
- @RequestMapping("/findAll")
- public R findAll(@RequestBody Integer formFarmId){
- if (formFarmId == null){
- return R.error("请先选择牧场");
- }
- List list = pastureAreaService.findAll(formFarmId);
- return R.ok().put("all",list);
- }
- }
|